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 | 7cf51e4 | 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 | 7cf51e4 | 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, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 133 | ALC269_FUJITSU, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 134 | ALC269_AUTO, |
| 135 | ALC269_MODEL_LAST /* last tag */ |
| 136 | }; |
| 137 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 138 | /* ALC861 models */ |
| 139 | enum { |
| 140 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 141 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | ALC861_3ST_DIG, |
| 143 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 144 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 145 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 146 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 147 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 148 | ALC861_AUTO, |
| 149 | ALC861_MODEL_LAST, |
| 150 | }; |
| 151 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 152 | /* ALC861-VD models */ |
| 153 | enum { |
| 154 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 155 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame^] | 156 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 157 | ALC861VD_3ST, |
| 158 | ALC861VD_3ST_DIG, |
| 159 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 160 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 161 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 162 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 163 | ALC861VD_AUTO, |
| 164 | ALC861VD_MODEL_LAST, |
| 165 | }; |
| 166 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 167 | /* ALC662 models */ |
| 168 | enum { |
| 169 | ALC662_3ST_2ch_DIG, |
| 170 | ALC662_3ST_6ch_DIG, |
| 171 | ALC662_3ST_6ch, |
| 172 | ALC662_5ST_DIG, |
| 173 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 174 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 175 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 176 | ALC663_ASUS_M51VA, |
| 177 | ALC663_ASUS_G71V, |
| 178 | ALC663_ASUS_H13, |
| 179 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 180 | ALC662_ECS, |
| 181 | ALC663_ASUS_MODE1, |
| 182 | ALC662_ASUS_MODE2, |
| 183 | ALC663_ASUS_MODE3, |
| 184 | ALC663_ASUS_MODE4, |
| 185 | ALC663_ASUS_MODE5, |
| 186 | ALC663_ASUS_MODE6, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 187 | ALC662_AUTO, |
| 188 | ALC662_MODEL_LAST, |
| 189 | }; |
| 190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 191 | /* ALC882 models */ |
| 192 | enum { |
| 193 | ALC882_3ST_DIG, |
| 194 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 195 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 196 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 197 | ALC882_TARGA, |
| 198 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 199 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 200 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 201 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 202 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 203 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | ALC882_MODEL_LAST, |
| 205 | }; |
| 206 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 207 | /* ALC883 models */ |
| 208 | enum { |
| 209 | ALC883_3ST_2ch_DIG, |
| 210 | ALC883_3ST_6ch_DIG, |
| 211 | ALC883_3ST_6ch, |
| 212 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 213 | ALC883_TARGA_DIG, |
| 214 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 215 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 216 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 217 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 218 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 219 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 220 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 221 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 222 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 223 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 224 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 225 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 226 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 227 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 228 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 229 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 230 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 231 | ALC888_ASUS_M90V, |
| 232 | ALC888_ASUS_EEE1601, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 233 | ALC883_AUTO, |
| 234 | ALC883_MODEL_LAST, |
| 235 | }; |
| 236 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 237 | /* for GPIO Poll */ |
| 238 | #define GPIO_MASK 0x03 |
| 239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | struct alc_spec { |
| 241 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 242 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 244 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 246 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 247 | * don't forget NULL |
| 248 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 249 | */ |
| 250 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 252 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | struct hda_pcm_stream *stream_analog_playback; |
| 254 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 255 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 256 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 258 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | struct hda_pcm_stream *stream_digital_playback; |
| 260 | struct hda_pcm_stream *stream_digital_capture; |
| 261 | |
| 262 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 263 | struct hda_multi_out multiout; /* playback set-up |
| 264 | * max_channels, dacs must be set |
| 265 | * dig_out_nid and hp_nid are optional |
| 266 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 267 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | |
| 269 | /* capture */ |
| 270 | unsigned int num_adc_nids; |
| 271 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 272 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 273 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 274 | unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | |
| 276 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 277 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | const struct hda_input_mux *input_mux; |
| 279 | unsigned int cur_mux[3]; |
| 280 | |
| 281 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 282 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 284 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | |
| 286 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 287 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 288 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 289 | /* dynamic controls, init_verbs and input_mux */ |
| 290 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 291 | struct snd_array kctls; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 292 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 293 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 294 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 295 | /* hooks */ |
| 296 | void (*init_hook)(struct hda_codec *codec); |
| 297 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 298 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 299 | /* for pin sensing */ |
| 300 | unsigned int sense_updated: 1; |
| 301 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 302 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 303 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 304 | /* for virtual master */ |
| 305 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 306 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 307 | struct hda_loopback_check loopback; |
| 308 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 309 | |
| 310 | /* for PLL fix */ |
| 311 | hda_nid_t pll_nid; |
| 312 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 313 | |
| 314 | #ifdef SND_HDA_NEEDS_RESUME |
| 315 | #define ALC_MAX_PINS 16 |
| 316 | unsigned int num_pins; |
| 317 | hda_nid_t pin_nids[ALC_MAX_PINS]; |
| 318 | unsigned int pin_cfgs[ALC_MAX_PINS]; |
| 319 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 320 | }; |
| 321 | |
| 322 | /* |
| 323 | * configuration template - to be copied to the spec instance |
| 324 | */ |
| 325 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 326 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 327 | * with spec |
| 328 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 329 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 330 | const struct hda_verb *init_verbs[5]; |
| 331 | unsigned int num_dacs; |
| 332 | hda_nid_t *dac_nids; |
| 333 | hda_nid_t dig_out_nid; /* optional */ |
| 334 | hda_nid_t hp_nid; /* optional */ |
| 335 | unsigned int num_adc_nids; |
| 336 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 337 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 338 | hda_nid_t dig_in_nid; |
| 339 | unsigned int num_channel_mode; |
| 340 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 341 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 342 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 343 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 344 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 345 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 346 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 347 | struct hda_amp_list *loopbacks; |
| 348 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | }; |
| 350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
| 352 | /* |
| 353 | * input MUX handling |
| 354 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 355 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 356 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | { |
| 358 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 359 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 360 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 361 | if (mux_idx >= spec->num_mux_defs) |
| 362 | mux_idx = 0; |
| 363 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | } |
| 365 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 366 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 367 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | { |
| 369 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 370 | struct alc_spec *spec = codec->spec; |
| 371 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 372 | |
| 373 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 374 | return 0; |
| 375 | } |
| 376 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 377 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 378 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | { |
| 380 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 381 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 382 | const struct hda_input_mux *imux = spec->input_mux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 384 | hda_nid_t nid = spec->capsrc_nids ? |
| 385 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 387 | if (spec->is_mix_capture) { |
| 388 | /* Matrix-mixer style (e.g. ALC882) */ |
| 389 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 390 | unsigned int i, idx; |
| 391 | |
| 392 | idx = ucontrol->value.enumerated.item[0]; |
| 393 | if (idx >= imux->num_items) |
| 394 | idx = imux->num_items - 1; |
| 395 | if (*cur_val == idx) |
| 396 | return 0; |
| 397 | for (i = 0; i < imux->num_items; i++) { |
| 398 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 399 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 400 | imux->items[i].index, |
| 401 | HDA_AMP_MUTE, v); |
| 402 | } |
| 403 | *cur_val = idx; |
| 404 | return 1; |
| 405 | } else { |
| 406 | /* MUX style (e.g. ALC880) */ |
| 407 | unsigned int mux_idx; |
| 408 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 409 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], |
| 410 | ucontrol, nid, |
| 411 | &spec->cur_mux[adc_idx]); |
| 412 | } |
| 413 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 414 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | /* |
| 416 | * channel mode setting |
| 417 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 418 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 419 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | { |
| 421 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 422 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 423 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 424 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | } |
| 426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 427 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 428 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | { |
| 430 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 431 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 432 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 433 | spec->num_channel_mode, |
| 434 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | } |
| 436 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 437 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 438 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | { |
| 440 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 441 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 442 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 443 | spec->num_channel_mode, |
| 444 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 445 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 446 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 447 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | } |
| 449 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 451 | * 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] | 452 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 453 | * being part of a format specifier. Maximum allowed length of a value is |
| 454 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 455 | * |
| 456 | * Note: some retasking pin complexes seem to ignore requests for input |
| 457 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 458 | * are requested. Therefore order this list so that this behaviour will not |
| 459 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 460 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 461 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 462 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 463 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 464 | "Mic 50pc bias", "Mic 80pc bias", |
| 465 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 466 | }; |
| 467 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 468 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | }; |
| 470 | /* 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] | 471 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 472 | * addition, "input" pins may or may not process the mic bias option |
| 473 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 474 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 475 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 476 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 477 | #define ALC_PIN_DIR_IN 0x00 |
| 478 | #define ALC_PIN_DIR_OUT 0x01 |
| 479 | #define ALC_PIN_DIR_INOUT 0x02 |
| 480 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 481 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 482 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 483 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 484 | * For each direction the minimum and maximum values are given. |
| 485 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 486 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 487 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 488 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 489 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 490 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 491 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 492 | }; |
| 493 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 494 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 495 | #define alc_pin_mode_n_items(_dir) \ |
| 496 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 497 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 498 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 499 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 500 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 501 | unsigned int item_num = uinfo->value.enumerated.item; |
| 502 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 503 | |
| 504 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 505 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 506 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 507 | |
| 508 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 509 | item_num = alc_pin_mode_min(dir); |
| 510 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 511 | return 0; |
| 512 | } |
| 513 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 514 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 515 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 516 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 518 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 519 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 520 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 521 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 522 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 523 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 524 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 525 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 526 | /* Find enumerated value for current pinctl setting */ |
| 527 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 528 | 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] | 529 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | *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] | 531 | return 0; |
| 532 | } |
| 533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 535 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | { |
| 537 | signed int change; |
| 538 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 539 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 540 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 541 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 542 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 543 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 544 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 545 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 546 | 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] | 547 | val = alc_pin_mode_min(dir); |
| 548 | |
| 549 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 550 | if (change) { |
| 551 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 552 | snd_hda_codec_write_cache(codec, nid, 0, |
| 553 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 554 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 555 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 556 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 557 | * for the requested pin mode. Enum values of 2 or less are |
| 558 | * input modes. |
| 559 | * |
| 560 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 561 | * reduces noise slightly (particularly on input) so we'll |
| 562 | * do it. However, having both input and output buffers |
| 563 | * enabled simultaneously doesn't seem to be problematic if |
| 564 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 565 | */ |
| 566 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 567 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 568 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 569 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 570 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 571 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 572 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 573 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 574 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 575 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 576 | } |
| 577 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 578 | return change; |
| 579 | } |
| 580 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 582 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 583 | .info = alc_pin_mode_info, \ |
| 584 | .get = alc_pin_mode_get, \ |
| 585 | .put = alc_pin_mode_put, \ |
| 586 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 587 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 588 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 589 | * together using a mask with more than one bit set. This control is |
| 590 | * currently used only by the ALC260 test model. At this stage they are not |
| 591 | * needed for any "production" models. |
| 592 | */ |
| 593 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 594 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 595 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 596 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 597 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 598 | { |
| 599 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 600 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 601 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 602 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 603 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 604 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 605 | |
| 606 | *valp = (val & mask) != 0; |
| 607 | return 0; |
| 608 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 610 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 611 | { |
| 612 | signed int change; |
| 613 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 614 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 615 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 616 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 617 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 618 | AC_VERB_GET_GPIO_DATA, |
| 619 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 620 | |
| 621 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 622 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 623 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 624 | gpio_data &= ~mask; |
| 625 | else |
| 626 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 627 | snd_hda_codec_write_cache(codec, nid, 0, |
| 628 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 629 | |
| 630 | return change; |
| 631 | } |
| 632 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 633 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 634 | .info = alc_gpio_data_info, \ |
| 635 | .get = alc_gpio_data_get, \ |
| 636 | .put = alc_gpio_data_put, \ |
| 637 | .private_value = nid | (mask<<16) } |
| 638 | #endif /* CONFIG_SND_DEBUG */ |
| 639 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 640 | /* A switch control to allow the enabling of the digital IO pins on the |
| 641 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 642 | * to provide something in the test model allowing digital outputs to be |
| 643 | * identified if present. If models are found which can utilise these |
| 644 | * outputs a more complete mixer control can be devised for those models if |
| 645 | * necessary. |
| 646 | */ |
| 647 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 648 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 649 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 650 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 651 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 652 | { |
| 653 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 654 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 655 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 656 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 657 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 658 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 659 | |
| 660 | *valp = (val & mask) != 0; |
| 661 | return 0; |
| 662 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 663 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 664 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 665 | { |
| 666 | signed int change; |
| 667 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 668 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 669 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 670 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 671 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 672 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 673 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 674 | |
| 675 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 676 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 677 | if (val==0) |
| 678 | ctrl_data &= ~mask; |
| 679 | else |
| 680 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 681 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 682 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 683 | |
| 684 | return change; |
| 685 | } |
| 686 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 687 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 688 | .info = alc_spdif_ctrl_info, \ |
| 689 | .get = alc_spdif_ctrl_get, \ |
| 690 | .put = alc_spdif_ctrl_put, \ |
| 691 | .private_value = nid | (mask<<16) } |
| 692 | #endif /* CONFIG_SND_DEBUG */ |
| 693 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 694 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 695 | * Again, this is only used in the ALC26x test models to help identify when |
| 696 | * the EAPD line must be asserted for features to work. |
| 697 | */ |
| 698 | #ifdef CONFIG_SND_DEBUG |
| 699 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 700 | |
| 701 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 702 | struct snd_ctl_elem_value *ucontrol) |
| 703 | { |
| 704 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 705 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 706 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 707 | long *valp = ucontrol->value.integer.value; |
| 708 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 709 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 710 | |
| 711 | *valp = (val & mask) != 0; |
| 712 | return 0; |
| 713 | } |
| 714 | |
| 715 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 716 | struct snd_ctl_elem_value *ucontrol) |
| 717 | { |
| 718 | int change; |
| 719 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 720 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 721 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 722 | long val = *ucontrol->value.integer.value; |
| 723 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 724 | AC_VERB_GET_EAPD_BTLENABLE, |
| 725 | 0x00); |
| 726 | |
| 727 | /* Set/unset the masked control bit(s) as needed */ |
| 728 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 729 | if (!val) |
| 730 | ctrl_data &= ~mask; |
| 731 | else |
| 732 | ctrl_data |= mask; |
| 733 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 734 | ctrl_data); |
| 735 | |
| 736 | return change; |
| 737 | } |
| 738 | |
| 739 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 740 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 741 | .info = alc_eapd_ctrl_info, \ |
| 742 | .get = alc_eapd_ctrl_get, \ |
| 743 | .put = alc_eapd_ctrl_put, \ |
| 744 | .private_value = nid | (mask<<16) } |
| 745 | #endif /* CONFIG_SND_DEBUG */ |
| 746 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 747 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 748 | */ |
| 749 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 750 | { |
| 751 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 752 | return; |
| 753 | spec->mixers[spec->num_mixers++] = mix; |
| 754 | } |
| 755 | |
| 756 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 757 | { |
| 758 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 759 | return; |
| 760 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 761 | } |
| 762 | |
| 763 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 764 | * set up from the preset table |
| 765 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 766 | static void setup_preset(struct alc_spec *spec, |
| 767 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 768 | { |
| 769 | int i; |
| 770 | |
| 771 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 772 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 773 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 774 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 775 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 776 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 777 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 778 | spec->channel_mode = preset->channel_mode; |
| 779 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 780 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 781 | |
| 782 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 783 | |
| 784 | spec->multiout.num_dacs = preset->num_dacs; |
| 785 | spec->multiout.dac_nids = preset->dac_nids; |
| 786 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 787 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 788 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 789 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 790 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 791 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 792 | spec->input_mux = preset->input_mux; |
| 793 | |
| 794 | spec->num_adc_nids = preset->num_adc_nids; |
| 795 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 796 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 797 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 798 | |
| 799 | spec->unsol_event = preset->unsol_event; |
| 800 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 801 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 802 | spec->loopback.amplist = preset->loopbacks; |
| 803 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 804 | } |
| 805 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 806 | /* Enable GPIO mask and set output */ |
| 807 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 808 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 809 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 810 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 811 | { } |
| 812 | }; |
| 813 | |
| 814 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 815 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 816 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 817 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 818 | { } |
| 819 | }; |
| 820 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 821 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 822 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 823 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 824 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 825 | { } |
| 826 | }; |
| 827 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 828 | /* |
| 829 | * Fix hardware PLL issue |
| 830 | * On some codecs, the analog PLL gating control must be off while |
| 831 | * the default value is 1. |
| 832 | */ |
| 833 | static void alc_fix_pll(struct hda_codec *codec) |
| 834 | { |
| 835 | struct alc_spec *spec = codec->spec; |
| 836 | unsigned int val; |
| 837 | |
| 838 | if (!spec->pll_nid) |
| 839 | return; |
| 840 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 841 | spec->pll_coef_idx); |
| 842 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 843 | AC_VERB_GET_PROC_COEF, 0); |
| 844 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 845 | spec->pll_coef_idx); |
| 846 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 847 | val & ~(1 << spec->pll_coef_bit)); |
| 848 | } |
| 849 | |
| 850 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 851 | unsigned int coef_idx, unsigned int coef_bit) |
| 852 | { |
| 853 | struct alc_spec *spec = codec->spec; |
| 854 | spec->pll_nid = nid; |
| 855 | spec->pll_coef_idx = coef_idx; |
| 856 | spec->pll_coef_bit = coef_bit; |
| 857 | alc_fix_pll(codec); |
| 858 | } |
| 859 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 860 | static void alc_sku_automute(struct hda_codec *codec) |
| 861 | { |
| 862 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 863 | unsigned int present; |
| 864 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 865 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 866 | |
| 867 | /* need to execute and sync at first */ |
| 868 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 869 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 870 | AC_VERB_GET_PIN_SENSE, 0); |
| 871 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 872 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 873 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 874 | } |
| 875 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 876 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 877 | static void alc_mic_automute(struct hda_codec *codec) |
| 878 | { |
| 879 | struct alc_spec *spec = codec->spec; |
| 880 | unsigned int present; |
| 881 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 882 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 883 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 884 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 885 | |
| 886 | capsrc_idx_mic = mic_nid - 0x18; |
| 887 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 888 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 889 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 890 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 891 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 892 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 893 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 894 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 895 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 896 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 897 | #else |
| 898 | #define alc_mic_automute(codec) /* NOP */ |
| 899 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 900 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 901 | /* unsolicited event for HP jack sensing */ |
| 902 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 903 | { |
| 904 | if (codec->vendor_id == 0x10ec0880) |
| 905 | res >>= 28; |
| 906 | else |
| 907 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 908 | if (res == ALC880_HP_EVENT) |
| 909 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 910 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 911 | if (res == ALC880_MIC_EVENT) |
| 912 | alc_mic_automute(codec); |
| 913 | } |
| 914 | |
| 915 | static void alc_inithook(struct hda_codec *codec) |
| 916 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 917 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 918 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 919 | } |
| 920 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 921 | /* additional initialization for ALC888 variants */ |
| 922 | static void alc888_coef_init(struct hda_codec *codec) |
| 923 | { |
| 924 | unsigned int tmp; |
| 925 | |
| 926 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 927 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 928 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 929 | if ((tmp & 0xf0) == 2) |
| 930 | /* alc888S-VC */ |
| 931 | snd_hda_codec_read(codec, 0x20, 0, |
| 932 | AC_VERB_SET_PROC_COEF, 0x830); |
| 933 | else |
| 934 | /* alc888-VB */ |
| 935 | snd_hda_codec_read(codec, 0x20, 0, |
| 936 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 937 | } |
| 938 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 939 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 940 | * 31 ~ 16 : Manufacture ID |
| 941 | * 15 ~ 8 : SKU ID |
| 942 | * 7 ~ 0 : Assembly ID |
| 943 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 944 | */ |
| 945 | static void alc_subsystem_id(struct hda_codec *codec, |
| 946 | unsigned int porta, unsigned int porte, |
| 947 | unsigned int portd) |
| 948 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 949 | unsigned int ass, tmp, i; |
| 950 | unsigned nid; |
| 951 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 952 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 953 | ass = codec->subsystem_id & 0xffff; |
| 954 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 955 | goto do_sku; |
| 956 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 957 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 958 | * 31~30 : port conetcivity |
| 959 | * 29~21 : reserve |
| 960 | * 20 : PCBEEP input |
| 961 | * 19~16 : Check sum (15:1) |
| 962 | * 15~1 : Custom |
| 963 | * 0 : override |
| 964 | */ |
| 965 | nid = 0x1d; |
| 966 | if (codec->vendor_id == 0x10ec0260) |
| 967 | nid = 0x17; |
| 968 | ass = snd_hda_codec_read(codec, nid, 0, |
| 969 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 970 | if (!(ass & 1) && !(ass & 0x100000)) |
| 971 | return; |
| 972 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 973 | return; |
| 974 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 975 | /* check sum */ |
| 976 | tmp = 0; |
| 977 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 978 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 979 | tmp++; |
| 980 | } |
| 981 | if (((ass >> 16) & 0xf) != tmp) |
| 982 | return; |
| 983 | do_sku: |
| 984 | /* |
| 985 | * 0 : override |
| 986 | * 1 : Swap Jack |
| 987 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 988 | * 3~5 : External Amplifier control |
| 989 | * 7~6 : Reserved |
| 990 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 991 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 992 | switch (tmp) { |
| 993 | case 1: |
| 994 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 995 | break; |
| 996 | case 3: |
| 997 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 998 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 999 | case 7: |
| 1000 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1001 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1002 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1003 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1004 | case 0x10ec0260: |
| 1005 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1006 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1007 | snd_hda_codec_write(codec, 0x10, 0, |
| 1008 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1009 | break; |
| 1010 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1011 | case 0x10ec0267: |
| 1012 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1013 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1014 | case 0x10ec0660: |
| 1015 | case 0x10ec0662: |
| 1016 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1017 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1018 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1019 | snd_hda_codec_write(codec, 0x14, 0, |
| 1020 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1021 | snd_hda_codec_write(codec, 0x15, 0, |
| 1022 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1023 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1024 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1025 | switch (codec->vendor_id) { |
| 1026 | case 0x10ec0260: |
| 1027 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1028 | AC_VERB_SET_COEF_INDEX, 7); |
| 1029 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1030 | AC_VERB_GET_PROC_COEF, 0); |
| 1031 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1032 | AC_VERB_SET_COEF_INDEX, 7); |
| 1033 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1034 | AC_VERB_SET_PROC_COEF, |
| 1035 | tmp | 0x2010); |
| 1036 | break; |
| 1037 | case 0x10ec0262: |
| 1038 | case 0x10ec0880: |
| 1039 | case 0x10ec0882: |
| 1040 | case 0x10ec0883: |
| 1041 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1042 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1043 | snd_hda_codec_write(codec, 0x20, 0, |
| 1044 | AC_VERB_SET_COEF_INDEX, 7); |
| 1045 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1046 | AC_VERB_GET_PROC_COEF, 0); |
| 1047 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1048 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1049 | snd_hda_codec_write(codec, 0x20, 0, |
| 1050 | AC_VERB_SET_PROC_COEF, |
| 1051 | tmp | 0x2010); |
| 1052 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1053 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1054 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1055 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1056 | case 0x10ec0267: |
| 1057 | case 0x10ec0268: |
| 1058 | snd_hda_codec_write(codec, 0x20, 0, |
| 1059 | AC_VERB_SET_COEF_INDEX, 7); |
| 1060 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1061 | AC_VERB_GET_PROC_COEF, 0); |
| 1062 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1063 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1064 | snd_hda_codec_write(codec, 0x20, 0, |
| 1065 | AC_VERB_SET_PROC_COEF, |
| 1066 | tmp | 0x3000); |
| 1067 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1068 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1069 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1070 | break; |
| 1071 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1072 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1073 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1074 | * when the external headphone out jack is plugged" |
| 1075 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1076 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1077 | return; |
| 1078 | /* |
| 1079 | * 10~8 : Jack location |
| 1080 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1081 | * 14~13: Resvered |
| 1082 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1083 | * when the external headphone out jack is plugged" |
| 1084 | */ |
| 1085 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1086 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1087 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1088 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1089 | else |
| 1090 | return; |
| 1091 | } |
| 1092 | |
| 1093 | if (!spec->autocfg.hp_pins[0]) { |
| 1094 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1095 | if (tmp == 0) |
| 1096 | spec->autocfg.hp_pins[0] = porta; |
| 1097 | else if (tmp == 1) |
| 1098 | spec->autocfg.hp_pins[0] = porte; |
| 1099 | else if (tmp == 2) |
| 1100 | spec->autocfg.hp_pins[0] = portd; |
| 1101 | else |
| 1102 | return; |
| 1103 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1104 | if (spec->autocfg.hp_pins[0]) |
| 1105 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1106 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1107 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1108 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1109 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1110 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1111 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1112 | snd_hda_codec_write(codec, |
| 1113 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1114 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1115 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1116 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1117 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1118 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1119 | } |
| 1120 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1121 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1122 | * Fix-up pin default configurations |
| 1123 | */ |
| 1124 | |
| 1125 | struct alc_pincfg { |
| 1126 | hda_nid_t nid; |
| 1127 | u32 val; |
| 1128 | }; |
| 1129 | |
| 1130 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1131 | const struct snd_pci_quirk *quirk, |
| 1132 | const struct alc_pincfg **pinfix) |
| 1133 | { |
| 1134 | const struct alc_pincfg *cfg; |
| 1135 | |
| 1136 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1137 | if (!quirk) |
| 1138 | return; |
| 1139 | |
| 1140 | cfg = pinfix[quirk->value]; |
| 1141 | for (; cfg->nid; cfg++) { |
| 1142 | int i; |
| 1143 | u32 val = cfg->val; |
| 1144 | for (i = 0; i < 4; i++) { |
| 1145 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1146 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1147 | val & 0xff); |
| 1148 | val >>= 8; |
| 1149 | } |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1154 | * ALC880 3-stack model |
| 1155 | * |
| 1156 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1157 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1158 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1159 | */ |
| 1160 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1161 | static hda_nid_t alc880_dac_nids[4] = { |
| 1162 | /* front, rear, clfe, rear_surr */ |
| 1163 | 0x02, 0x05, 0x04, 0x03 |
| 1164 | }; |
| 1165 | |
| 1166 | static hda_nid_t alc880_adc_nids[3] = { |
| 1167 | /* ADC0-2 */ |
| 1168 | 0x07, 0x08, 0x09, |
| 1169 | }; |
| 1170 | |
| 1171 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1172 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1173 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1174 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1175 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1176 | /* ADC1-2 */ |
| 1177 | 0x08, 0x09, |
| 1178 | }; |
| 1179 | |
| 1180 | #define ALC880_DIGOUT_NID 0x06 |
| 1181 | #define ALC880_DIGIN_NID 0x0a |
| 1182 | |
| 1183 | static struct hda_input_mux alc880_capture_source = { |
| 1184 | .num_items = 4, |
| 1185 | .items = { |
| 1186 | { "Mic", 0x0 }, |
| 1187 | { "Front Mic", 0x3 }, |
| 1188 | { "Line", 0x2 }, |
| 1189 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1190 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1191 | }; |
| 1192 | |
| 1193 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1194 | /* 2ch mode */ |
| 1195 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1196 | /* set line-in to input, mute it */ |
| 1197 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1198 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1199 | /* set mic-in to input vref 80%, mute it */ |
| 1200 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1201 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1202 | { } /* end */ |
| 1203 | }; |
| 1204 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1205 | /* 6ch mode */ |
| 1206 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1207 | /* set line-in to output, unmute it */ |
| 1208 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1209 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1210 | /* set mic-in to output, unmute it */ |
| 1211 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1212 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1213 | { } /* end */ |
| 1214 | }; |
| 1215 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1216 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1217 | { 2, alc880_threestack_ch2_init }, |
| 1218 | { 6, alc880_threestack_ch6_init }, |
| 1219 | }; |
| 1220 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1221 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1222 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1223 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1224 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1225 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1226 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1227 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1228 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1229 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1230 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1231 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1232 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1233 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1236 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1237 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1238 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1239 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1240 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1241 | { |
| 1242 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1243 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1244 | .info = alc_ch_mode_info, |
| 1245 | .get = alc_ch_mode_get, |
| 1246 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1247 | }, |
| 1248 | { } /* end */ |
| 1249 | }; |
| 1250 | |
| 1251 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1252 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1253 | struct snd_ctl_elem_info *uinfo) |
| 1254 | { |
| 1255 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1256 | struct alc_spec *spec = codec->spec; |
| 1257 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1258 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1259 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1260 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1261 | HDA_INPUT); |
| 1262 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
| 1263 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1264 | return err; |
| 1265 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1266 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1267 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1268 | unsigned int size, unsigned int __user *tlv) |
| 1269 | { |
| 1270 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1271 | struct alc_spec *spec = codec->spec; |
| 1272 | int err; |
| 1273 | |
| 1274 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1275 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1276 | HDA_INPUT); |
| 1277 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
| 1278 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1279 | return err; |
| 1280 | } |
| 1281 | |
| 1282 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1283 | struct snd_ctl_elem_value *ucontrol); |
| 1284 | |
| 1285 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1286 | struct snd_ctl_elem_value *ucontrol, |
| 1287 | getput_call_t func) |
| 1288 | { |
| 1289 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1290 | struct alc_spec *spec = codec->spec; |
| 1291 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1292 | int err; |
| 1293 | |
| 1294 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1295 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1296 | 3, 0, HDA_INPUT); |
| 1297 | err = func(kcontrol, ucontrol); |
| 1298 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1299 | return err; |
| 1300 | } |
| 1301 | |
| 1302 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1303 | struct snd_ctl_elem_value *ucontrol) |
| 1304 | { |
| 1305 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1306 | snd_hda_mixer_amp_volume_get); |
| 1307 | } |
| 1308 | |
| 1309 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1310 | struct snd_ctl_elem_value *ucontrol) |
| 1311 | { |
| 1312 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1313 | snd_hda_mixer_amp_volume_put); |
| 1314 | } |
| 1315 | |
| 1316 | /* capture mixer elements */ |
| 1317 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1318 | |
| 1319 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1320 | struct snd_ctl_elem_value *ucontrol) |
| 1321 | { |
| 1322 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1323 | snd_hda_mixer_amp_switch_get); |
| 1324 | } |
| 1325 | |
| 1326 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1327 | struct snd_ctl_elem_value *ucontrol) |
| 1328 | { |
| 1329 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1330 | snd_hda_mixer_amp_switch_put); |
| 1331 | } |
| 1332 | |
| 1333 | #define DEFINE_CAPMIX(num) \ |
| 1334 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1335 | { \ |
| 1336 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1337 | .name = "Capture Switch", \ |
| 1338 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1339 | .count = num, \ |
| 1340 | .info = alc_cap_sw_info, \ |
| 1341 | .get = alc_cap_sw_get, \ |
| 1342 | .put = alc_cap_sw_put, \ |
| 1343 | }, \ |
| 1344 | { \ |
| 1345 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1346 | .name = "Capture Volume", \ |
| 1347 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1348 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1349 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1350 | .count = num, \ |
| 1351 | .info = alc_cap_vol_info, \ |
| 1352 | .get = alc_cap_vol_get, \ |
| 1353 | .put = alc_cap_vol_put, \ |
| 1354 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1355 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1356 | { \ |
| 1357 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1358 | /* .name = "Capture Source", */ \ |
| 1359 | .name = "Input Source", \ |
| 1360 | .count = num, \ |
| 1361 | .info = alc_mux_enum_info, \ |
| 1362 | .get = alc_mux_enum_get, \ |
| 1363 | .put = alc_mux_enum_put, \ |
| 1364 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1365 | { } /* end */ \ |
| 1366 | } |
| 1367 | |
| 1368 | /* up to three ADCs */ |
| 1369 | DEFINE_CAPMIX(1); |
| 1370 | DEFINE_CAPMIX(2); |
| 1371 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1372 | |
| 1373 | |
| 1374 | /* |
| 1375 | * ALC880 5-stack model |
| 1376 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1377 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1378 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1379 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1380 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1381 | */ |
| 1382 | |
| 1383 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1384 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1385 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1386 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1387 | { } /* end */ |
| 1388 | }; |
| 1389 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1390 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1391 | /* 6ch mode */ |
| 1392 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1393 | /* set line-in to input, mute it */ |
| 1394 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1395 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1396 | { } /* end */ |
| 1397 | }; |
| 1398 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1399 | /* 8ch mode */ |
| 1400 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1401 | /* set line-in to output, unmute it */ |
| 1402 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1403 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1404 | { } /* end */ |
| 1405 | }; |
| 1406 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1407 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1408 | { 6, alc880_fivestack_ch6_init }, |
| 1409 | { 8, alc880_fivestack_ch8_init }, |
| 1410 | }; |
| 1411 | |
| 1412 | |
| 1413 | /* |
| 1414 | * ALC880 6-stack model |
| 1415 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1416 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1417 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1418 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1419 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1420 | */ |
| 1421 | |
| 1422 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1423 | /* front, rear, clfe, rear_surr */ |
| 1424 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1425 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1426 | |
| 1427 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1428 | .num_items = 4, |
| 1429 | .items = { |
| 1430 | { "Mic", 0x0 }, |
| 1431 | { "Front Mic", 0x1 }, |
| 1432 | { "Line", 0x2 }, |
| 1433 | { "CD", 0x4 }, |
| 1434 | }, |
| 1435 | }; |
| 1436 | |
| 1437 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1438 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1439 | { 8, NULL }, |
| 1440 | }; |
| 1441 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1442 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1443 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1444 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1445 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1446 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1447 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1448 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1449 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1450 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1451 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1452 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1454 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1455 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1456 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1459 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1460 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1461 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1462 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1463 | { |
| 1464 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1465 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1466 | .info = alc_ch_mode_info, |
| 1467 | .get = alc_ch_mode_get, |
| 1468 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1469 | }, |
| 1470 | { } /* end */ |
| 1471 | }; |
| 1472 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1473 | |
| 1474 | /* |
| 1475 | * ALC880 W810 model |
| 1476 | * |
| 1477 | * W810 has rear IO for: |
| 1478 | * Front (DAC 02) |
| 1479 | * Surround (DAC 03) |
| 1480 | * Center/LFE (DAC 04) |
| 1481 | * Digital out (06) |
| 1482 | * |
| 1483 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1484 | * 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] | 1485 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1486 | * There is a variable resistor to control the speaker or headphone |
| 1487 | * volume. This is a hardware-only device without a software API. |
| 1488 | * |
| 1489 | * Plugging headphones in will disable the internal speakers. This is |
| 1490 | * implemented in hardware, not via the driver using jack sense. In |
| 1491 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1492 | * disable both the speakers and headphones. |
| 1493 | * |
| 1494 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1495 | * These may not do anything useful with this driver yet, because I |
| 1496 | * haven't setup any initialization verbs for these yet... |
| 1497 | */ |
| 1498 | |
| 1499 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1500 | /* front, rear/surround, clfe */ |
| 1501 | 0x02, 0x03, 0x04 |
| 1502 | }; |
| 1503 | |
| 1504 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1505 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1506 | { 6, NULL } |
| 1507 | }; |
| 1508 | |
| 1509 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1510 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1511 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1512 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1513 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1514 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1515 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1516 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1517 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1518 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1519 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1520 | { } /* end */ |
| 1521 | }; |
| 1522 | |
| 1523 | |
| 1524 | /* |
| 1525 | * Z710V model |
| 1526 | * |
| 1527 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1528 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1529 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1530 | */ |
| 1531 | |
| 1532 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1533 | 0x02 |
| 1534 | }; |
| 1535 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1536 | |
| 1537 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1538 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1539 | { 2, NULL } |
| 1540 | }; |
| 1541 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1542 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1543 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1544 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1545 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1546 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1547 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1548 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1550 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1551 | { } /* end */ |
| 1552 | }; |
| 1553 | |
| 1554 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1555 | /* |
| 1556 | * ALC880 F1734 model |
| 1557 | * |
| 1558 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1559 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1560 | */ |
| 1561 | |
| 1562 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1563 | 0x03 |
| 1564 | }; |
| 1565 | #define ALC880_F1734_HP_DAC 0x02 |
| 1566 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1567 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1568 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1569 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1570 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1571 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1572 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1573 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1574 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1575 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1576 | { } /* end */ |
| 1577 | }; |
| 1578 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1579 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1580 | .num_items = 2, |
| 1581 | .items = { |
| 1582 | { "Mic", 0x1 }, |
| 1583 | { "CD", 0x4 }, |
| 1584 | }, |
| 1585 | }; |
| 1586 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1587 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1588 | /* |
| 1589 | * ALC880 ASUS model |
| 1590 | * |
| 1591 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1592 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1593 | * Mic = 0x18, Line = 0x1a |
| 1594 | */ |
| 1595 | |
| 1596 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1597 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1598 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1599 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1600 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1601 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1602 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1603 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1604 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1605 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1608 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1609 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1610 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1611 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1614 | { |
| 1615 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1616 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1617 | .info = alc_ch_mode_info, |
| 1618 | .get = alc_ch_mode_get, |
| 1619 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1620 | }, |
| 1621 | { } /* end */ |
| 1622 | }; |
| 1623 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1624 | /* |
| 1625 | * ALC880 ASUS W1V model |
| 1626 | * |
| 1627 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1628 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1629 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1630 | */ |
| 1631 | |
| 1632 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1633 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1634 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1635 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1636 | { } /* end */ |
| 1637 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1638 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1639 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1640 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1641 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1642 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1643 | { } /* end */ |
| 1644 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1645 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1646 | /* TCL S700 */ |
| 1647 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1649 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1650 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1651 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1652 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1653 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1654 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1655 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1656 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1657 | { } /* end */ |
| 1658 | }; |
| 1659 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1660 | /* Uniwill */ |
| 1661 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1662 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1663 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1664 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1665 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1666 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1667 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1668 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1669 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1670 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1671 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1673 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1674 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1676 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1677 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1678 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1679 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1680 | { |
| 1681 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1682 | .name = "Channel Mode", |
| 1683 | .info = alc_ch_mode_info, |
| 1684 | .get = alc_ch_mode_get, |
| 1685 | .put = alc_ch_mode_put, |
| 1686 | }, |
| 1687 | { } /* end */ |
| 1688 | }; |
| 1689 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1690 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1692 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1693 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1694 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1695 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1696 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1697 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1698 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1699 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1700 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1701 | { } /* end */ |
| 1702 | }; |
| 1703 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1704 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1705 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1706 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1707 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1708 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1709 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1710 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1711 | { } /* end */ |
| 1712 | }; |
| 1713 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1714 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1715 | * virtual master controls |
| 1716 | */ |
| 1717 | |
| 1718 | /* |
| 1719 | * slave controls for virtual master |
| 1720 | */ |
| 1721 | static const char *alc_slave_vols[] = { |
| 1722 | "Front Playback Volume", |
| 1723 | "Surround Playback Volume", |
| 1724 | "Center Playback Volume", |
| 1725 | "LFE Playback Volume", |
| 1726 | "Side Playback Volume", |
| 1727 | "Headphone Playback Volume", |
| 1728 | "Speaker Playback Volume", |
| 1729 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1730 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1731 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1732 | NULL, |
| 1733 | }; |
| 1734 | |
| 1735 | static const char *alc_slave_sws[] = { |
| 1736 | "Front Playback Switch", |
| 1737 | "Surround Playback Switch", |
| 1738 | "Center Playback Switch", |
| 1739 | "LFE Playback Switch", |
| 1740 | "Side Playback Switch", |
| 1741 | "Headphone Playback Switch", |
| 1742 | "Speaker Playback Switch", |
| 1743 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1744 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1745 | NULL, |
| 1746 | }; |
| 1747 | |
| 1748 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1749 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1750 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1751 | |
| 1752 | static void alc_free_kctls(struct hda_codec *codec); |
| 1753 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1754 | static int alc_build_controls(struct hda_codec *codec) |
| 1755 | { |
| 1756 | struct alc_spec *spec = codec->spec; |
| 1757 | int err; |
| 1758 | int i; |
| 1759 | |
| 1760 | for (i = 0; i < spec->num_mixers; i++) { |
| 1761 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1762 | if (err < 0) |
| 1763 | return err; |
| 1764 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1765 | if (spec->cap_mixer) { |
| 1766 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 1767 | if (err < 0) |
| 1768 | return err; |
| 1769 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1770 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1771 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1772 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1773 | if (err < 0) |
| 1774 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1775 | err = snd_hda_create_spdif_share_sw(codec, |
| 1776 | &spec->multiout); |
| 1777 | if (err < 0) |
| 1778 | return err; |
| 1779 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1780 | } |
| 1781 | if (spec->dig_in_nid) { |
| 1782 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1783 | if (err < 0) |
| 1784 | return err; |
| 1785 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1786 | |
| 1787 | /* if we have no master control, let's create it */ |
| 1788 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1789 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1790 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1791 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1792 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1793 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1794 | if (err < 0) |
| 1795 | return err; |
| 1796 | } |
| 1797 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1798 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1799 | NULL, alc_slave_sws); |
| 1800 | if (err < 0) |
| 1801 | return err; |
| 1802 | } |
| 1803 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1804 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1805 | return 0; |
| 1806 | } |
| 1807 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1808 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1809 | /* |
| 1810 | * initialize the codec volumes, etc |
| 1811 | */ |
| 1812 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1813 | /* |
| 1814 | * generic initialization of ADC, input mixers and output mixers |
| 1815 | */ |
| 1816 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1817 | /* |
| 1818 | * Unmute ADC0-2 and set the default input to mic-in |
| 1819 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1820 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1821 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1822 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1824 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1826 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1827 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1828 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1829 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1830 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1831 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1832 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1833 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1835 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1840 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1841 | /* |
| 1842 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1843 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1844 | /* set vol=0 to output mixers */ |
| 1845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1846 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1847 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1848 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1849 | /* set up input amps for analog loopback */ |
| 1850 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1851 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1853 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1854 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1855 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1857 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1858 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1859 | |
| 1860 | { } |
| 1861 | }; |
| 1862 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1863 | /* |
| 1864 | * 3-stack pin configuration: |
| 1865 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1866 | */ |
| 1867 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1868 | /* |
| 1869 | * preset connection lists of input pins |
| 1870 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1871 | */ |
| 1872 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1873 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1874 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1875 | |
| 1876 | /* |
| 1877 | * Set pin mode and muting |
| 1878 | */ |
| 1879 | /* set front pin widgets 0x14 for output */ |
| 1880 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1881 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1882 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1883 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1884 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1885 | /* Mic2 (as headphone out) for HP output */ |
| 1886 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1887 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1888 | /* Line In pin widget for input */ |
| 1889 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1890 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1891 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1892 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1893 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1894 | /* CD pin widget for input */ |
| 1895 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1896 | |
| 1897 | { } |
| 1898 | }; |
| 1899 | |
| 1900 | /* |
| 1901 | * 5-stack pin configuration: |
| 1902 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1903 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1904 | */ |
| 1905 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1906 | /* |
| 1907 | * preset connection lists of input pins |
| 1908 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1909 | */ |
| 1910 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1911 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1912 | |
| 1913 | /* |
| 1914 | * Set pin mode and muting |
| 1915 | */ |
| 1916 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1917 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1918 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1919 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1920 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1921 | /* unmute pins for output (no gain on this amp) */ |
| 1922 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1924 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1925 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1926 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1927 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1930 | /* Mic2 (as headphone out) for HP output */ |
| 1931 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1932 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1933 | /* Line In pin widget for input */ |
| 1934 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1935 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1936 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1937 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1938 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1939 | /* CD pin widget for input */ |
| 1940 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1941 | |
| 1942 | { } |
| 1943 | }; |
| 1944 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1945 | /* |
| 1946 | * W810 pin configuration: |
| 1947 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1948 | */ |
| 1949 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1950 | /* hphone/speaker input selector: front DAC */ |
| 1951 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1952 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1953 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1954 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1955 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1956 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1957 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1958 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1959 | |
| 1960 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1961 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1962 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1963 | { } |
| 1964 | }; |
| 1965 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1966 | /* |
| 1967 | * Z71V pin configuration: |
| 1968 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1969 | */ |
| 1970 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1971 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1975 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1976 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1977 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1978 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1979 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1980 | |
| 1981 | { } |
| 1982 | }; |
| 1983 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1984 | /* |
| 1985 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1986 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1987 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1988 | */ |
| 1989 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1990 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1991 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1992 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1993 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1994 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1995 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1996 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1997 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1998 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1999 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2000 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2001 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2002 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2003 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2004 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2005 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2006 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2007 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2008 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2009 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2010 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2011 | { } |
| 2012 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2013 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2014 | /* |
| 2015 | * Uniwill pin configuration: |
| 2016 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2017 | * line = 0x1a |
| 2018 | */ |
| 2019 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2020 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2021 | |
| 2022 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2023 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2024 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2025 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2026 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2027 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2028 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2029 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2030 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2031 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2032 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2033 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2035 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2036 | |
| 2037 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2038 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2039 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2040 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2041 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2042 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2043 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2044 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2045 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2046 | |
| 2047 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2048 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2049 | |
| 2050 | { } |
| 2051 | }; |
| 2052 | |
| 2053 | /* |
| 2054 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2055 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2056 | */ |
| 2057 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2058 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2059 | |
| 2060 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2061 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2064 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2065 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2066 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2067 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2068 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2069 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2070 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2072 | |
| 2073 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2075 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2077 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2078 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2079 | |
| 2080 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2081 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2082 | |
| 2083 | { } |
| 2084 | }; |
| 2085 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2086 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2087 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2088 | { } |
| 2089 | }; |
| 2090 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2091 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2092 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2093 | { |
| 2094 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2095 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2096 | |
| 2097 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2098 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2099 | bits = present ? HDA_AMP_MUTE : 0; |
| 2100 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2101 | HDA_AMP_MUTE, bits); |
| 2102 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2103 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2104 | } |
| 2105 | |
| 2106 | /* auto-toggle front mic */ |
| 2107 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2108 | { |
| 2109 | unsigned int present; |
| 2110 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2111 | |
| 2112 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2113 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2114 | bits = present ? HDA_AMP_MUTE : 0; |
| 2115 | 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] | 2116 | } |
| 2117 | |
| 2118 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2119 | { |
| 2120 | alc880_uniwill_hp_automute(codec); |
| 2121 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2122 | } |
| 2123 | |
| 2124 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2125 | unsigned int res) |
| 2126 | { |
| 2127 | /* Looks like the unsol event is incompatible with the standard |
| 2128 | * definition. 4bit tag is placed at 28 bit! |
| 2129 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2130 | switch (res >> 28) { |
| 2131 | case ALC880_HP_EVENT: |
| 2132 | alc880_uniwill_hp_automute(codec); |
| 2133 | break; |
| 2134 | case ALC880_MIC_EVENT: |
| 2135 | alc880_uniwill_mic_automute(codec); |
| 2136 | break; |
| 2137 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2138 | } |
| 2139 | |
| 2140 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2141 | { |
| 2142 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2143 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2144 | |
| 2145 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2146 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2147 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2148 | 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] | 2149 | } |
| 2150 | |
| 2151 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2152 | { |
| 2153 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2154 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2155 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2156 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2157 | present &= HDA_AMP_VOLMASK; |
| 2158 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2159 | HDA_AMP_VOLMASK, present); |
| 2160 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2161 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2162 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2163 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2164 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2165 | unsigned int res) |
| 2166 | { |
| 2167 | /* Looks like the unsol event is incompatible with the standard |
| 2168 | * definition. 4bit tag is placed at 28 bit! |
| 2169 | */ |
| 2170 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2171 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2172 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2173 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2174 | } |
| 2175 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2176 | /* |
| 2177 | * F1734 pin configuration: |
| 2178 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2179 | */ |
| 2180 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2181 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2182 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2183 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2184 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2185 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2186 | |
| 2187 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2188 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2189 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2190 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2191 | |
| 2192 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2193 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2194 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2195 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2196 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2197 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2198 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2199 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2200 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2201 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2202 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2203 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2204 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2205 | { } |
| 2206 | }; |
| 2207 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2208 | /* |
| 2209 | * ASUS pin configuration: |
| 2210 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2211 | */ |
| 2212 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2213 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2214 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2215 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2216 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2217 | |
| 2218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2221 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2222 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2224 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2225 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2226 | |
| 2227 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2228 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2229 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2230 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2231 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2232 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2233 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2234 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2235 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2236 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2237 | { } |
| 2238 | }; |
| 2239 | |
| 2240 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2241 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2242 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2243 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2244 | /* Clevo m520g init */ |
| 2245 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2246 | /* headphone output */ |
| 2247 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2248 | /* line-out */ |
| 2249 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2250 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2251 | /* Line-in */ |
| 2252 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2253 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2254 | /* CD */ |
| 2255 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2256 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2257 | /* Mic1 (rear panel) */ |
| 2258 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2259 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2260 | /* Mic2 (front panel) */ |
| 2261 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2262 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2263 | /* headphone */ |
| 2264 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2265 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2266 | /* change to EAPD mode */ |
| 2267 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2268 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2269 | |
| 2270 | { } |
| 2271 | }; |
| 2272 | |
| 2273 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2274 | /* change to EAPD mode */ |
| 2275 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2276 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2278 | /* Headphone output */ |
| 2279 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2280 | /* Front output*/ |
| 2281 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2282 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2283 | |
| 2284 | /* Line In pin widget for input */ |
| 2285 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2286 | /* CD pin widget for input */ |
| 2287 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2288 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2289 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2290 | |
| 2291 | /* change to EAPD mode */ |
| 2292 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2293 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2294 | |
| 2295 | { } |
| 2296 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2297 | |
| 2298 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2299 | * LG m1 express dual |
| 2300 | * |
| 2301 | * Pin assignment: |
| 2302 | * Rear Line-In/Out (blue): 0x14 |
| 2303 | * Build-in Mic-In: 0x15 |
| 2304 | * Speaker-out: 0x17 |
| 2305 | * HP-Out (green): 0x1b |
| 2306 | * Mic-In/Out (red): 0x19 |
| 2307 | * SPDIF-Out: 0x1e |
| 2308 | */ |
| 2309 | |
| 2310 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2311 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2312 | 0x05, 0x02, 0x03 |
| 2313 | }; |
| 2314 | |
| 2315 | /* seems analog CD is not working */ |
| 2316 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2317 | .num_items = 3, |
| 2318 | .items = { |
| 2319 | { "Mic", 0x1 }, |
| 2320 | { "Line", 0x5 }, |
| 2321 | { "Internal Mic", 0x6 }, |
| 2322 | }, |
| 2323 | }; |
| 2324 | |
| 2325 | /* 2,4,6 channel modes */ |
| 2326 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2327 | /* set line-in and mic-in to input */ |
| 2328 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2329 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2330 | { } |
| 2331 | }; |
| 2332 | |
| 2333 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2334 | /* set line-in to out and mic-in to input */ |
| 2335 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2336 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2337 | { } |
| 2338 | }; |
| 2339 | |
| 2340 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2341 | /* set line-in and mic-in to output */ |
| 2342 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2343 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2344 | { } |
| 2345 | }; |
| 2346 | |
| 2347 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2348 | { 2, alc880_lg_ch2_init }, |
| 2349 | { 4, alc880_lg_ch4_init }, |
| 2350 | { 6, alc880_lg_ch6_init }, |
| 2351 | }; |
| 2352 | |
| 2353 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2354 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2355 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2356 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2357 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2358 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2359 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2360 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2361 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2362 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2363 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2364 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2365 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2366 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2367 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2368 | { |
| 2369 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2370 | .name = "Channel Mode", |
| 2371 | .info = alc_ch_mode_info, |
| 2372 | .get = alc_ch_mode_get, |
| 2373 | .put = alc_ch_mode_put, |
| 2374 | }, |
| 2375 | { } /* end */ |
| 2376 | }; |
| 2377 | |
| 2378 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2379 | /* set capture source to mic-in */ |
| 2380 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2381 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2382 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2383 | /* mute all amp mixer inputs */ |
| 2384 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2385 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2387 | /* line-in to input */ |
| 2388 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2389 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2390 | /* built-in mic */ |
| 2391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2392 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2393 | /* speaker-out */ |
| 2394 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2395 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2396 | /* mic-in to input */ |
| 2397 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2398 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2399 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2400 | /* HP-out */ |
| 2401 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2402 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2403 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2404 | /* jack sense */ |
| 2405 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2406 | { } |
| 2407 | }; |
| 2408 | |
| 2409 | /* toggle speaker-output according to the hp-jack state */ |
| 2410 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2411 | { |
| 2412 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2413 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2414 | |
| 2415 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2416 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2417 | bits = present ? HDA_AMP_MUTE : 0; |
| 2418 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2419 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2420 | } |
| 2421 | |
| 2422 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2423 | { |
| 2424 | /* Looks like the unsol event is incompatible with the standard |
| 2425 | * definition. 4bit tag is placed at 28 bit! |
| 2426 | */ |
| 2427 | if ((res >> 28) == 0x01) |
| 2428 | alc880_lg_automute(codec); |
| 2429 | } |
| 2430 | |
| 2431 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2432 | * LG LW20 |
| 2433 | * |
| 2434 | * Pin assignment: |
| 2435 | * Speaker-out: 0x14 |
| 2436 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2437 | * Built-in Mic-In: 0x19 |
| 2438 | * Line-In: 0x1b |
| 2439 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2440 | * SPDIF-Out: 0x1e |
| 2441 | */ |
| 2442 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2443 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2444 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2445 | .items = { |
| 2446 | { "Mic", 0x0 }, |
| 2447 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2448 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2449 | }, |
| 2450 | }; |
| 2451 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2452 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2453 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2454 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2455 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2456 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2457 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2458 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2459 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2460 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2461 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2462 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2463 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2464 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2467 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2468 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2469 | { |
| 2470 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2471 | .name = "Channel Mode", |
| 2472 | .info = alc_ch_mode_info, |
| 2473 | .get = alc_ch_mode_get, |
| 2474 | .put = alc_ch_mode_put, |
| 2475 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2476 | { } /* end */ |
| 2477 | }; |
| 2478 | |
| 2479 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2480 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2481 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2482 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2483 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2484 | /* set capture source to mic-in */ |
| 2485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2486 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2487 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2488 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2489 | /* speaker-out */ |
| 2490 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2491 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2492 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2493 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2494 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2495 | /* mic-in to input */ |
| 2496 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2497 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2498 | /* built-in mic */ |
| 2499 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2500 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2501 | /* jack sense */ |
| 2502 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2503 | { } |
| 2504 | }; |
| 2505 | |
| 2506 | /* toggle speaker-output according to the hp-jack state */ |
| 2507 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2508 | { |
| 2509 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2510 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2511 | |
| 2512 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2513 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2514 | bits = present ? HDA_AMP_MUTE : 0; |
| 2515 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2516 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2517 | } |
| 2518 | |
| 2519 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2520 | { |
| 2521 | /* Looks like the unsol event is incompatible with the standard |
| 2522 | * definition. 4bit tag is placed at 28 bit! |
| 2523 | */ |
| 2524 | if ((res >> 28) == 0x01) |
| 2525 | alc880_lg_lw_automute(codec); |
| 2526 | } |
| 2527 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2528 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2529 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2530 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2533 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2534 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2535 | { } /* end */ |
| 2536 | }; |
| 2537 | |
| 2538 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2539 | .num_items = 2, |
| 2540 | .items = { |
| 2541 | { "Mic", 0x0 }, |
| 2542 | { "Internal Mic", 0x1 }, |
| 2543 | }, |
| 2544 | }; |
| 2545 | |
| 2546 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2547 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2548 | |
| 2549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2550 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2551 | |
| 2552 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2553 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2554 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2555 | /* Mic2 (as headphone out) for HP output */ |
| 2556 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2557 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2558 | /* Internal Speaker */ |
| 2559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2560 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2561 | |
| 2562 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2563 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2564 | |
| 2565 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2566 | { } |
| 2567 | }; |
| 2568 | |
| 2569 | /* toggle speaker-output according to the hp-jack state */ |
| 2570 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2571 | { |
| 2572 | unsigned int present; |
| 2573 | unsigned char bits; |
| 2574 | |
| 2575 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2576 | AC_VERB_GET_PIN_SENSE, 0) |
| 2577 | & AC_PINSENSE_PRESENCE; |
| 2578 | bits = present ? HDA_AMP_MUTE : 0; |
| 2579 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2580 | HDA_AMP_MUTE, bits); |
| 2581 | if (present) |
| 2582 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2583 | else |
| 2584 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2585 | } |
| 2586 | |
| 2587 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2588 | unsigned int res) |
| 2589 | { |
| 2590 | /* Looks like the unsol event is incompatible with the standard |
| 2591 | * definition. 4bit tag is placed at 28 bit! |
| 2592 | */ |
| 2593 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2594 | alc880_medion_rim_automute(codec); |
| 2595 | } |
| 2596 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2597 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2598 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2599 | { 0x0b, HDA_INPUT, 0 }, |
| 2600 | { 0x0b, HDA_INPUT, 1 }, |
| 2601 | { 0x0b, HDA_INPUT, 2 }, |
| 2602 | { 0x0b, HDA_INPUT, 3 }, |
| 2603 | { 0x0b, HDA_INPUT, 4 }, |
| 2604 | { } /* end */ |
| 2605 | }; |
| 2606 | |
| 2607 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2608 | { 0x0b, HDA_INPUT, 1 }, |
| 2609 | { 0x0b, HDA_INPUT, 6 }, |
| 2610 | { 0x0b, HDA_INPUT, 7 }, |
| 2611 | { } /* end */ |
| 2612 | }; |
| 2613 | #endif |
| 2614 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2615 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2616 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2617 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2618 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2619 | static int alc_init(struct hda_codec *codec) |
| 2620 | { |
| 2621 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2622 | unsigned int i; |
| 2623 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2624 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2625 | if (codec->vendor_id == 0x10ec0888) |
| 2626 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2627 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2628 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2629 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2630 | |
| 2631 | if (spec->init_hook) |
| 2632 | spec->init_hook(codec); |
| 2633 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2634 | return 0; |
| 2635 | } |
| 2636 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2637 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2638 | { |
| 2639 | struct alc_spec *spec = codec->spec; |
| 2640 | |
| 2641 | if (spec->unsol_event) |
| 2642 | spec->unsol_event(codec, res); |
| 2643 | } |
| 2644 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2645 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2646 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2647 | { |
| 2648 | struct alc_spec *spec = codec->spec; |
| 2649 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2650 | } |
| 2651 | #endif |
| 2652 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2653 | /* |
| 2654 | * Analog playback callbacks |
| 2655 | */ |
| 2656 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2657 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2658 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2659 | { |
| 2660 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2661 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2662 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2663 | } |
| 2664 | |
| 2665 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2666 | struct hda_codec *codec, |
| 2667 | unsigned int stream_tag, |
| 2668 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2669 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2670 | { |
| 2671 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2672 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2673 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2674 | } |
| 2675 | |
| 2676 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2677 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2678 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2679 | { |
| 2680 | struct alc_spec *spec = codec->spec; |
| 2681 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2682 | } |
| 2683 | |
| 2684 | /* |
| 2685 | * Digital out |
| 2686 | */ |
| 2687 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2688 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2689 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2690 | { |
| 2691 | struct alc_spec *spec = codec->spec; |
| 2692 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2693 | } |
| 2694 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2695 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2696 | struct hda_codec *codec, |
| 2697 | unsigned int stream_tag, |
| 2698 | unsigned int format, |
| 2699 | struct snd_pcm_substream *substream) |
| 2700 | { |
| 2701 | struct alc_spec *spec = codec->spec; |
| 2702 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2703 | stream_tag, format, substream); |
| 2704 | } |
| 2705 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2706 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2707 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2708 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2709 | { |
| 2710 | struct alc_spec *spec = codec->spec; |
| 2711 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2712 | } |
| 2713 | |
| 2714 | /* |
| 2715 | * Analog capture |
| 2716 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2717 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2718 | struct hda_codec *codec, |
| 2719 | unsigned int stream_tag, |
| 2720 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2721 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2722 | { |
| 2723 | struct alc_spec *spec = codec->spec; |
| 2724 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2725 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2726 | stream_tag, 0, format); |
| 2727 | return 0; |
| 2728 | } |
| 2729 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2730 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2731 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2732 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2733 | { |
| 2734 | struct alc_spec *spec = codec->spec; |
| 2735 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2736 | snd_hda_codec_cleanup_stream(codec, |
| 2737 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2738 | return 0; |
| 2739 | } |
| 2740 | |
| 2741 | |
| 2742 | /* |
| 2743 | */ |
| 2744 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2745 | .substreams = 1, |
| 2746 | .channels_min = 2, |
| 2747 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2748 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2749 | .ops = { |
| 2750 | .open = alc880_playback_pcm_open, |
| 2751 | .prepare = alc880_playback_pcm_prepare, |
| 2752 | .cleanup = alc880_playback_pcm_cleanup |
| 2753 | }, |
| 2754 | }; |
| 2755 | |
| 2756 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2757 | .substreams = 1, |
| 2758 | .channels_min = 2, |
| 2759 | .channels_max = 2, |
| 2760 | /* NID is set in alc_build_pcms */ |
| 2761 | }; |
| 2762 | |
| 2763 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2764 | .substreams = 1, |
| 2765 | .channels_min = 2, |
| 2766 | .channels_max = 2, |
| 2767 | /* NID is set in alc_build_pcms */ |
| 2768 | }; |
| 2769 | |
| 2770 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2771 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2772 | .channels_min = 2, |
| 2773 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2774 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2775 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2776 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2777 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2778 | }, |
| 2779 | }; |
| 2780 | |
| 2781 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2782 | .substreams = 1, |
| 2783 | .channels_min = 2, |
| 2784 | .channels_max = 2, |
| 2785 | /* NID is set in alc_build_pcms */ |
| 2786 | .ops = { |
| 2787 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2788 | .close = alc880_dig_playback_pcm_close, |
| 2789 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2790 | }, |
| 2791 | }; |
| 2792 | |
| 2793 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2794 | .substreams = 1, |
| 2795 | .channels_min = 2, |
| 2796 | .channels_max = 2, |
| 2797 | /* NID is set in alc_build_pcms */ |
| 2798 | }; |
| 2799 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2800 | /* 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] | 2801 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2802 | .substreams = 0, |
| 2803 | .channels_min = 0, |
| 2804 | .channels_max = 0, |
| 2805 | }; |
| 2806 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2807 | static int alc_build_pcms(struct hda_codec *codec) |
| 2808 | { |
| 2809 | struct alc_spec *spec = codec->spec; |
| 2810 | struct hda_pcm *info = spec->pcm_rec; |
| 2811 | int i; |
| 2812 | |
| 2813 | codec->num_pcms = 1; |
| 2814 | codec->pcm_info = info; |
| 2815 | |
| 2816 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2817 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2818 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2819 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2820 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2821 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2822 | } |
| 2823 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2824 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2825 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2826 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2827 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2828 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2829 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2830 | if (spec->channel_mode) { |
| 2831 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2832 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2833 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2834 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2835 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2836 | } |
| 2837 | } |
| 2838 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2839 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2840 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2841 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2842 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2843 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2844 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2845 | if (spec->multiout.dig_out_nid && |
| 2846 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2847 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2848 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2849 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2850 | if (spec->dig_in_nid && |
| 2851 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2852 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2853 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2854 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 2855 | /* FIXME: do we need this for all Realtek codec models? */ |
| 2856 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2857 | } |
| 2858 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2859 | /* If the use of more than one ADC is requested for the current |
| 2860 | * model, configure a second analog capture-only PCM. |
| 2861 | */ |
| 2862 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2863 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2864 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2865 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2866 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2867 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2868 | if (spec->alt_dac_nid) { |
| 2869 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2870 | *spec->stream_analog_alt_playback; |
| 2871 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2872 | spec->alt_dac_nid; |
| 2873 | } else { |
| 2874 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2875 | alc_pcm_null_stream; |
| 2876 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2877 | } |
| 2878 | if (spec->num_adc_nids > 1) { |
| 2879 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2880 | *spec->stream_analog_alt_capture; |
| 2881 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2882 | spec->adc_nids[1]; |
| 2883 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2884 | spec->num_adc_nids - 1; |
| 2885 | } else { |
| 2886 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2887 | alc_pcm_null_stream; |
| 2888 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2889 | } |
| 2890 | } |
| 2891 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2892 | return 0; |
| 2893 | } |
| 2894 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2895 | static void alc_free_kctls(struct hda_codec *codec) |
| 2896 | { |
| 2897 | struct alc_spec *spec = codec->spec; |
| 2898 | |
| 2899 | if (spec->kctls.list) { |
| 2900 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 2901 | int i; |
| 2902 | for (i = 0; i < spec->kctls.used; i++) |
| 2903 | kfree(kctl[i].name); |
| 2904 | } |
| 2905 | snd_array_free(&spec->kctls); |
| 2906 | } |
| 2907 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2908 | static void alc_free(struct hda_codec *codec) |
| 2909 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2910 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2911 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2912 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2913 | return; |
| 2914 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2915 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2916 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2917 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2918 | } |
| 2919 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 2920 | #ifdef SND_HDA_NEEDS_RESUME |
| 2921 | static void store_pin_configs(struct hda_codec *codec) |
| 2922 | { |
| 2923 | struct alc_spec *spec = codec->spec; |
| 2924 | hda_nid_t nid, end_nid; |
| 2925 | |
| 2926 | end_nid = codec->start_nid + codec->num_nodes; |
| 2927 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 2928 | unsigned int wid_caps = get_wcaps(codec, nid); |
| 2929 | unsigned int wid_type = |
| 2930 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 2931 | if (wid_type != AC_WID_PIN) |
| 2932 | continue; |
| 2933 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) |
| 2934 | break; |
| 2935 | spec->pin_nids[spec->num_pins] = nid; |
| 2936 | spec->pin_cfgs[spec->num_pins] = |
| 2937 | snd_hda_codec_read(codec, nid, 0, |
| 2938 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 2939 | spec->num_pins++; |
| 2940 | } |
| 2941 | } |
| 2942 | |
| 2943 | static void resume_pin_configs(struct hda_codec *codec) |
| 2944 | { |
| 2945 | struct alc_spec *spec = codec->spec; |
| 2946 | int i; |
| 2947 | |
| 2948 | for (i = 0; i < spec->num_pins; i++) { |
| 2949 | hda_nid_t pin_nid = spec->pin_nids[i]; |
| 2950 | unsigned int pin_config = spec->pin_cfgs[i]; |
| 2951 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2952 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 2953 | pin_config & 0x000000ff); |
| 2954 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2955 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 2956 | (pin_config & 0x0000ff00) >> 8); |
| 2957 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2958 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 2959 | (pin_config & 0x00ff0000) >> 16); |
| 2960 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2961 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 2962 | pin_config >> 24); |
| 2963 | } |
| 2964 | } |
| 2965 | |
| 2966 | static int alc_resume(struct hda_codec *codec) |
| 2967 | { |
| 2968 | resume_pin_configs(codec); |
| 2969 | codec->patch_ops.init(codec); |
| 2970 | snd_hda_codec_resume_amp(codec); |
| 2971 | snd_hda_codec_resume_cache(codec); |
| 2972 | return 0; |
| 2973 | } |
| 2974 | #else |
| 2975 | #define store_pin_configs(codec) |
| 2976 | #endif |
| 2977 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2978 | /* |
| 2979 | */ |
| 2980 | static struct hda_codec_ops alc_patch_ops = { |
| 2981 | .build_controls = alc_build_controls, |
| 2982 | .build_pcms = alc_build_pcms, |
| 2983 | .init = alc_init, |
| 2984 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2985 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 2986 | #ifdef SND_HDA_NEEDS_RESUME |
| 2987 | .resume = alc_resume, |
| 2988 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2989 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2990 | .check_power_status = alc_check_power_status, |
| 2991 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2992 | }; |
| 2993 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2994 | |
| 2995 | /* |
| 2996 | * Test configuration for debugging |
| 2997 | * |
| 2998 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2999 | * enum controls. |
| 3000 | */ |
| 3001 | #ifdef CONFIG_SND_DEBUG |
| 3002 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3003 | 0x02, 0x03, 0x04, 0x05 |
| 3004 | }; |
| 3005 | |
| 3006 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3007 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3008 | .items = { |
| 3009 | { "In-1", 0x0 }, |
| 3010 | { "In-2", 0x1 }, |
| 3011 | { "In-3", 0x2 }, |
| 3012 | { "In-4", 0x3 }, |
| 3013 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3014 | { "Front", 0x5 }, |
| 3015 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3016 | }, |
| 3017 | }; |
| 3018 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3019 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3020 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3021 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3022 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3023 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3024 | }; |
| 3025 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3026 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3027 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3028 | { |
| 3029 | static char *texts[] = { |
| 3030 | "N/A", "Line Out", "HP Out", |
| 3031 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3032 | }; |
| 3033 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3034 | uinfo->count = 1; |
| 3035 | uinfo->value.enumerated.items = 8; |
| 3036 | if (uinfo->value.enumerated.item >= 8) |
| 3037 | uinfo->value.enumerated.item = 7; |
| 3038 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3039 | return 0; |
| 3040 | } |
| 3041 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3042 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3043 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3044 | { |
| 3045 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3046 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3047 | unsigned int pin_ctl, item = 0; |
| 3048 | |
| 3049 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3050 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3051 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3052 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3053 | item = 2; |
| 3054 | else |
| 3055 | item = 1; |
| 3056 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3057 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3058 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3059 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3060 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3061 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3062 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3063 | } |
| 3064 | } |
| 3065 | ucontrol->value.enumerated.item[0] = item; |
| 3066 | return 0; |
| 3067 | } |
| 3068 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3069 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3070 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3071 | { |
| 3072 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3073 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3074 | static unsigned int ctls[] = { |
| 3075 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3076 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3077 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3078 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3079 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3080 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3081 | }; |
| 3082 | unsigned int old_ctl, new_ctl; |
| 3083 | |
| 3084 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3085 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3086 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3087 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3088 | int val; |
| 3089 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3090 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3091 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3092 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3093 | HDA_AMP_MUTE : 0; |
| 3094 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3095 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3096 | return 1; |
| 3097 | } |
| 3098 | return 0; |
| 3099 | } |
| 3100 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3101 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3102 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3103 | { |
| 3104 | static char *texts[] = { |
| 3105 | "Front", "Surround", "CLFE", "Side" |
| 3106 | }; |
| 3107 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3108 | uinfo->count = 1; |
| 3109 | uinfo->value.enumerated.items = 4; |
| 3110 | if (uinfo->value.enumerated.item >= 4) |
| 3111 | uinfo->value.enumerated.item = 3; |
| 3112 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3113 | return 0; |
| 3114 | } |
| 3115 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3116 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3117 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3118 | { |
| 3119 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3120 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3121 | unsigned int sel; |
| 3122 | |
| 3123 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3124 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3125 | return 0; |
| 3126 | } |
| 3127 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3128 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3129 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3130 | { |
| 3131 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3132 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3133 | unsigned int sel; |
| 3134 | |
| 3135 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3136 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3137 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3138 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3139 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3140 | return 1; |
| 3141 | } |
| 3142 | return 0; |
| 3143 | } |
| 3144 | |
| 3145 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3146 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3147 | .name = xname, \ |
| 3148 | .info = alc_test_pin_ctl_info, \ |
| 3149 | .get = alc_test_pin_ctl_get, \ |
| 3150 | .put = alc_test_pin_ctl_put, \ |
| 3151 | .private_value = nid \ |
| 3152 | } |
| 3153 | |
| 3154 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3155 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3156 | .name = xname, \ |
| 3157 | .info = alc_test_pin_src_info, \ |
| 3158 | .get = alc_test_pin_src_get, \ |
| 3159 | .put = alc_test_pin_src_put, \ |
| 3160 | .private_value = nid \ |
| 3161 | } |
| 3162 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3163 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3164 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3165 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3166 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3167 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3168 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3169 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3170 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3171 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3172 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3173 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3174 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3175 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3176 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3177 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3178 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3179 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3180 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3181 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3182 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3183 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3184 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3185 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3186 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3187 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3188 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3189 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3190 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3191 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3192 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3193 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3194 | { |
| 3195 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3196 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3197 | .info = alc_ch_mode_info, |
| 3198 | .get = alc_ch_mode_get, |
| 3199 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3200 | }, |
| 3201 | { } /* end */ |
| 3202 | }; |
| 3203 | |
| 3204 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3205 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3206 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3208 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3209 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3211 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3212 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3213 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3214 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3216 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3217 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3218 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3219 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3220 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3221 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3222 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3223 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3224 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3225 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3226 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3227 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3228 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3229 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3230 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3231 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3232 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3233 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3234 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3235 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3236 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3237 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3238 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3239 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3240 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3242 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3243 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3244 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3245 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3246 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3247 | /* Analog input/passthru */ |
| 3248 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3249 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3250 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3251 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3252 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3253 | { } |
| 3254 | }; |
| 3255 | #endif |
| 3256 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3257 | /* |
| 3258 | */ |
| 3259 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3260 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3261 | [ALC880_3ST] = "3stack", |
| 3262 | [ALC880_TCL_S700] = "tcl", |
| 3263 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3264 | [ALC880_CLEVO] = "clevo", |
| 3265 | [ALC880_5ST] = "5stack", |
| 3266 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3267 | [ALC880_W810] = "w810", |
| 3268 | [ALC880_Z71V] = "z71v", |
| 3269 | [ALC880_6ST] = "6stack", |
| 3270 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3271 | [ALC880_ASUS] = "asus", |
| 3272 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3273 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3274 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3275 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3276 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3277 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3278 | [ALC880_F1734] = "F1734", |
| 3279 | [ALC880_LG] = "lg", |
| 3280 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3281 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3282 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3283 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3284 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3285 | [ALC880_AUTO] = "auto", |
| 3286 | }; |
| 3287 | |
| 3288 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3289 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3290 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3291 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3292 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3293 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3294 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3295 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3296 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3297 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3298 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3299 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3300 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3301 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3302 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3303 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3304 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3305 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3306 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3307 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3308 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3309 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3310 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3311 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3312 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3313 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3314 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3315 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3316 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3317 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3318 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3319 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3320 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3321 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3322 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3323 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3324 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3325 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3326 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3327 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3328 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3329 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3330 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3331 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3332 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3333 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3334 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3335 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3336 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3337 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3338 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3339 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3340 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3341 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3342 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3343 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3344 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3345 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3346 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3347 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3348 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3349 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3350 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3351 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3352 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3353 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3354 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3355 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3356 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3357 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3358 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3359 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3360 | {} |
| 3361 | }; |
| 3362 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3363 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3364 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3365 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3366 | static struct alc_config_preset alc880_presets[] = { |
| 3367 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3368 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3369 | .init_verbs = { alc880_volume_init_verbs, |
| 3370 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3371 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3372 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3373 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3374 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3375 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3376 | .input_mux = &alc880_capture_source, |
| 3377 | }, |
| 3378 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3379 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3380 | .init_verbs = { alc880_volume_init_verbs, |
| 3381 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3382 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3383 | .dac_nids = alc880_dac_nids, |
| 3384 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3385 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3386 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3387 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3388 | .input_mux = &alc880_capture_source, |
| 3389 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3390 | [ALC880_TCL_S700] = { |
| 3391 | .mixers = { alc880_tcl_s700_mixer }, |
| 3392 | .init_verbs = { alc880_volume_init_verbs, |
| 3393 | alc880_pin_tcl_S700_init_verbs, |
| 3394 | alc880_gpio2_init_verbs }, |
| 3395 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3396 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3397 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3398 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3399 | .hp_nid = 0x03, |
| 3400 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3401 | .channel_mode = alc880_2_jack_modes, |
| 3402 | .input_mux = &alc880_capture_source, |
| 3403 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3404 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3405 | .mixers = { alc880_three_stack_mixer, |
| 3406 | alc880_five_stack_mixer}, |
| 3407 | .init_verbs = { alc880_volume_init_verbs, |
| 3408 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3409 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3410 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3411 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3412 | .channel_mode = alc880_fivestack_modes, |
| 3413 | .input_mux = &alc880_capture_source, |
| 3414 | }, |
| 3415 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3416 | .mixers = { alc880_three_stack_mixer, |
| 3417 | alc880_five_stack_mixer }, |
| 3418 | .init_verbs = { alc880_volume_init_verbs, |
| 3419 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3420 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3421 | .dac_nids = alc880_dac_nids, |
| 3422 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3423 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3424 | .channel_mode = alc880_fivestack_modes, |
| 3425 | .input_mux = &alc880_capture_source, |
| 3426 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3427 | [ALC880_6ST] = { |
| 3428 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3429 | .init_verbs = { alc880_volume_init_verbs, |
| 3430 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3431 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3432 | .dac_nids = alc880_6st_dac_nids, |
| 3433 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3434 | .channel_mode = alc880_sixstack_modes, |
| 3435 | .input_mux = &alc880_6stack_capture_source, |
| 3436 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3437 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3438 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3439 | .init_verbs = { alc880_volume_init_verbs, |
| 3440 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3441 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3442 | .dac_nids = alc880_6st_dac_nids, |
| 3443 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3444 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3445 | .channel_mode = alc880_sixstack_modes, |
| 3446 | .input_mux = &alc880_6stack_capture_source, |
| 3447 | }, |
| 3448 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3449 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3450 | .init_verbs = { alc880_volume_init_verbs, |
| 3451 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3452 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3453 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3454 | .dac_nids = alc880_w810_dac_nids, |
| 3455 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3456 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3457 | .channel_mode = alc880_w810_modes, |
| 3458 | .input_mux = &alc880_capture_source, |
| 3459 | }, |
| 3460 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3461 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3462 | .init_verbs = { alc880_volume_init_verbs, |
| 3463 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3464 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3465 | .dac_nids = alc880_z71v_dac_nids, |
| 3466 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3467 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3468 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3469 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3470 | .input_mux = &alc880_capture_source, |
| 3471 | }, |
| 3472 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3473 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3474 | .init_verbs = { alc880_volume_init_verbs, |
| 3475 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3476 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3477 | .dac_nids = alc880_f1734_dac_nids, |
| 3478 | .hp_nid = 0x02, |
| 3479 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3480 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3481 | .input_mux = &alc880_f1734_capture_source, |
| 3482 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3483 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3484 | }, |
| 3485 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3486 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3487 | .init_verbs = { alc880_volume_init_verbs, |
| 3488 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3489 | alc880_gpio1_init_verbs }, |
| 3490 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3491 | .dac_nids = alc880_asus_dac_nids, |
| 3492 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3493 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3494 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3495 | .input_mux = &alc880_capture_source, |
| 3496 | }, |
| 3497 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3498 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3499 | .init_verbs = { alc880_volume_init_verbs, |
| 3500 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | alc880_gpio1_init_verbs }, |
| 3502 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3503 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3504 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3505 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3506 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3507 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3508 | .input_mux = &alc880_capture_source, |
| 3509 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3510 | [ALC880_ASUS_DIG2] = { |
| 3511 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3512 | .init_verbs = { alc880_volume_init_verbs, |
| 3513 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3514 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3515 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3516 | .dac_nids = alc880_asus_dac_nids, |
| 3517 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3518 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3519 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3520 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3521 | .input_mux = &alc880_capture_source, |
| 3522 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3523 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3524 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3525 | .init_verbs = { alc880_volume_init_verbs, |
| 3526 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3527 | alc880_gpio1_init_verbs }, |
| 3528 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3529 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3530 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3531 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3532 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3533 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3534 | .input_mux = &alc880_capture_source, |
| 3535 | }, |
| 3536 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3537 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3538 | .init_verbs = { alc880_volume_init_verbs, |
| 3539 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3540 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3541 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3542 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3543 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3544 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3545 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3546 | .input_mux = &alc880_capture_source, |
| 3547 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3548 | [ALC880_UNIWILL] = { |
| 3549 | .mixers = { alc880_uniwill_mixer }, |
| 3550 | .init_verbs = { alc880_volume_init_verbs, |
| 3551 | alc880_uniwill_init_verbs }, |
| 3552 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3553 | .dac_nids = alc880_asus_dac_nids, |
| 3554 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3555 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3556 | .channel_mode = alc880_threestack_modes, |
| 3557 | .need_dac_fix = 1, |
| 3558 | .input_mux = &alc880_capture_source, |
| 3559 | .unsol_event = alc880_uniwill_unsol_event, |
| 3560 | .init_hook = alc880_uniwill_automute, |
| 3561 | }, |
| 3562 | [ALC880_UNIWILL_P53] = { |
| 3563 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3564 | .init_verbs = { alc880_volume_init_verbs, |
| 3565 | alc880_uniwill_p53_init_verbs }, |
| 3566 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3567 | .dac_nids = alc880_asus_dac_nids, |
| 3568 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3569 | .channel_mode = alc880_threestack_modes, |
| 3570 | .input_mux = &alc880_capture_source, |
| 3571 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3572 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3573 | }, |
| 3574 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3575 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3576 | alc880_pcbeep_mixer, }, |
| 3577 | .init_verbs = { alc880_volume_init_verbs, |
| 3578 | alc880_uniwill_p53_init_verbs, |
| 3579 | alc880_beep_init_verbs }, |
| 3580 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3581 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3582 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3583 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3584 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3585 | .input_mux = &alc880_capture_source, |
| 3586 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3587 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3588 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3589 | [ALC880_CLEVO] = { |
| 3590 | .mixers = { alc880_three_stack_mixer }, |
| 3591 | .init_verbs = { alc880_volume_init_verbs, |
| 3592 | alc880_pin_clevo_init_verbs }, |
| 3593 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3594 | .dac_nids = alc880_dac_nids, |
| 3595 | .hp_nid = 0x03, |
| 3596 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3597 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3598 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3599 | .input_mux = &alc880_capture_source, |
| 3600 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3601 | [ALC880_LG] = { |
| 3602 | .mixers = { alc880_lg_mixer }, |
| 3603 | .init_verbs = { alc880_volume_init_verbs, |
| 3604 | alc880_lg_init_verbs }, |
| 3605 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3606 | .dac_nids = alc880_lg_dac_nids, |
| 3607 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3608 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3609 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3610 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3611 | .input_mux = &alc880_lg_capture_source, |
| 3612 | .unsol_event = alc880_lg_unsol_event, |
| 3613 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3614 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3615 | .loopbacks = alc880_lg_loopbacks, |
| 3616 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3617 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3618 | [ALC880_LG_LW] = { |
| 3619 | .mixers = { alc880_lg_lw_mixer }, |
| 3620 | .init_verbs = { alc880_volume_init_verbs, |
| 3621 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3622 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3623 | .dac_nids = alc880_dac_nids, |
| 3624 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3625 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3626 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3627 | .input_mux = &alc880_lg_lw_capture_source, |
| 3628 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3629 | .init_hook = alc880_lg_lw_automute, |
| 3630 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3631 | [ALC880_MEDION_RIM] = { |
| 3632 | .mixers = { alc880_medion_rim_mixer }, |
| 3633 | .init_verbs = { alc880_volume_init_verbs, |
| 3634 | alc880_medion_rim_init_verbs, |
| 3635 | alc_gpio2_init_verbs }, |
| 3636 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3637 | .dac_nids = alc880_dac_nids, |
| 3638 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3639 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3640 | .channel_mode = alc880_2_jack_modes, |
| 3641 | .input_mux = &alc880_medion_rim_capture_source, |
| 3642 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3643 | .init_hook = alc880_medion_rim_automute, |
| 3644 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3645 | #ifdef CONFIG_SND_DEBUG |
| 3646 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3647 | .mixers = { alc880_test_mixer }, |
| 3648 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3649 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3650 | .dac_nids = alc880_test_dac_nids, |
| 3651 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3652 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3653 | .channel_mode = alc880_test_modes, |
| 3654 | .input_mux = &alc880_test_capture_source, |
| 3655 | }, |
| 3656 | #endif |
| 3657 | }; |
| 3658 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3659 | /* |
| 3660 | * Automatic parse of I/O pins from the BIOS configuration |
| 3661 | */ |
| 3662 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3663 | enum { |
| 3664 | ALC_CTL_WIDGET_VOL, |
| 3665 | ALC_CTL_WIDGET_MUTE, |
| 3666 | ALC_CTL_BIND_MUTE, |
| 3667 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3668 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3669 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3670 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3671 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3672 | }; |
| 3673 | |
| 3674 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3675 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3676 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3677 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3678 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3679 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3680 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3681 | knew = snd_array_new(&spec->kctls); |
| 3682 | if (!knew) |
| 3683 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3684 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3685 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3686 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3687 | return -ENOMEM; |
| 3688 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3689 | return 0; |
| 3690 | } |
| 3691 | |
| 3692 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3693 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3694 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3695 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3696 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3697 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3698 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3699 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3700 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3701 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3702 | #define ALC880_PIN_CD_NID 0x1c |
| 3703 | |
| 3704 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3705 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3706 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3707 | { |
| 3708 | hda_nid_t nid; |
| 3709 | int assigned[4]; |
| 3710 | int i, j; |
| 3711 | |
| 3712 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3713 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3714 | |
| 3715 | /* check the pins hardwired to audio widget */ |
| 3716 | for (i = 0; i < cfg->line_outs; i++) { |
| 3717 | nid = cfg->line_out_pins[i]; |
| 3718 | if (alc880_is_fixed_pin(nid)) { |
| 3719 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3720 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3721 | assigned[idx] = 1; |
| 3722 | } |
| 3723 | } |
| 3724 | /* left pins can be connect to any audio widget */ |
| 3725 | for (i = 0; i < cfg->line_outs; i++) { |
| 3726 | nid = cfg->line_out_pins[i]; |
| 3727 | if (alc880_is_fixed_pin(nid)) |
| 3728 | continue; |
| 3729 | /* search for an empty channel */ |
| 3730 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3731 | if (!assigned[j]) { |
| 3732 | spec->multiout.dac_nids[i] = |
| 3733 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3734 | assigned[j] = 1; |
| 3735 | break; |
| 3736 | } |
| 3737 | } |
| 3738 | } |
| 3739 | spec->multiout.num_dacs = cfg->line_outs; |
| 3740 | return 0; |
| 3741 | } |
| 3742 | |
| 3743 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3744 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3745 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3746 | { |
| 3747 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3748 | static const char *chname[4] = { |
| 3749 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3750 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3751 | hda_nid_t nid; |
| 3752 | int i, err; |
| 3753 | |
| 3754 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3755 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3756 | continue; |
| 3757 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3758 | if (i == 2) { |
| 3759 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3760 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3761 | "Center Playback Volume", |
| 3762 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3763 | HDA_OUTPUT)); |
| 3764 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3765 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3766 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3767 | "LFE Playback Volume", |
| 3768 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3769 | HDA_OUTPUT)); |
| 3770 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3771 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3772 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3773 | "Center Playback Switch", |
| 3774 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3775 | HDA_INPUT)); |
| 3776 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3777 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3778 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3779 | "LFE Playback Switch", |
| 3780 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3781 | HDA_INPUT)); |
| 3782 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3783 | return err; |
| 3784 | } else { |
| 3785 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3786 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3787 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3788 | HDA_OUTPUT)); |
| 3789 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3790 | return err; |
| 3791 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3792 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3793 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3794 | HDA_INPUT)); |
| 3795 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3796 | return err; |
| 3797 | } |
| 3798 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3799 | return 0; |
| 3800 | } |
| 3801 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3802 | /* add playback controls for speaker and HP outputs */ |
| 3803 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3804 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3805 | { |
| 3806 | hda_nid_t nid; |
| 3807 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3808 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3809 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3810 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3811 | return 0; |
| 3812 | |
| 3813 | if (alc880_is_fixed_pin(pin)) { |
| 3814 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3815 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3816 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3817 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3818 | else |
| 3819 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3820 | /* control HP volume/switch on the output mixer amp */ |
| 3821 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3822 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3823 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3824 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3825 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3826 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3827 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3828 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3829 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3830 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3831 | return err; |
| 3832 | } else if (alc880_is_multi_pin(pin)) { |
| 3833 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3834 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3835 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3836 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3837 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3838 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3839 | return err; |
| 3840 | } |
| 3841 | return 0; |
| 3842 | } |
| 3843 | |
| 3844 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3845 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3846 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3847 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3848 | { |
| 3849 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3850 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3851 | |
| 3852 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3853 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3854 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3855 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3856 | return err; |
| 3857 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3858 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3859 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3860 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3861 | return err; |
| 3862 | return 0; |
| 3863 | } |
| 3864 | |
| 3865 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3866 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3867 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3868 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3869 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3870 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3871 | |
| 3872 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3873 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3874 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3875 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3876 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3877 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3878 | if (err < 0) |
| 3879 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3880 | imux->items[imux->num_items].label = |
| 3881 | auto_pin_cfg_labels[i]; |
| 3882 | imux->items[imux->num_items].index = |
| 3883 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3884 | imux->num_items++; |
| 3885 | } |
| 3886 | } |
| 3887 | return 0; |
| 3888 | } |
| 3889 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3890 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3891 | unsigned int pin_type) |
| 3892 | { |
| 3893 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3894 | pin_type); |
| 3895 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3896 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3897 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3898 | } |
| 3899 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3900 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3901 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3902 | int dac_idx) |
| 3903 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3904 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3905 | /* need the manual connection? */ |
| 3906 | if (alc880_is_multi_pin(nid)) { |
| 3907 | struct alc_spec *spec = codec->spec; |
| 3908 | int idx = alc880_multi_pin_idx(nid); |
| 3909 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3910 | AC_VERB_SET_CONNECT_SEL, |
| 3911 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3912 | } |
| 3913 | } |
| 3914 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3915 | static int get_pin_type(int line_out_type) |
| 3916 | { |
| 3917 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3918 | return PIN_HP; |
| 3919 | else |
| 3920 | return PIN_OUT; |
| 3921 | } |
| 3922 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3923 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3924 | { |
| 3925 | struct alc_spec *spec = codec->spec; |
| 3926 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3927 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3928 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3929 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3930 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3931 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3932 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3933 | } |
| 3934 | } |
| 3935 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3936 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3937 | { |
| 3938 | struct alc_spec *spec = codec->spec; |
| 3939 | hda_nid_t pin; |
| 3940 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3941 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3942 | if (pin) /* connect to front */ |
| 3943 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3944 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3945 | if (pin) /* connect to front */ |
| 3946 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3947 | } |
| 3948 | |
| 3949 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3950 | { |
| 3951 | struct alc_spec *spec = codec->spec; |
| 3952 | int i; |
| 3953 | |
| 3954 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3955 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3956 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3957 | snd_hda_codec_write(codec, nid, 0, |
| 3958 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3959 | i <= AUTO_PIN_FRONT_MIC ? |
| 3960 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3961 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3962 | snd_hda_codec_write(codec, nid, 0, |
| 3963 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3964 | AMP_OUT_MUTE); |
| 3965 | } |
| 3966 | } |
| 3967 | } |
| 3968 | |
| 3969 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3970 | /* return 1 if successful, 0 if the proper config is not found, |
| 3971 | * or a negative error code |
| 3972 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3973 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3974 | { |
| 3975 | struct alc_spec *spec = codec->spec; |
| 3976 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3977 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3978 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3979 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3980 | alc880_ignore); |
| 3981 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3982 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3983 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3984 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3985 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3986 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3987 | if (err < 0) |
| 3988 | return err; |
| 3989 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3990 | if (err < 0) |
| 3991 | return err; |
| 3992 | err = alc880_auto_create_extra_out(spec, |
| 3993 | spec->autocfg.speaker_pins[0], |
| 3994 | "Speaker"); |
| 3995 | if (err < 0) |
| 3996 | return err; |
| 3997 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3998 | "Headphone"); |
| 3999 | if (err < 0) |
| 4000 | return err; |
| 4001 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4002 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4003 | return err; |
| 4004 | |
| 4005 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4006 | |
| 4007 | if (spec->autocfg.dig_out_pin) |
| 4008 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 4009 | if (spec->autocfg.dig_in_pin) |
| 4010 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4011 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4012 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4013 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4014 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4015 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4016 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4017 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4018 | spec->input_mux = &spec->private_imux; |
| 4019 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4020 | store_pin_configs(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4021 | return 1; |
| 4022 | } |
| 4023 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4024 | /* additional initialization for auto-configuration model */ |
| 4025 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4026 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4027 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4028 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4029 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4030 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4031 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4032 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4033 | } |
| 4034 | |
| 4035 | /* |
| 4036 | * OK, here we have finally the patch for ALC880 |
| 4037 | */ |
| 4038 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4039 | static void set_capture_mixer(struct alc_spec *spec) |
| 4040 | { |
| 4041 | static struct snd_kcontrol_new *caps[3] = { |
| 4042 | alc_capture_mixer1, |
| 4043 | alc_capture_mixer2, |
| 4044 | alc_capture_mixer3, |
| 4045 | }; |
| 4046 | if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3) |
| 4047 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4048 | } |
| 4049 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4050 | static int patch_alc880(struct hda_codec *codec) |
| 4051 | { |
| 4052 | struct alc_spec *spec; |
| 4053 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4054 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4055 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4056 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4057 | if (spec == NULL) |
| 4058 | return -ENOMEM; |
| 4059 | |
| 4060 | codec->spec = spec; |
| 4061 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4062 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4063 | alc880_models, |
| 4064 | alc880_cfg_tbl); |
| 4065 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4066 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4067 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4068 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4069 | } |
| 4070 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4071 | if (board_config == ALC880_AUTO) { |
| 4072 | /* automatic parse from the BIOS config */ |
| 4073 | err = alc880_parse_auto_config(codec); |
| 4074 | if (err < 0) { |
| 4075 | alc_free(codec); |
| 4076 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4077 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4078 | printk(KERN_INFO |
| 4079 | "hda_codec: Cannot set up configuration " |
| 4080 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4081 | board_config = ALC880_3ST; |
| 4082 | } |
| 4083 | } |
| 4084 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4085 | if (board_config != ALC880_AUTO) |
| 4086 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4087 | |
| 4088 | spec->stream_name_analog = "ALC880 Analog"; |
| 4089 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4090 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4091 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4092 | |
| 4093 | spec->stream_name_digital = "ALC880 Digital"; |
| 4094 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4095 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4096 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4097 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4098 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4099 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4100 | /* get type */ |
| 4101 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4102 | if (wcap != AC_WID_AUD_IN) { |
| 4103 | spec->adc_nids = alc880_adc_nids_alt; |
| 4104 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4105 | } else { |
| 4106 | spec->adc_nids = alc880_adc_nids; |
| 4107 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4108 | } |
| 4109 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4110 | set_capture_mixer(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4111 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4112 | spec->vmaster_nid = 0x0c; |
| 4113 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4114 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4115 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4116 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4117 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4118 | if (!spec->loopback.amplist) |
| 4119 | spec->loopback.amplist = alc880_loopbacks; |
| 4120 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4121 | |
| 4122 | return 0; |
| 4123 | } |
| 4124 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4125 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4126 | /* |
| 4127 | * ALC260 support |
| 4128 | */ |
| 4129 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4130 | static hda_nid_t alc260_dac_nids[1] = { |
| 4131 | /* front */ |
| 4132 | 0x02, |
| 4133 | }; |
| 4134 | |
| 4135 | static hda_nid_t alc260_adc_nids[1] = { |
| 4136 | /* ADC0 */ |
| 4137 | 0x04, |
| 4138 | }; |
| 4139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4140 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4141 | /* ADC1 */ |
| 4142 | 0x05, |
| 4143 | }; |
| 4144 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4145 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4146 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4147 | */ |
| 4148 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4149 | /* ADC0, ADC1 */ |
| 4150 | 0x04, 0x05 |
| 4151 | }; |
| 4152 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4153 | #define ALC260_DIGOUT_NID 0x03 |
| 4154 | #define ALC260_DIGIN_NID 0x06 |
| 4155 | |
| 4156 | static struct hda_input_mux alc260_capture_source = { |
| 4157 | .num_items = 4, |
| 4158 | .items = { |
| 4159 | { "Mic", 0x0 }, |
| 4160 | { "Front Mic", 0x1 }, |
| 4161 | { "Line", 0x2 }, |
| 4162 | { "CD", 0x4 }, |
| 4163 | }, |
| 4164 | }; |
| 4165 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4166 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4167 | * headphone jack and the internal CD lines since these are the only pins at |
| 4168 | * which audio can appear. For flexibility, also allow the option of |
| 4169 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4170 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4171 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4172 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4173 | { |
| 4174 | .num_items = 3, |
| 4175 | .items = { |
| 4176 | { "Mic/Line", 0x0 }, |
| 4177 | { "CD", 0x4 }, |
| 4178 | { "Headphone", 0x2 }, |
| 4179 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4180 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4181 | { |
| 4182 | .num_items = 4, |
| 4183 | .items = { |
| 4184 | { "Mic/Line", 0x0 }, |
| 4185 | { "CD", 0x4 }, |
| 4186 | { "Headphone", 0x2 }, |
| 4187 | { "Mixer", 0x5 }, |
| 4188 | }, |
| 4189 | }, |
| 4190 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4191 | }; |
| 4192 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4193 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4194 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4195 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4196 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4197 | { |
| 4198 | .num_items = 4, |
| 4199 | .items = { |
| 4200 | { "Mic", 0x0 }, |
| 4201 | { "Line", 0x2 }, |
| 4202 | { "CD", 0x4 }, |
| 4203 | { "Headphone", 0x5 }, |
| 4204 | }, |
| 4205 | }, |
| 4206 | { |
| 4207 | .num_items = 5, |
| 4208 | .items = { |
| 4209 | { "Mic", 0x0 }, |
| 4210 | { "Line", 0x2 }, |
| 4211 | { "CD", 0x4 }, |
| 4212 | { "Headphone", 0x6 }, |
| 4213 | { "Mixer", 0x5 }, |
| 4214 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4215 | }, |
| 4216 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4217 | /* |
| 4218 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4219 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4220 | * element which allows changing the channel mode, so the verb list is |
| 4221 | * never used. |
| 4222 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4223 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4224 | { 2, NULL }, |
| 4225 | }; |
| 4226 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4227 | |
| 4228 | /* Mixer combinations |
| 4229 | * |
| 4230 | * basic: base_output + input + pc_beep + capture |
| 4231 | * HP: base_output + input + capture_alt |
| 4232 | * HP_3013: hp_3013 + input + capture |
| 4233 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4234 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4235 | */ |
| 4236 | |
| 4237 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4238 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4239 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4240 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4241 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4242 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4243 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4244 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4245 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4246 | |
| 4247 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4248 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4249 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4250 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4251 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4252 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4254 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4255 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4256 | { } /* end */ |
| 4257 | }; |
| 4258 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4259 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4260 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4261 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4262 | { } /* end */ |
| 4263 | }; |
| 4264 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4265 | /* update HP, line and mono out pins according to the master switch */ |
| 4266 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4267 | hda_nid_t hp, hda_nid_t line, |
| 4268 | hda_nid_t mono) |
| 4269 | { |
| 4270 | struct alc_spec *spec = codec->spec; |
| 4271 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4272 | /* change HP and line-out pins */ |
| 4273 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4274 | val); |
| 4275 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4276 | val); |
| 4277 | /* mono (speaker) depending on the HP jack sense */ |
| 4278 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4279 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4280 | val); |
| 4281 | } |
| 4282 | |
| 4283 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4284 | struct snd_ctl_elem_value *ucontrol) |
| 4285 | { |
| 4286 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4287 | struct alc_spec *spec = codec->spec; |
| 4288 | *ucontrol->value.integer.value = spec->master_sw; |
| 4289 | return 0; |
| 4290 | } |
| 4291 | |
| 4292 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4293 | struct snd_ctl_elem_value *ucontrol) |
| 4294 | { |
| 4295 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4296 | struct alc_spec *spec = codec->spec; |
| 4297 | int val = !!*ucontrol->value.integer.value; |
| 4298 | hda_nid_t hp, line, mono; |
| 4299 | |
| 4300 | if (val == spec->master_sw) |
| 4301 | return 0; |
| 4302 | spec->master_sw = val; |
| 4303 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4304 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4305 | mono = kcontrol->private_value & 0xff; |
| 4306 | alc260_hp_master_update(codec, hp, line, mono); |
| 4307 | return 1; |
| 4308 | } |
| 4309 | |
| 4310 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4311 | { |
| 4312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4313 | .name = "Master Playback Switch", |
| 4314 | .info = snd_ctl_boolean_mono_info, |
| 4315 | .get = alc260_hp_master_sw_get, |
| 4316 | .put = alc260_hp_master_sw_put, |
| 4317 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4318 | }, |
| 4319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4320 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4321 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4322 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4323 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4324 | HDA_OUTPUT), |
| 4325 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4326 | { } /* end */ |
| 4327 | }; |
| 4328 | |
| 4329 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4330 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4331 | {}, |
| 4332 | }; |
| 4333 | |
| 4334 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4335 | { |
| 4336 | struct alc_spec *spec = codec->spec; |
| 4337 | unsigned int present; |
| 4338 | |
| 4339 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4340 | AC_VERB_GET_PIN_SENSE, 0); |
| 4341 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4342 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4343 | } |
| 4344 | |
| 4345 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4346 | { |
| 4347 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4348 | alc260_hp_automute(codec); |
| 4349 | } |
| 4350 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4351 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4352 | { |
| 4353 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4354 | .name = "Master Playback Switch", |
| 4355 | .info = snd_ctl_boolean_mono_info, |
| 4356 | .get = alc260_hp_master_sw_get, |
| 4357 | .put = alc260_hp_master_sw_put, |
| 4358 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4359 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4360 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4361 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4362 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4363 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4364 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4365 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4366 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4367 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4368 | { } /* end */ |
| 4369 | }; |
| 4370 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4371 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4372 | .ops = &snd_hda_bind_vol, |
| 4373 | .values = { |
| 4374 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4375 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4376 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4377 | 0 |
| 4378 | }, |
| 4379 | }; |
| 4380 | |
| 4381 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4382 | .ops = &snd_hda_bind_sw, |
| 4383 | .values = { |
| 4384 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4385 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4386 | 0 |
| 4387 | }, |
| 4388 | }; |
| 4389 | |
| 4390 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4391 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4392 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4393 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4395 | { } /* end */ |
| 4396 | }; |
| 4397 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4398 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4399 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4400 | {}, |
| 4401 | }; |
| 4402 | |
| 4403 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4404 | { |
| 4405 | struct alc_spec *spec = codec->spec; |
| 4406 | unsigned int present; |
| 4407 | |
| 4408 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4409 | AC_VERB_GET_PIN_SENSE, 0); |
| 4410 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4411 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4412 | } |
| 4413 | |
| 4414 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4415 | unsigned int res) |
| 4416 | { |
| 4417 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4418 | alc260_hp_3013_automute(codec); |
| 4419 | } |
| 4420 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4421 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4422 | { |
| 4423 | unsigned int present, bits; |
| 4424 | |
| 4425 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4426 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4427 | |
| 4428 | bits = present ? 0 : PIN_OUT; |
| 4429 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4430 | bits); |
| 4431 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4432 | bits); |
| 4433 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4434 | bits); |
| 4435 | } |
| 4436 | |
| 4437 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4438 | unsigned int res) |
| 4439 | { |
| 4440 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4441 | alc260_hp_3012_automute(codec); |
| 4442 | } |
| 4443 | |
| 4444 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4445 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4446 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4447 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4448 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4449 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4450 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4451 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4452 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4453 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4454 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4455 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4456 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4457 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4458 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4459 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4460 | { } /* end */ |
| 4461 | }; |
| 4462 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4463 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4464 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4465 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4466 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4467 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4468 | * revisions available in early 2006. Therefore for now allow the |
| 4469 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4470 | * that the lack of mic bias for this NID is intentional we could change the |
| 4471 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4472 | * |
| 4473 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4474 | * don't appear to make the mic bias available from the "line" jack, even |
| 4475 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4476 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4477 | * and the output jack. If this turns out to be the case for all such |
| 4478 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4479 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4480 | * |
| 4481 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4482 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4483 | * controls for such models. On models without a "mono speaker" the control |
| 4484 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4485 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4486 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4487 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4488 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4489 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4490 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4491 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4492 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4493 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4494 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4495 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4496 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4497 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4498 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4500 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4501 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4502 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4503 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4504 | { } /* end */ |
| 4505 | }; |
| 4506 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4507 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4508 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4509 | */ |
| 4510 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4511 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4512 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4513 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4514 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4515 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4516 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4517 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4518 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4520 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4521 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4522 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4523 | { } /* end */ |
| 4524 | }; |
| 4525 | |
| 4526 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4527 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4528 | */ |
| 4529 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4530 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4531 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4532 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4533 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4534 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4535 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4536 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4537 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4538 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4539 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4540 | { } /* end */ |
| 4541 | }; |
| 4542 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4543 | /* |
| 4544 | * initialization verbs |
| 4545 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4546 | static struct hda_verb alc260_init_verbs[] = { |
| 4547 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4548 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4549 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4550 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4551 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4552 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4553 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4554 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4555 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4556 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4557 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4558 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4559 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4560 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4561 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4562 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4563 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4564 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4565 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4566 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4567 | /* set connection select to line in (default select for this ADC) */ |
| 4568 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4569 | /* mute capture amp left and right */ |
| 4570 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4571 | /* set connection select to line in (default select for this ADC) */ |
| 4572 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4573 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4574 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4575 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4576 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4577 | /* set vol=0 HP mixer amp left and right */ |
| 4578 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4579 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4580 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4581 | /* set vol=0 Mono mixer amp left and right */ |
| 4582 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4583 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4584 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4585 | /* unmute LINE-2 out pin */ |
| 4586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4587 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4588 | * Line In 2 = 0x03 |
| 4589 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4590 | /* mute analog inputs */ |
| 4591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4592 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4593 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4594 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4595 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4596 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4597 | /* mute Front out path */ |
| 4598 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4599 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4600 | /* mute Headphone out path */ |
| 4601 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4602 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4603 | /* mute Mono out path */ |
| 4604 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4605 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4606 | { } |
| 4607 | }; |
| 4608 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4609 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4610 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4611 | /* Headphone and output */ |
| 4612 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4613 | /* mono output */ |
| 4614 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4615 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4616 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4617 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4618 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4619 | /* Line In pin widget for input */ |
| 4620 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4621 | /* Line-2 pin widget for output */ |
| 4622 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4623 | /* CD pin widget for input */ |
| 4624 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4625 | /* unmute amp left and right */ |
| 4626 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4627 | /* set connection select to line in (default select for this ADC) */ |
| 4628 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4629 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4631 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4632 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4633 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4634 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4635 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4636 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4637 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4638 | * Line In 2 = 0x03 |
| 4639 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4640 | /* mute analog inputs */ |
| 4641 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4646 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4647 | /* Unmute Front out path */ |
| 4648 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4649 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4650 | /* Unmute Headphone out path */ |
| 4651 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4652 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4653 | /* Unmute Mono out path */ |
| 4654 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4655 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4656 | { } |
| 4657 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4658 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4659 | |
| 4660 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4661 | /* Line out and output */ |
| 4662 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4663 | /* mono output */ |
| 4664 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4665 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4666 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4667 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4668 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4669 | /* Line In pin widget for input */ |
| 4670 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4671 | /* Headphone pin widget for output */ |
| 4672 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4673 | /* CD pin widget for input */ |
| 4674 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4675 | /* unmute amp left and right */ |
| 4676 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4677 | /* set connection select to line in (default select for this ADC) */ |
| 4678 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4679 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4680 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4681 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4682 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4683 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4684 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4685 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4686 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4687 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4688 | * Line In 2 = 0x03 |
| 4689 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4690 | /* mute analog inputs */ |
| 4691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4692 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4694 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4696 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4697 | /* Unmute Front out path */ |
| 4698 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4699 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4700 | /* Unmute Headphone out path */ |
| 4701 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4702 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4703 | /* Unmute Mono out path */ |
| 4704 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4705 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4706 | { } |
| 4707 | }; |
| 4708 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4709 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4710 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4711 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4712 | */ |
| 4713 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4714 | /* Disable all GPIOs */ |
| 4715 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4716 | /* Internal speaker is connected to headphone pin */ |
| 4717 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4718 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4719 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4720 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4721 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4722 | /* Ensure all other unused pins are disabled and muted. */ |
| 4723 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4724 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4725 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4726 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4727 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4728 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4731 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4732 | /* Disable digital (SPDIF) pins */ |
| 4733 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4734 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4735 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4736 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4737 | * when acting as an output. |
| 4738 | */ |
| 4739 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4740 | |
| 4741 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4742 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4743 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4744 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4745 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4746 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4747 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4748 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4749 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4750 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4751 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4752 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4753 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4754 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4755 | * If the pin mode is changed by the user the pin mode control will |
| 4756 | * take care of enabling the pin's input/output buffers as needed. |
| 4757 | * Therefore there's no need to enable the input buffer at this |
| 4758 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4759 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4761 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4762 | * mixer ctrl) |
| 4763 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4764 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4765 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4766 | /* Mute capture amp left and right */ |
| 4767 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4768 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4769 | * in (on mic1 pin) |
| 4770 | */ |
| 4771 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4772 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4773 | /* Do the same for the second ADC: mute capture input amp and |
| 4774 | * set ADC connection to line in (on mic1 pin) |
| 4775 | */ |
| 4776 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4777 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4778 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4779 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4780 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4781 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4782 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4783 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4784 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4785 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4786 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4787 | {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] | 4788 | |
| 4789 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4790 | }; |
| 4791 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4792 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4793 | * similar laptops (adapted from Fujitsu init verbs). |
| 4794 | */ |
| 4795 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4796 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4797 | * the headphone jack. Turn this on and rely on the standard mute |
| 4798 | * methods whenever the user wants to turn these outputs off. |
| 4799 | */ |
| 4800 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4801 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4802 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4803 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4804 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4805 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4806 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4807 | /* Line In jack is connected to Line1 pin */ |
| 4808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4809 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4810 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4811 | /* Ensure all other unused pins are disabled and muted. */ |
| 4812 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4813 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4814 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4815 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4818 | /* Disable digital (SPDIF) pins */ |
| 4819 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4820 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4821 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4822 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4823 | * bus when acting as outputs. |
| 4824 | */ |
| 4825 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4826 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4827 | |
| 4828 | /* Start with output sum widgets muted and their output gains at min */ |
| 4829 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4830 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4831 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4832 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4833 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4834 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4835 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4836 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4837 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4838 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4839 | /* Unmute Line-out pin widget amp left and right |
| 4840 | * (no equiv mixer ctrl) |
| 4841 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4842 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4843 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4844 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4845 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4846 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4847 | * will take care of enabling the pin's input/output buffers as needed. |
| 4848 | * Therefore there's no need to enable the input buffer at this |
| 4849 | * stage. |
| 4850 | */ |
| 4851 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4852 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4853 | |
| 4854 | /* Mute capture amp left and right */ |
| 4855 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4856 | /* Set ADC connection select to match default mixer setting - mic |
| 4857 | * (on mic1 pin) |
| 4858 | */ |
| 4859 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4860 | |
| 4861 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4862 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4863 | */ |
| 4864 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4865 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4866 | |
| 4867 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4868 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4869 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4870 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4871 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4872 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4873 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4874 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4876 | |
| 4877 | { } |
| 4878 | }; |
| 4879 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4880 | static struct hda_verb alc260_will_verbs[] = { |
| 4881 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4882 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4883 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4884 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4885 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4886 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4887 | {} |
| 4888 | }; |
| 4889 | |
| 4890 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4891 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4892 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4893 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4894 | |
| 4895 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4896 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4897 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4898 | |
| 4899 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4900 | {} |
| 4901 | }; |
| 4902 | |
| 4903 | /* toggle speaker-output according to the hp-jack state */ |
| 4904 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4905 | { |
| 4906 | unsigned int present; |
| 4907 | |
| 4908 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4909 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4910 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4911 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4912 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4913 | AC_VERB_SET_GPIO_DATA, 1); |
| 4914 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4915 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4916 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4917 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4918 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4919 | AC_VERB_SET_GPIO_DATA, 0); |
| 4920 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4921 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4922 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4923 | } |
| 4924 | } |
| 4925 | |
| 4926 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4927 | unsigned int res) |
| 4928 | { |
| 4929 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4930 | alc260_replacer_672v_automute(codec); |
| 4931 | } |
| 4932 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4933 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 4934 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4935 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4936 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4937 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4938 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4940 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4941 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4942 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4943 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4944 | {} |
| 4945 | }; |
| 4946 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4947 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4948 | * configuration. |
| 4949 | */ |
| 4950 | #ifdef CONFIG_SND_DEBUG |
| 4951 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4952 | 0x02, |
| 4953 | }; |
| 4954 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4955 | 0x04, 0x05, |
| 4956 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4957 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4958 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4959 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4960 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4961 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4962 | { |
| 4963 | .num_items = 7, |
| 4964 | .items = { |
| 4965 | { "MIC1 pin", 0x0 }, |
| 4966 | { "MIC2 pin", 0x1 }, |
| 4967 | { "LINE1 pin", 0x2 }, |
| 4968 | { "LINE2 pin", 0x3 }, |
| 4969 | { "CD pin", 0x4 }, |
| 4970 | { "LINE-OUT pin", 0x5 }, |
| 4971 | { "HP-OUT pin", 0x6 }, |
| 4972 | }, |
| 4973 | }, |
| 4974 | { |
| 4975 | .num_items = 8, |
| 4976 | .items = { |
| 4977 | { "MIC1 pin", 0x0 }, |
| 4978 | { "MIC2 pin", 0x1 }, |
| 4979 | { "LINE1 pin", 0x2 }, |
| 4980 | { "LINE2 pin", 0x3 }, |
| 4981 | { "CD pin", 0x4 }, |
| 4982 | { "Mixer", 0x5 }, |
| 4983 | { "LINE-OUT pin", 0x6 }, |
| 4984 | { "HP-OUT pin", 0x7 }, |
| 4985 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4986 | }, |
| 4987 | }; |
| 4988 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4989 | /* Output driver widgets */ |
| 4990 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4991 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4992 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4993 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4994 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4995 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4996 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4997 | /* Modes for retasking pin widgets |
| 4998 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4999 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5000 | * mention this restriction. At this stage it's not clear whether |
| 5001 | * this behaviour is intentional or is a hardware bug in chip |
| 5002 | * revisions available at least up until early 2006. Therefore for |
| 5003 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5004 | * choices, but if it turns out that the lack of mic bias for these |
| 5005 | * NIDs is intentional we could change their modes from |
| 5006 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5007 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5008 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5009 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5010 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5011 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5012 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5013 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5014 | |
| 5015 | /* Loopback mixer controls */ |
| 5016 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5017 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5018 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5019 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5020 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5021 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5022 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5023 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5024 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5025 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5026 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 5027 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 5028 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5029 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5030 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5031 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5032 | |
| 5033 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5034 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5035 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5036 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5037 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5038 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5039 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5040 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5041 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5042 | */ |
| 5043 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5044 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5045 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5046 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5047 | * this output to turn on an external amplifier. |
| 5048 | */ |
| 5049 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5050 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5051 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5052 | { } /* end */ |
| 5053 | }; |
| 5054 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5055 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5056 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5057 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5058 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5059 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5060 | /* Enable retasking pins as output, initially without power amp */ |
| 5061 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5062 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5063 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5065 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5066 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5067 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5068 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5069 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5070 | * payload also sets the generation to 0, output to be in "consumer" |
| 5071 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5072 | * control. |
| 5073 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5074 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5075 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5076 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5077 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5078 | * OUT1 sum bus when acting as an output. |
| 5079 | */ |
| 5080 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5081 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5082 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5083 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5084 | |
| 5085 | /* Start with output sum widgets muted and their output gains at min */ |
| 5086 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5088 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5091 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5092 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5093 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5094 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5095 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5096 | /* Unmute retasking pin widget output buffers since the default |
| 5097 | * state appears to be output. As the pin mode is changed by the |
| 5098 | * user the pin mode control will take care of enabling the pin's |
| 5099 | * input/output buffers as needed. |
| 5100 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5101 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5102 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5104 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5105 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5106 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5107 | /* Also unmute the mono-out pin widget */ |
| 5108 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5109 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5110 | /* Mute capture amp left and right */ |
| 5111 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5112 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5113 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5114 | */ |
| 5115 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5116 | |
| 5117 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5118 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5119 | */ |
| 5120 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5121 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5122 | |
| 5123 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5124 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5126 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5127 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5132 | |
| 5133 | { } |
| 5134 | }; |
| 5135 | #endif |
| 5136 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5137 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5138 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5139 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5140 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5141 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5142 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5143 | /* |
| 5144 | * for BIOS auto-configuration |
| 5145 | */ |
| 5146 | |
| 5147 | 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] | 5148 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5149 | { |
| 5150 | hda_nid_t nid_vol; |
| 5151 | unsigned long vol_val, sw_val; |
| 5152 | char name[32]; |
| 5153 | int err; |
| 5154 | |
| 5155 | if (nid >= 0x0f && nid < 0x11) { |
| 5156 | nid_vol = nid - 0x7; |
| 5157 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5158 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5159 | } else if (nid == 0x11) { |
| 5160 | nid_vol = nid - 0x7; |
| 5161 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5162 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5163 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5164 | nid_vol = 0x08; |
| 5165 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5166 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5167 | } else |
| 5168 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5169 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5170 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5171 | /* first control for the volume widget */ |
| 5172 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5173 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5174 | if (err < 0) |
| 5175 | return err; |
| 5176 | *vol_bits |= (1 << nid_vol); |
| 5177 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5178 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5179 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5180 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5181 | return err; |
| 5182 | return 1; |
| 5183 | } |
| 5184 | |
| 5185 | /* add playback controls from the parsed DAC table */ |
| 5186 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5187 | const struct auto_pin_cfg *cfg) |
| 5188 | { |
| 5189 | hda_nid_t nid; |
| 5190 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5191 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5192 | |
| 5193 | spec->multiout.num_dacs = 1; |
| 5194 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5195 | spec->multiout.dac_nids[0] = 0x02; |
| 5196 | |
| 5197 | nid = cfg->line_out_pins[0]; |
| 5198 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5199 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5200 | if (err < 0) |
| 5201 | return err; |
| 5202 | } |
| 5203 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5204 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5205 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5206 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5207 | if (err < 0) |
| 5208 | return err; |
| 5209 | } |
| 5210 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5211 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5212 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5213 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5214 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5215 | if (err < 0) |
| 5216 | return err; |
| 5217 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5218 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5219 | } |
| 5220 | |
| 5221 | /* create playback/capture controls for input pins */ |
| 5222 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5223 | const struct auto_pin_cfg *cfg) |
| 5224 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5225 | struct hda_input_mux *imux = &spec->private_imux; |
| 5226 | int i, err, idx; |
| 5227 | |
| 5228 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5229 | if (cfg->input_pins[i] >= 0x12) { |
| 5230 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5231 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5232 | auto_pin_cfg_labels[i], idx, |
| 5233 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5234 | if (err < 0) |
| 5235 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5236 | imux->items[imux->num_items].label = |
| 5237 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5238 | imux->items[imux->num_items].index = idx; |
| 5239 | imux->num_items++; |
| 5240 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5241 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5242 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5243 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5244 | auto_pin_cfg_labels[i], idx, |
| 5245 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5246 | if (err < 0) |
| 5247 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5248 | imux->items[imux->num_items].label = |
| 5249 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5250 | imux->items[imux->num_items].index = idx; |
| 5251 | imux->num_items++; |
| 5252 | } |
| 5253 | } |
| 5254 | return 0; |
| 5255 | } |
| 5256 | |
| 5257 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5258 | hda_nid_t nid, int pin_type, |
| 5259 | int sel_idx) |
| 5260 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5261 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5262 | /* need the manual connection? */ |
| 5263 | if (nid >= 0x12) { |
| 5264 | int idx = nid - 0x12; |
| 5265 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5266 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5267 | } |
| 5268 | } |
| 5269 | |
| 5270 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5271 | { |
| 5272 | struct alc_spec *spec = codec->spec; |
| 5273 | hda_nid_t nid; |
| 5274 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5275 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5276 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5277 | if (nid) { |
| 5278 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5279 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5280 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5281 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5282 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5283 | if (nid) |
| 5284 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5285 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5286 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5287 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5288 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5289 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5290 | |
| 5291 | #define ALC260_PIN_CD_NID 0x16 |
| 5292 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5293 | { |
| 5294 | struct alc_spec *spec = codec->spec; |
| 5295 | int i; |
| 5296 | |
| 5297 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5298 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5299 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5300 | snd_hda_codec_write(codec, nid, 0, |
| 5301 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5302 | i <= AUTO_PIN_FRONT_MIC ? |
| 5303 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5304 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5305 | snd_hda_codec_write(codec, nid, 0, |
| 5306 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5307 | AMP_OUT_MUTE); |
| 5308 | } |
| 5309 | } |
| 5310 | } |
| 5311 | |
| 5312 | /* |
| 5313 | * generic initialization of ADC, input mixers and output mixers |
| 5314 | */ |
| 5315 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5316 | /* |
| 5317 | * Unmute ADC0-1 and set the default input to mic-in |
| 5318 | */ |
| 5319 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5320 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5321 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5322 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5323 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5324 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5325 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5326 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5327 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5328 | */ |
| 5329 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5330 | /* mute analog inputs */ |
| 5331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5336 | |
| 5337 | /* |
| 5338 | * Set up output mixers (0x08 - 0x0a) |
| 5339 | */ |
| 5340 | /* set vol=0 to output mixers */ |
| 5341 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5343 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5344 | /* set up input amps for analog loopback */ |
| 5345 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5346 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5347 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5348 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5349 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5350 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5351 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5352 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5353 | { } |
| 5354 | }; |
| 5355 | |
| 5356 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5357 | { |
| 5358 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5359 | int err; |
| 5360 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5361 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5362 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5363 | alc260_ignore); |
| 5364 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5365 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5366 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5367 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5368 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5369 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5370 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5371 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5372 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5373 | return err; |
| 5374 | |
| 5375 | spec->multiout.max_channels = 2; |
| 5376 | |
| 5377 | if (spec->autocfg.dig_out_pin) |
| 5378 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5379 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5380 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5381 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5382 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5383 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5384 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5385 | spec->input_mux = &spec->private_imux; |
| 5386 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 5387 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5388 | return 1; |
| 5389 | } |
| 5390 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5391 | /* additional initialization for auto-configuration model */ |
| 5392 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5393 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5394 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5395 | alc260_auto_init_multi_out(codec); |
| 5396 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5397 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5398 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5399 | } |
| 5400 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5401 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5402 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5403 | { 0x07, HDA_INPUT, 0 }, |
| 5404 | { 0x07, HDA_INPUT, 1 }, |
| 5405 | { 0x07, HDA_INPUT, 2 }, |
| 5406 | { 0x07, HDA_INPUT, 3 }, |
| 5407 | { 0x07, HDA_INPUT, 4 }, |
| 5408 | { } /* end */ |
| 5409 | }; |
| 5410 | #endif |
| 5411 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5412 | /* |
| 5413 | * ALC260 configurations |
| 5414 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5415 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5416 | [ALC260_BASIC] = "basic", |
| 5417 | [ALC260_HP] = "hp", |
| 5418 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5419 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5420 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5421 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5422 | [ALC260_WILL] = "will", |
| 5423 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5424 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5425 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5426 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5427 | [ALC260_AUTO] = "auto", |
| 5428 | }; |
| 5429 | |
| 5430 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5431 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5432 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5433 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5434 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5435 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5436 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5437 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5438 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5439 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5440 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5441 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5442 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5443 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5444 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5445 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5446 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5447 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5448 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5449 | {} |
| 5450 | }; |
| 5451 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5452 | static struct alc_config_preset alc260_presets[] = { |
| 5453 | [ALC260_BASIC] = { |
| 5454 | .mixers = { alc260_base_output_mixer, |
| 5455 | alc260_input_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5456 | alc260_pc_beep_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5457 | .init_verbs = { alc260_init_verbs }, |
| 5458 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5459 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5460 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5461 | .adc_nids = alc260_adc_nids, |
| 5462 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5463 | .channel_mode = alc260_modes, |
| 5464 | .input_mux = &alc260_capture_source, |
| 5465 | }, |
| 5466 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5467 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5468 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5469 | .init_verbs = { alc260_init_verbs, |
| 5470 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5471 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5472 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5473 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5474 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5475 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5476 | .channel_mode = alc260_modes, |
| 5477 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5478 | .unsol_event = alc260_hp_unsol_event, |
| 5479 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5480 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5481 | [ALC260_HP_DC7600] = { |
| 5482 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5483 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5484 | .init_verbs = { alc260_init_verbs, |
| 5485 | alc260_hp_dc7600_verbs }, |
| 5486 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5487 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5488 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5489 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5490 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5491 | .channel_mode = alc260_modes, |
| 5492 | .input_mux = &alc260_capture_source, |
| 5493 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5494 | .init_hook = alc260_hp_3012_automute, |
| 5495 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5496 | [ALC260_HP_3013] = { |
| 5497 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5498 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5499 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5500 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5501 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5502 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5503 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5504 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5505 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5506 | .channel_mode = alc260_modes, |
| 5507 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5508 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5509 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5510 | }, |
| 5511 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5512 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5513 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5514 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5515 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5516 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5517 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5518 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5519 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5520 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5521 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5522 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5523 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5524 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5525 | .init_verbs = { alc260_acer_init_verbs }, |
| 5526 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5527 | .dac_nids = alc260_dac_nids, |
| 5528 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5529 | .adc_nids = alc260_dual_adc_nids, |
| 5530 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5531 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5532 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5533 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5534 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5535 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5536 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5537 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5538 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5539 | .dac_nids = alc260_dac_nids, |
| 5540 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5541 | .adc_nids = alc260_adc_nids, |
| 5542 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5543 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5544 | .channel_mode = alc260_modes, |
| 5545 | .input_mux = &alc260_capture_source, |
| 5546 | }, |
| 5547 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5548 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5549 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5550 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5551 | .dac_nids = alc260_dac_nids, |
| 5552 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5553 | .adc_nids = alc260_adc_nids, |
| 5554 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5555 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5556 | .channel_mode = alc260_modes, |
| 5557 | .input_mux = &alc260_capture_source, |
| 5558 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5559 | .init_hook = alc260_replacer_672v_automute, |
| 5560 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5561 | #ifdef CONFIG_SND_DEBUG |
| 5562 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5563 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5564 | .init_verbs = { alc260_test_init_verbs }, |
| 5565 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5566 | .dac_nids = alc260_test_dac_nids, |
| 5567 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5568 | .adc_nids = alc260_test_adc_nids, |
| 5569 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5570 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5571 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5572 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5573 | }, |
| 5574 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5575 | }; |
| 5576 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5577 | static int patch_alc260(struct hda_codec *codec) |
| 5578 | { |
| 5579 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5580 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5581 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5582 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5583 | if (spec == NULL) |
| 5584 | return -ENOMEM; |
| 5585 | |
| 5586 | codec->spec = spec; |
| 5587 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5588 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5589 | alc260_models, |
| 5590 | alc260_cfg_tbl); |
| 5591 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5592 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5593 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5594 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5595 | } |
| 5596 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5597 | if (board_config == ALC260_AUTO) { |
| 5598 | /* automatic parse from the BIOS config */ |
| 5599 | err = alc260_parse_auto_config(codec); |
| 5600 | if (err < 0) { |
| 5601 | alc_free(codec); |
| 5602 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5603 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5604 | printk(KERN_INFO |
| 5605 | "hda_codec: Cannot set up configuration " |
| 5606 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5607 | board_config = ALC260_BASIC; |
| 5608 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5609 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5610 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5611 | if (board_config != ALC260_AUTO) |
| 5612 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5613 | |
| 5614 | spec->stream_name_analog = "ALC260 Analog"; |
| 5615 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5616 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5617 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5618 | spec->stream_name_digital = "ALC260 Digital"; |
| 5619 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5620 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5621 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 5622 | if (!spec->adc_nids && spec->input_mux) { |
| 5623 | /* check whether NID 0x04 is valid */ |
| 5624 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 5625 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 5626 | /* get type */ |
| 5627 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 5628 | spec->adc_nids = alc260_adc_nids_alt; |
| 5629 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5630 | } else { |
| 5631 | spec->adc_nids = alc260_adc_nids; |
| 5632 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5633 | } |
| 5634 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5635 | set_capture_mixer(spec); |
| 5636 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5637 | spec->vmaster_nid = 0x08; |
| 5638 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5639 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5640 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5641 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5642 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5643 | if (!spec->loopback.amplist) |
| 5644 | spec->loopback.amplist = alc260_loopbacks; |
| 5645 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5646 | |
| 5647 | return 0; |
| 5648 | } |
| 5649 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5650 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5651 | /* |
| 5652 | * ALC882 support |
| 5653 | * |
| 5654 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5655 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5656 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5657 | * 6-channel independent captures. |
| 5658 | * |
| 5659 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5660 | * driver yet). |
| 5661 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5662 | #define ALC882_DIGOUT_NID 0x06 |
| 5663 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5664 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5665 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5666 | { 8, NULL } |
| 5667 | }; |
| 5668 | |
| 5669 | static hda_nid_t alc882_dac_nids[4] = { |
| 5670 | /* front, rear, clfe, rear_surr */ |
| 5671 | 0x02, 0x03, 0x04, 0x05 |
| 5672 | }; |
| 5673 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5674 | /* identical with ALC880 */ |
| 5675 | #define alc882_adc_nids alc880_adc_nids |
| 5676 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5677 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5678 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5679 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5680 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5681 | /* input MUX */ |
| 5682 | /* FIXME: should be a matrix-type input source selection */ |
| 5683 | |
| 5684 | static struct hda_input_mux alc882_capture_source = { |
| 5685 | .num_items = 4, |
| 5686 | .items = { |
| 5687 | { "Mic", 0x0 }, |
| 5688 | { "Front Mic", 0x1 }, |
| 5689 | { "Line", 0x2 }, |
| 5690 | { "CD", 0x4 }, |
| 5691 | }, |
| 5692 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5693 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5694 | * 2ch mode |
| 5695 | */ |
| 5696 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5697 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5698 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5699 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5700 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5701 | { } /* end */ |
| 5702 | }; |
| 5703 | |
| 5704 | /* |
| 5705 | * 6ch mode |
| 5706 | */ |
| 5707 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5708 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5709 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5710 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5711 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5712 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5713 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5714 | { } /* end */ |
| 5715 | }; |
| 5716 | |
| 5717 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5718 | { 2, alc882_3ST_ch2_init }, |
| 5719 | { 6, alc882_3ST_ch6_init }, |
| 5720 | }; |
| 5721 | |
| 5722 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5723 | * 6ch mode |
| 5724 | */ |
| 5725 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5726 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5727 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5728 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5729 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5730 | { } /* end */ |
| 5731 | }; |
| 5732 | |
| 5733 | /* |
| 5734 | * 8ch mode |
| 5735 | */ |
| 5736 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5737 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5738 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5739 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5740 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5741 | { } /* end */ |
| 5742 | }; |
| 5743 | |
| 5744 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5745 | { 6, alc882_sixstack_ch6_init }, |
| 5746 | { 8, alc882_sixstack_ch8_init }, |
| 5747 | }; |
| 5748 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5749 | /* |
| 5750 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5751 | */ |
| 5752 | |
| 5753 | /* |
| 5754 | * 2ch mode |
| 5755 | */ |
| 5756 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5757 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5758 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5759 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5760 | { } /* end */ |
| 5761 | }; |
| 5762 | |
| 5763 | /* |
| 5764 | * 6ch mode |
| 5765 | */ |
| 5766 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5767 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5768 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5769 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5770 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5771 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5772 | { } /* end */ |
| 5773 | }; |
| 5774 | |
| 5775 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5776 | { 2, alc885_mbp_ch2_init }, |
| 5777 | { 6, alc885_mbp_ch6_init }, |
| 5778 | }; |
| 5779 | |
| 5780 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5781 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5782 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5783 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5784 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5785 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5786 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5787 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5788 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5789 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5790 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5791 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5792 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5793 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5794 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5796 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5797 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5798 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5799 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5800 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5801 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5802 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5803 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5804 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5805 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5806 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5807 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5808 | { } /* end */ |
| 5809 | }; |
| 5810 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5811 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5812 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5813 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5814 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5815 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5817 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5819 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5820 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5821 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5822 | { } /* end */ |
| 5823 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5824 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5825 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5826 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5827 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5828 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5829 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5830 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5831 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5832 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5833 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5834 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5835 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5836 | { } /* end */ |
| 5837 | }; |
| 5838 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5839 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5840 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5841 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5842 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5843 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5844 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5845 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5846 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5849 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5850 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5851 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5852 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5853 | { } /* end */ |
| 5854 | }; |
| 5855 | |
| 5856 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5857 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5858 | */ |
| 5859 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5861 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5862 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5863 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5864 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5865 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5866 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5867 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5868 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5869 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5872 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5873 | { } /* end */ |
| 5874 | }; |
| 5875 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5876 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5878 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5880 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5881 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5882 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5883 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5884 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5885 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5886 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5887 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5888 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5889 | { } /* end */ |
| 5890 | }; |
| 5891 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5892 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5893 | { |
| 5894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5895 | .name = "Channel Mode", |
| 5896 | .info = alc_ch_mode_info, |
| 5897 | .get = alc_ch_mode_get, |
| 5898 | .put = alc_ch_mode_put, |
| 5899 | }, |
| 5900 | { } /* end */ |
| 5901 | }; |
| 5902 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5903 | static struct hda_verb alc882_init_verbs[] = { |
| 5904 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5905 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5906 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5908 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5911 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5912 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5913 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5914 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5915 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5916 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5917 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5918 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5919 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5920 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5921 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5922 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5923 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5924 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5925 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5926 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5928 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5929 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5930 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5931 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5932 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5933 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5934 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5935 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5936 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5937 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5938 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5939 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5940 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5941 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5942 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5943 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5944 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5945 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5946 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5947 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5948 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5949 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5950 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5951 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5952 | |
| 5953 | /* FIXME: use matrix-type input source selection */ |
| 5954 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5955 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5956 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5957 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5958 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5959 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5960 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5961 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5962 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5963 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5964 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5965 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5968 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5969 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5970 | /* ADC1: mute amp left and right */ |
| 5971 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5972 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5973 | /* ADC2: mute amp left and right */ |
| 5974 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5975 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5976 | /* ADC3: mute amp left and right */ |
| 5977 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5978 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5979 | |
| 5980 | { } |
| 5981 | }; |
| 5982 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5983 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5984 | /* change to EAPD mode */ |
| 5985 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5986 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5987 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5988 | }; |
| 5989 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5990 | /* Mac Pro test */ |
| 5991 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5992 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5993 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5994 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5997 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5998 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5999 | { } /* end */ |
| 6000 | }; |
| 6001 | |
| 6002 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6003 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6004 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6005 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6006 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6007 | /* Front Pin: output 0 (0x0c) */ |
| 6008 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6009 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6010 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6011 | /* Front Mic pin: input vref at 80% */ |
| 6012 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6013 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6014 | /* Speaker: output */ |
| 6015 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6016 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6017 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6018 | /* Headphone output (output 0 - 0x0c) */ |
| 6019 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6020 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6021 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6022 | |
| 6023 | /* FIXME: use matrix-type input source selection */ |
| 6024 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6025 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6028 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6029 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6030 | /* Input mixer2 */ |
| 6031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6032 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6033 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6034 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6035 | /* Input mixer3 */ |
| 6036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6038 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6039 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6040 | /* ADC1: mute amp left and right */ |
| 6041 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6042 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6043 | /* ADC2: mute amp left and right */ |
| 6044 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6045 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6046 | /* ADC3: mute amp left and right */ |
| 6047 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6048 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6049 | |
| 6050 | { } |
| 6051 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6052 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6053 | /* Macbook Pro rev3 */ |
| 6054 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6055 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6057 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6059 | /* Rear mixer */ |
| 6060 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6061 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6062 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6063 | /* Front Pin: output 0 (0x0c) */ |
| 6064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6066 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6067 | /* HP Pin: output 0 (0x0d) */ |
| 6068 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6070 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6071 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6072 | /* Mic (rear) pin: input vref at 80% */ |
| 6073 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6075 | /* Front Mic pin: input vref at 80% */ |
| 6076 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6077 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6078 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6079 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6080 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6081 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6082 | |
| 6083 | /* FIXME: use matrix-type input source selection */ |
| 6084 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6085 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6087 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6088 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6089 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6090 | /* Input mixer2 */ |
| 6091 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6092 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6093 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6094 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6095 | /* Input mixer3 */ |
| 6096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6098 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6099 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6100 | /* ADC1: mute amp left and right */ |
| 6101 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6102 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6103 | /* ADC2: mute amp left and right */ |
| 6104 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6105 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6106 | /* ADC3: mute amp left and right */ |
| 6107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6108 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6109 | |
| 6110 | { } |
| 6111 | }; |
| 6112 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6113 | /* iMac 24 mixer. */ |
| 6114 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6115 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6116 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6117 | { } /* end */ |
| 6118 | }; |
| 6119 | |
| 6120 | /* iMac 24 init verbs. */ |
| 6121 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6122 | /* Internal speakers: output 0 (0x0c) */ |
| 6123 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6124 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6125 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6126 | /* Internal speakers: output 0 (0x0c) */ |
| 6127 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6128 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6129 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6130 | /* Headphone: output 0 (0x0c) */ |
| 6131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6132 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6133 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6134 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6135 | /* Front Mic: input vref at 80% */ |
| 6136 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6138 | { } |
| 6139 | }; |
| 6140 | |
| 6141 | /* Toggle speaker-output according to the hp-jack state */ |
| 6142 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6143 | { |
| 6144 | unsigned int present; |
| 6145 | |
| 6146 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6147 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6148 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6149 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6150 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6151 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6152 | } |
| 6153 | |
| 6154 | /* Processes unsolicited events. */ |
| 6155 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6156 | unsigned int res) |
| 6157 | { |
| 6158 | /* Headphone insertion or removal. */ |
| 6159 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6160 | alc885_imac24_automute(codec); |
| 6161 | } |
| 6162 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6163 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6164 | { |
| 6165 | unsigned int present; |
| 6166 | |
| 6167 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6168 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6169 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6170 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6171 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6172 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6173 | |
| 6174 | } |
| 6175 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6176 | unsigned int res) |
| 6177 | { |
| 6178 | /* Headphone insertion or removal. */ |
| 6179 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6180 | alc885_mbp3_automute(codec); |
| 6181 | } |
| 6182 | |
| 6183 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6184 | static struct hda_verb alc882_targa_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 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6189 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6190 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6191 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6192 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6193 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6194 | |
| 6195 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6196 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6197 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6198 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6199 | { } /* end */ |
| 6200 | }; |
| 6201 | |
| 6202 | /* toggle speaker-output according to the hp-jack state */ |
| 6203 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6204 | { |
| 6205 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6206 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6207 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6208 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6209 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6210 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6211 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6212 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6213 | } |
| 6214 | |
| 6215 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6216 | { |
| 6217 | /* Looks like the unsol event is incompatible with the standard |
| 6218 | * definition. 4bit tag is placed at 26 bit! |
| 6219 | */ |
| 6220 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6221 | alc882_targa_automute(codec); |
| 6222 | } |
| 6223 | } |
| 6224 | |
| 6225 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6228 | |
| 6229 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6230 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6231 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6232 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6233 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6235 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6236 | |
| 6237 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6238 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6239 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6240 | { } /* end */ |
| 6241 | }; |
| 6242 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6243 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6244 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6245 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6246 | |
| 6247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6248 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6249 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6250 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6251 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6252 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6253 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6254 | |
| 6255 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6256 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6257 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6258 | { } /* end */ |
| 6259 | }; |
| 6260 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6261 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6262 | { |
| 6263 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6264 | |
| 6265 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6266 | AC_VERB_GET_GPIO_DATA, 0); |
| 6267 | |
| 6268 | if (!muted) |
| 6269 | gpiostate |= (1 << pin); |
| 6270 | else |
| 6271 | gpiostate &= ~(1 << pin); |
| 6272 | |
| 6273 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6274 | AC_VERB_GET_GPIO_MASK, 0); |
| 6275 | gpiomask |= (1 << pin); |
| 6276 | |
| 6277 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6278 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6279 | gpiodir |= (1 << pin); |
| 6280 | |
| 6281 | |
| 6282 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6283 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6284 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6285 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6286 | |
| 6287 | msleep(1); |
| 6288 | |
| 6289 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6290 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6291 | } |
| 6292 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6293 | /* set up GPIO at initialization */ |
| 6294 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6295 | { |
| 6296 | alc882_gpio_mute(codec, 0, 0); |
| 6297 | alc882_gpio_mute(codec, 1, 0); |
| 6298 | } |
| 6299 | |
| 6300 | /* set up GPIO and update auto-muting at initialization */ |
| 6301 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6302 | { |
| 6303 | alc885_macpro_init_hook(codec); |
| 6304 | alc885_imac24_automute(codec); |
| 6305 | } |
| 6306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6307 | /* |
| 6308 | * generic initialization of ADC, input mixers and output mixers |
| 6309 | */ |
| 6310 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6311 | /* |
| 6312 | * Unmute ADC0-2 and set the default input to mic-in |
| 6313 | */ |
| 6314 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6315 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6316 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6317 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6318 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6320 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6321 | /* 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] | 6322 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6323 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6324 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6325 | */ |
| 6326 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6330 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | |
| 6333 | /* |
| 6334 | * Set up output mixers (0x0c - 0x0f) |
| 6335 | */ |
| 6336 | /* set vol=0 to output mixers */ |
| 6337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6338 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6339 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6340 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6341 | /* set up input amps for analog loopback */ |
| 6342 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6343 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6344 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6345 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6349 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6350 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6351 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6352 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6353 | |
| 6354 | /* FIXME: use matrix-type input source selection */ |
| 6355 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6356 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6357 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6358 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6359 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6360 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6361 | /* Input mixer2 */ |
| 6362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6364 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6366 | /* Input mixer3 */ |
| 6367 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6371 | |
| 6372 | { } |
| 6373 | }; |
| 6374 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6375 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6376 | #define alc882_loopbacks alc880_loopbacks |
| 6377 | #endif |
| 6378 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6379 | /* pcm configuration: identiacal with ALC880 */ |
| 6380 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6381 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6382 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6383 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6384 | |
| 6385 | /* |
| 6386 | * configuration and preset |
| 6387 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6388 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6389 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6390 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6391 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6392 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6393 | [ALC882_TARGA] = "targa", |
| 6394 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6395 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6396 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6397 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6398 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6399 | [ALC882_AUTO] = "auto", |
| 6400 | }; |
| 6401 | |
| 6402 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6403 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6404 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6405 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6406 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6407 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6408 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6409 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6410 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6411 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6412 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6413 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6414 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6415 | {} |
| 6416 | }; |
| 6417 | |
| 6418 | static struct alc_config_preset alc882_presets[] = { |
| 6419 | [ALC882_3ST_DIG] = { |
| 6420 | .mixers = { alc882_base_mixer }, |
| 6421 | .init_verbs = { alc882_init_verbs }, |
| 6422 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6423 | .dac_nids = alc882_dac_nids, |
| 6424 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6425 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6426 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6427 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6428 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6429 | .input_mux = &alc882_capture_source, |
| 6430 | }, |
| 6431 | [ALC882_6ST_DIG] = { |
| 6432 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6433 | .init_verbs = { alc882_init_verbs }, |
| 6434 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6435 | .dac_nids = alc882_dac_nids, |
| 6436 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6437 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6438 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6439 | .channel_mode = alc882_sixstack_modes, |
| 6440 | .input_mux = &alc882_capture_source, |
| 6441 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6442 | [ALC882_ARIMA] = { |
| 6443 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6444 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6445 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6446 | .dac_nids = alc882_dac_nids, |
| 6447 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6448 | .channel_mode = alc882_sixstack_modes, |
| 6449 | .input_mux = &alc882_capture_source, |
| 6450 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6451 | [ALC882_W2JC] = { |
| 6452 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6453 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6454 | alc880_gpio1_init_verbs }, |
| 6455 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6456 | .dac_nids = alc882_dac_nids, |
| 6457 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6458 | .channel_mode = alc880_threestack_modes, |
| 6459 | .need_dac_fix = 1, |
| 6460 | .input_mux = &alc882_capture_source, |
| 6461 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6462 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6463 | [ALC885_MBP3] = { |
| 6464 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6465 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6466 | alc880_gpio1_init_verbs }, |
| 6467 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6468 | .dac_nids = alc882_dac_nids, |
| 6469 | .channel_mode = alc885_mbp_6ch_modes, |
| 6470 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6471 | .input_mux = &alc882_capture_source, |
| 6472 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6473 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6474 | .unsol_event = alc885_mbp3_unsol_event, |
| 6475 | .init_hook = alc885_mbp3_automute, |
| 6476 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6477 | [ALC885_MACPRO] = { |
| 6478 | .mixers = { alc882_macpro_mixer }, |
| 6479 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6480 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6481 | .dac_nids = alc882_dac_nids, |
| 6482 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6483 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6484 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6485 | .channel_mode = alc882_ch_modes, |
| 6486 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6487 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6488 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6489 | [ALC885_IMAC24] = { |
| 6490 | .mixers = { alc885_imac24_mixer }, |
| 6491 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6492 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6493 | .dac_nids = alc882_dac_nids, |
| 6494 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6495 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6496 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6497 | .channel_mode = alc882_ch_modes, |
| 6498 | .input_mux = &alc882_capture_source, |
| 6499 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6500 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6501 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6502 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6503 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6504 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6505 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6506 | .dac_nids = alc882_dac_nids, |
| 6507 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6508 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6509 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6510 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6511 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6512 | .channel_mode = alc882_3ST_6ch_modes, |
| 6513 | .need_dac_fix = 1, |
| 6514 | .input_mux = &alc882_capture_source, |
| 6515 | .unsol_event = alc882_targa_unsol_event, |
| 6516 | .init_hook = alc882_targa_automute, |
| 6517 | }, |
| 6518 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6519 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6520 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6521 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6522 | .dac_nids = alc882_dac_nids, |
| 6523 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6524 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6525 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6526 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6527 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6528 | .channel_mode = alc882_3ST_6ch_modes, |
| 6529 | .need_dac_fix = 1, |
| 6530 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6531 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6532 | [ALC882_ASUS_A7M] = { |
| 6533 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6534 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6535 | alc880_gpio1_init_verbs, |
| 6536 | alc882_asus_a7m_verbs }, |
| 6537 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6538 | .dac_nids = alc882_dac_nids, |
| 6539 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6540 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6541 | .channel_mode = alc880_threestack_modes, |
| 6542 | .need_dac_fix = 1, |
| 6543 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6544 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6545 | }; |
| 6546 | |
| 6547 | |
| 6548 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6549 | * Pin config fixes |
| 6550 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6551 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6552 | PINFIX_ABIT_AW9D_MAX |
| 6553 | }; |
| 6554 | |
| 6555 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6556 | { 0x15, 0x01080104 }, /* side */ |
| 6557 | { 0x16, 0x01011012 }, /* rear */ |
| 6558 | { 0x17, 0x01016011 }, /* clfe */ |
| 6559 | { } |
| 6560 | }; |
| 6561 | |
| 6562 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6563 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6564 | }; |
| 6565 | |
| 6566 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6567 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6568 | {} |
| 6569 | }; |
| 6570 | |
| 6571 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6572 | * BIOS auto configuration |
| 6573 | */ |
| 6574 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6575 | hda_nid_t nid, int pin_type, |
| 6576 | int dac_idx) |
| 6577 | { |
| 6578 | /* set as output */ |
| 6579 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6580 | int idx; |
| 6581 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6582 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6583 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6584 | idx = 4; |
| 6585 | else |
| 6586 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6587 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6588 | |
| 6589 | } |
| 6590 | |
| 6591 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6592 | { |
| 6593 | struct alc_spec *spec = codec->spec; |
| 6594 | int i; |
| 6595 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6596 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6597 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6598 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6599 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6600 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6601 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6602 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6603 | } |
| 6604 | } |
| 6605 | |
| 6606 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6607 | { |
| 6608 | struct alc_spec *spec = codec->spec; |
| 6609 | hda_nid_t pin; |
| 6610 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6611 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6612 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6613 | /* use dac 0 */ |
| 6614 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6615 | pin = spec->autocfg.speaker_pins[0]; |
| 6616 | if (pin) |
| 6617 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6618 | } |
| 6619 | |
| 6620 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6621 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6622 | |
| 6623 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6624 | { |
| 6625 | struct alc_spec *spec = codec->spec; |
| 6626 | int i; |
| 6627 | |
| 6628 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6629 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6630 | unsigned int vref; |
| 6631 | if (!nid) |
| 6632 | continue; |
| 6633 | vref = PIN_IN; |
| 6634 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6635 | unsigned int pincap; |
| 6636 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6637 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6638 | AC_PINCAP_VREF_80) |
| 6639 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6640 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6641 | snd_hda_codec_write(codec, nid, 0, |
| 6642 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6643 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6644 | snd_hda_codec_write(codec, nid, 0, |
| 6645 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6646 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6647 | } |
| 6648 | } |
| 6649 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6650 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6651 | { |
| 6652 | struct alc_spec *spec = codec->spec; |
| 6653 | const struct hda_input_mux *imux = spec->input_mux; |
| 6654 | int c; |
| 6655 | |
| 6656 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6657 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6658 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6659 | int conns, mute, idx, item; |
| 6660 | |
| 6661 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6662 | ARRAY_SIZE(conn_list)); |
| 6663 | if (conns < 0) |
| 6664 | continue; |
| 6665 | for (idx = 0; idx < conns; idx++) { |
| 6666 | /* if the current connection is the selected one, |
| 6667 | * unmute it as default - otherwise mute it |
| 6668 | */ |
| 6669 | mute = AMP_IN_MUTE(idx); |
| 6670 | for (item = 0; item < imux->num_items; item++) { |
| 6671 | if (imux->items[item].index == idx) { |
| 6672 | if (spec->cur_mux[c] == item) |
| 6673 | mute = AMP_IN_UNMUTE(idx); |
| 6674 | break; |
| 6675 | } |
| 6676 | } |
| 6677 | snd_hda_codec_write(codec, nid, 0, |
| 6678 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6679 | } |
| 6680 | } |
| 6681 | } |
| 6682 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6683 | /* add mic boosts if needed */ |
| 6684 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6685 | { |
| 6686 | struct alc_spec *spec = codec->spec; |
| 6687 | int err; |
| 6688 | hda_nid_t nid; |
| 6689 | |
| 6690 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6691 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6692 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6693 | "Mic Boost", |
| 6694 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6695 | if (err < 0) |
| 6696 | return err; |
| 6697 | } |
| 6698 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6699 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6700 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6701 | "Front Mic Boost", |
| 6702 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6703 | if (err < 0) |
| 6704 | return err; |
| 6705 | } |
| 6706 | return 0; |
| 6707 | } |
| 6708 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6709 | /* almost identical with ALC880 parser... */ |
| 6710 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6711 | { |
| 6712 | struct alc_spec *spec = codec->spec; |
| 6713 | int err = alc880_parse_auto_config(codec); |
| 6714 | |
| 6715 | if (err < 0) |
| 6716 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6717 | else if (!err) |
| 6718 | return 0; /* no config found */ |
| 6719 | |
| 6720 | err = alc_auto_add_mic_boost(codec); |
| 6721 | if (err < 0) |
| 6722 | return err; |
| 6723 | |
| 6724 | /* hack - override the init verbs */ |
| 6725 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6726 | |
| 6727 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6728 | } |
| 6729 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6730 | /* additional initialization for auto-configuration model */ |
| 6731 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6732 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6733 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6734 | alc882_auto_init_multi_out(codec); |
| 6735 | alc882_auto_init_hp_out(codec); |
| 6736 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6737 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6738 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6739 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6740 | } |
| 6741 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6742 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6743 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6744 | static int patch_alc882(struct hda_codec *codec) |
| 6745 | { |
| 6746 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6747 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6748 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6749 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6750 | if (spec == NULL) |
| 6751 | return -ENOMEM; |
| 6752 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6753 | codec->spec = spec; |
| 6754 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6755 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6756 | alc882_models, |
| 6757 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6758 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6759 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6760 | /* Pick up systems that don't supply PCI SSID */ |
| 6761 | switch (codec->subsystem_id) { |
| 6762 | case 0x106b0c00: /* Mac Pro */ |
| 6763 | board_config = ALC885_MACPRO; |
| 6764 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6765 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 6766 | case 0x106b2800: /* AppleTV */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6767 | board_config = ALC885_IMAC24; |
| 6768 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6769 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 6770 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6771 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6772 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6773 | board_config = ALC885_MBP3; |
| 6774 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6775 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6776 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 6777 | if (codec->revision_id == 0x100101 || |
| 6778 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6779 | alc_free(codec); |
| 6780 | return patch_alc883(codec); |
| 6781 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6782 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6783 | "trying auto-probe from BIOS...\n"); |
| 6784 | board_config = ALC882_AUTO; |
| 6785 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6786 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6787 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6788 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6790 | if (board_config == ALC882_AUTO) { |
| 6791 | /* automatic parse from the BIOS config */ |
| 6792 | err = alc882_parse_auto_config(codec); |
| 6793 | if (err < 0) { |
| 6794 | alc_free(codec); |
| 6795 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6796 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6797 | printk(KERN_INFO |
| 6798 | "hda_codec: Cannot set up configuration " |
| 6799 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6800 | board_config = ALC882_3ST_DIG; |
| 6801 | } |
| 6802 | } |
| 6803 | |
| 6804 | if (board_config != ALC882_AUTO) |
| 6805 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6806 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6807 | if (codec->vendor_id == 0x10ec0885) { |
| 6808 | spec->stream_name_analog = "ALC885 Analog"; |
| 6809 | spec->stream_name_digital = "ALC885 Digital"; |
| 6810 | } else { |
| 6811 | spec->stream_name_analog = "ALC882 Analog"; |
| 6812 | spec->stream_name_digital = "ALC882 Digital"; |
| 6813 | } |
| 6814 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6815 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6816 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6817 | /* FIXME: setup DAC5 */ |
| 6818 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6819 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6821 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6822 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6823 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 6824 | spec->is_mix_capture = 1; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6825 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6826 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6827 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6828 | /* get type */ |
| 6829 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6830 | if (wcap != AC_WID_AUD_IN) { |
| 6831 | spec->adc_nids = alc882_adc_nids_alt; |
| 6832 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6833 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6834 | } else { |
| 6835 | spec->adc_nids = alc882_adc_nids; |
| 6836 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6837 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6838 | } |
| 6839 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6840 | set_capture_mixer(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6841 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6842 | spec->vmaster_nid = 0x0c; |
| 6843 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6844 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6845 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6846 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6847 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6848 | if (!spec->loopback.amplist) |
| 6849 | spec->loopback.amplist = alc882_loopbacks; |
| 6850 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6851 | |
| 6852 | return 0; |
| 6853 | } |
| 6854 | |
| 6855 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6856 | * ALC883 support |
| 6857 | * |
| 6858 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6859 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6860 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6861 | * 6-channel independent captures. |
| 6862 | * |
| 6863 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6864 | * driver yet). |
| 6865 | */ |
| 6866 | #define ALC883_DIGOUT_NID 0x06 |
| 6867 | #define ALC883_DIGIN_NID 0x0a |
| 6868 | |
| 6869 | static hda_nid_t alc883_dac_nids[4] = { |
| 6870 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6871 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6872 | }; |
| 6873 | |
| 6874 | static hda_nid_t alc883_adc_nids[2] = { |
| 6875 | /* ADC1-2 */ |
| 6876 | 0x08, 0x09, |
| 6877 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6878 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6879 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 6880 | /* ADC1 */ |
| 6881 | 0x08, |
| 6882 | }; |
| 6883 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6884 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6885 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6886 | /* input MUX */ |
| 6887 | /* FIXME: should be a matrix-type input source selection */ |
| 6888 | |
| 6889 | static struct hda_input_mux alc883_capture_source = { |
| 6890 | .num_items = 4, |
| 6891 | .items = { |
| 6892 | { "Mic", 0x0 }, |
| 6893 | { "Front Mic", 0x1 }, |
| 6894 | { "Line", 0x2 }, |
| 6895 | { "CD", 0x4 }, |
| 6896 | }, |
| 6897 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6898 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6899 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6900 | .num_items = 4, |
| 6901 | .items = { |
| 6902 | { "Mic", 0x1 }, |
| 6903 | { "Front Mic", 0x0 }, |
| 6904 | { "Line", 0x2 }, |
| 6905 | { "CD", 0x4 }, |
| 6906 | }, |
| 6907 | }; |
| 6908 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6909 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6910 | .num_items = 2, |
| 6911 | .items = { |
| 6912 | { "Mic", 0x1 }, |
| 6913 | { "Line", 0x2 }, |
| 6914 | }, |
| 6915 | }; |
| 6916 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6917 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6918 | .num_items = 4, |
| 6919 | .items = { |
| 6920 | { "Mic", 0x0 }, |
| 6921 | { "iMic", 0x1 }, |
| 6922 | { "Line", 0x2 }, |
| 6923 | { "CD", 0x4 }, |
| 6924 | }, |
| 6925 | }; |
| 6926 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6927 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6928 | .num_items = 2, |
| 6929 | .items = { |
| 6930 | { "Mic", 0x0 }, |
| 6931 | { "Int Mic", 0x1 }, |
| 6932 | }, |
| 6933 | }; |
| 6934 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 6935 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6936 | .num_items = 3, |
| 6937 | .items = { |
| 6938 | { "Mic", 0x0 }, |
| 6939 | { "Front Mic", 0x1 }, |
| 6940 | { "Line", 0x4 }, |
| 6941 | }, |
| 6942 | }; |
| 6943 | |
| 6944 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6945 | .num_items = 2, |
| 6946 | .items = { |
| 6947 | { "Mic", 0x0 }, |
| 6948 | { "Line", 0x2 }, |
| 6949 | }, |
| 6950 | }; |
| 6951 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6952 | /* |
| 6953 | * 2ch mode |
| 6954 | */ |
| 6955 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6956 | { 2, NULL } |
| 6957 | }; |
| 6958 | |
| 6959 | /* |
| 6960 | * 2ch mode |
| 6961 | */ |
| 6962 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6963 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6964 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6965 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6966 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6967 | { } /* end */ |
| 6968 | }; |
| 6969 | |
| 6970 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6971 | * 4ch mode |
| 6972 | */ |
| 6973 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6974 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6975 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6976 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6977 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6978 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6979 | { } /* end */ |
| 6980 | }; |
| 6981 | |
| 6982 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6983 | * 6ch mode |
| 6984 | */ |
| 6985 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6986 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6987 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6988 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6989 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6990 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6991 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6992 | { } /* end */ |
| 6993 | }; |
| 6994 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6995 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6996 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6997 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6998 | { 6, alc883_3ST_ch6_init }, |
| 6999 | }; |
| 7000 | |
| 7001 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7002 | * 2ch mode |
| 7003 | */ |
| 7004 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7005 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7006 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7007 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7008 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7009 | { } /* end */ |
| 7010 | }; |
| 7011 | |
| 7012 | /* |
| 7013 | * 4ch mode |
| 7014 | */ |
| 7015 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7016 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7017 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7018 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7019 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7020 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7021 | { } /* end */ |
| 7022 | }; |
| 7023 | |
| 7024 | /* |
| 7025 | * 6ch mode |
| 7026 | */ |
| 7027 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7028 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7029 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7030 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7031 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7032 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7033 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7034 | { } /* end */ |
| 7035 | }; |
| 7036 | |
| 7037 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7038 | { 2, alc883_3ST_ch2_intel_init }, |
| 7039 | { 4, alc883_3ST_ch4_intel_init }, |
| 7040 | { 6, alc883_3ST_ch6_intel_init }, |
| 7041 | }; |
| 7042 | |
| 7043 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7044 | * 6ch mode |
| 7045 | */ |
| 7046 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7047 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7048 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7049 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7050 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7051 | { } /* end */ |
| 7052 | }; |
| 7053 | |
| 7054 | /* |
| 7055 | * 8ch mode |
| 7056 | */ |
| 7057 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7058 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7059 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7060 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7061 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7062 | { } /* end */ |
| 7063 | }; |
| 7064 | |
| 7065 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7066 | { 6, alc883_sixstack_ch6_init }, |
| 7067 | { 8, alc883_sixstack_ch8_init }, |
| 7068 | }; |
| 7069 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7070 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7071 | /* eanable EAPD on medion laptop */ |
| 7072 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7073 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7074 | { } |
| 7075 | }; |
| 7076 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7077 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7078 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7079 | */ |
| 7080 | |
| 7081 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7082 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7083 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7084 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7085 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7086 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7087 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7088 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7089 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7090 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7091 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7092 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7093 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7094 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7095 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7096 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7097 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7098 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7099 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7100 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7101 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7102 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7103 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7104 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7105 | { } /* end */ |
| 7106 | }; |
| 7107 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7108 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7109 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7110 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7111 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7112 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7113 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7114 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7115 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7117 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7118 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7119 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7120 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7121 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7122 | { } /* end */ |
| 7123 | }; |
| 7124 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7125 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7126 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7127 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7128 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7129 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7131 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7132 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7133 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7134 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7135 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7136 | { } /* end */ |
| 7137 | }; |
| 7138 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7139 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7140 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7141 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7142 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7143 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7144 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7145 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7146 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7147 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7148 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7149 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7150 | { } /* end */ |
| 7151 | }; |
| 7152 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7153 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7154 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7155 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7156 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7157 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7158 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7159 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7160 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7161 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7162 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7164 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7165 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7166 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7167 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7168 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7169 | { } /* end */ |
| 7170 | }; |
| 7171 | |
| 7172 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7173 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7174 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7175 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7176 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7177 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7178 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7179 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7180 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7181 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7182 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7183 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7184 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7185 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7186 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7187 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7188 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7189 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7190 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7191 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7192 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7193 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7194 | { } /* end */ |
| 7195 | }; |
| 7196 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7197 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7198 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7199 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7200 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7201 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7202 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7203 | HDA_OUTPUT), |
| 7204 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7205 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7206 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7207 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7208 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7209 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7210 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7211 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7213 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7214 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7215 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7216 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7217 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7218 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7219 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7220 | { } /* end */ |
| 7221 | }; |
| 7222 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7223 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7224 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7225 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7226 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7227 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7228 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7229 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7230 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7231 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7233 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7234 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7235 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7236 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7237 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7238 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7240 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7241 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7242 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7243 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7244 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7245 | { } /* end */ |
| 7246 | }; |
| 7247 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7248 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7249 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7250 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7251 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7252 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7253 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7254 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7255 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7256 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7257 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7258 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7259 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7260 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7261 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7263 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7265 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7266 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7267 | |
| 7268 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7269 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7270 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7271 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7272 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7273 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7274 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7275 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7276 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7277 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7278 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7279 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7280 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7281 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7282 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7283 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7284 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7285 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7286 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7287 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7288 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7290 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7291 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7292 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7293 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7294 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7295 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7296 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7297 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7298 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7299 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7300 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7301 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7302 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7303 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7304 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7305 | { } /* end */ |
| 7306 | }; |
| 7307 | |
| 7308 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7309 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7310 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7311 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7312 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7313 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7316 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7317 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7318 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7319 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7320 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7321 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7322 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7323 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7324 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7325 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7326 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7328 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7329 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7330 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7331 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7332 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7333 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7334 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7335 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7336 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7337 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7338 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7339 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7340 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7341 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7342 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7343 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7344 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7345 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7346 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7347 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7348 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7349 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7350 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7352 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7353 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7354 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7355 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7356 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7357 | { } /* end */ |
| 7358 | }; |
| 7359 | |
| 7360 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7361 | .ops = &snd_hda_bind_vol, |
| 7362 | .values = { |
| 7363 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7364 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7365 | 0 |
| 7366 | }, |
| 7367 | }; |
| 7368 | |
| 7369 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7370 | .ops = &snd_hda_bind_sw, |
| 7371 | .values = { |
| 7372 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7373 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7374 | 0 |
| 7375 | }, |
| 7376 | }; |
| 7377 | |
| 7378 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7379 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7380 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7381 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7382 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7383 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7384 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7385 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7386 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7387 | { } /* end */ |
| 7388 | }; |
| 7389 | |
| 7390 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7391 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7392 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7393 | { |
| 7394 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7395 | /* .name = "Capture Source", */ |
| 7396 | .name = "Input Source", |
| 7397 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7398 | .info = alc_mux_enum_info, |
| 7399 | .get = alc_mux_enum_get, |
| 7400 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7401 | }, |
| 7402 | { } /* end */ |
| 7403 | }; |
| 7404 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7405 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7406 | { |
| 7407 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7408 | .name = "Channel Mode", |
| 7409 | .info = alc_ch_mode_info, |
| 7410 | .get = alc_ch_mode_get, |
| 7411 | .put = alc_ch_mode_put, |
| 7412 | }, |
| 7413 | { } /* end */ |
| 7414 | }; |
| 7415 | |
| 7416 | static struct hda_verb alc883_init_verbs[] = { |
| 7417 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7419 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7420 | /* ADC2: mute amp left and right */ |
| 7421 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7422 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7423 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7424 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7426 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7427 | /* Rear mixer */ |
| 7428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7429 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7430 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7431 | /* CLFE mixer */ |
| 7432 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7433 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7434 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7435 | /* Side mixer */ |
| 7436 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7437 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7438 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7439 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7440 | /* mute analog input loopbacks */ |
| 7441 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7442 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7443 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7444 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7446 | |
| 7447 | /* Front Pin: output 0 (0x0c) */ |
| 7448 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7449 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7450 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7451 | /* Rear Pin: output 1 (0x0d) */ |
| 7452 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7453 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7454 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7455 | /* CLFE Pin: output 2 (0x0e) */ |
| 7456 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7457 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7458 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7459 | /* Side Pin: output 3 (0x0f) */ |
| 7460 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7461 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7462 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7463 | /* Mic (rear) pin: input vref at 80% */ |
| 7464 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7465 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7466 | /* Front Mic pin: input vref at 80% */ |
| 7467 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7468 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7469 | /* Line In pin: input */ |
| 7470 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7471 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7472 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7473 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7474 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7475 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7476 | /* CD pin widget for input */ |
| 7477 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7478 | |
| 7479 | /* FIXME: use matrix-type input source selection */ |
| 7480 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7481 | /* Input mixer2 */ |
| 7482 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7483 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7484 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7486 | /* Input mixer3 */ |
| 7487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7488 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7489 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7490 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7491 | { } |
| 7492 | }; |
| 7493 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7494 | /* toggle speaker-output according to the hp-jack state */ |
| 7495 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7496 | { |
| 7497 | unsigned int present; |
| 7498 | |
| 7499 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7500 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7501 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7502 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7503 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7504 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7505 | } |
| 7506 | |
| 7507 | /* auto-toggle front mic */ |
| 7508 | /* |
| 7509 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7510 | { |
| 7511 | unsigned int present; |
| 7512 | unsigned char bits; |
| 7513 | |
| 7514 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7515 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7516 | bits = present ? HDA_AMP_MUTE : 0; |
| 7517 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7518 | } |
| 7519 | */ |
| 7520 | |
| 7521 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7522 | { |
| 7523 | alc883_mitac_hp_automute(codec); |
| 7524 | /* alc883_mitac_mic_automute(codec); */ |
| 7525 | } |
| 7526 | |
| 7527 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7528 | unsigned int res) |
| 7529 | { |
| 7530 | switch (res >> 26) { |
| 7531 | case ALC880_HP_EVENT: |
| 7532 | alc883_mitac_hp_automute(codec); |
| 7533 | break; |
| 7534 | case ALC880_MIC_EVENT: |
| 7535 | /* alc883_mitac_mic_automute(codec); */ |
| 7536 | break; |
| 7537 | } |
| 7538 | } |
| 7539 | |
| 7540 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7541 | /* HP */ |
| 7542 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7543 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7544 | /* Subwoofer */ |
| 7545 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7546 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7547 | |
| 7548 | /* enable unsolicited event */ |
| 7549 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7550 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7551 | |
| 7552 | { } /* end */ |
| 7553 | }; |
| 7554 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7555 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7556 | /* HP */ |
| 7557 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7558 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7559 | /* Int speaker */ |
| 7560 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7561 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7562 | |
| 7563 | /* enable unsolicited event */ |
| 7564 | {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] | 7565 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7566 | |
| 7567 | { } /* end */ |
| 7568 | }; |
| 7569 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7570 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7571 | /* HP */ |
| 7572 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7573 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7574 | /* Subwoofer */ |
| 7575 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7576 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7577 | |
| 7578 | /* enable unsolicited event */ |
| 7579 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7580 | |
| 7581 | { } /* end */ |
| 7582 | }; |
| 7583 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7584 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7585 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7587 | |
| 7588 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7589 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7590 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7591 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7592 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7593 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7594 | |
| 7595 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7596 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7597 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7598 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7599 | |
| 7600 | { } /* end */ |
| 7601 | }; |
| 7602 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7603 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7604 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7605 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7606 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7607 | { } /* end */ |
| 7608 | }; |
| 7609 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7610 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7611 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7612 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7613 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7614 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7615 | { } /* end */ |
| 7616 | }; |
| 7617 | |
| 7618 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7619 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7620 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7621 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7622 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7623 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7624 | { } /* end */ |
| 7625 | }; |
| 7626 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7627 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7629 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7630 | |
| 7631 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7632 | |
| 7633 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7634 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7635 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7636 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7637 | { } /* end */ |
| 7638 | }; |
| 7639 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7640 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7641 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7642 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7643 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7644 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7645 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7646 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7647 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7648 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7649 | { } /* end */ |
| 7650 | }; |
| 7651 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7652 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7653 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7654 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7655 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7656 | { } |
| 7657 | }; |
| 7658 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7659 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7660 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7661 | { } |
| 7662 | }; |
| 7663 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7664 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7665 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7666 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7667 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7668 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7669 | { } |
| 7670 | }; |
| 7671 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7672 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7673 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7674 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7675 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7676 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7677 | { } |
| 7678 | }; |
| 7679 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7680 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7681 | { 2, alc888_3st_hp_2ch_init }, |
| 7682 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7683 | }; |
| 7684 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7685 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7686 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7687 | { |
| 7688 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7689 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7690 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7691 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7692 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7693 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7694 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7695 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7696 | } |
| 7697 | |
| 7698 | /* toggle RCA according to the front-jack state */ |
| 7699 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7700 | { |
| 7701 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7702 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7703 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7704 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7705 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7706 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7707 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7708 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7709 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7710 | unsigned int res) |
| 7711 | { |
| 7712 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7713 | alc888_lenovo_ms7195_front_automute(codec); |
| 7714 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7715 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7716 | } |
| 7717 | |
| 7718 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7719 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7720 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7721 | |
| 7722 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7723 | |
| 7724 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7725 | { } /* end */ |
| 7726 | }; |
| 7727 | |
| 7728 | /* toggle speaker-output according to the hp-jack state */ |
| 7729 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7730 | { |
| 7731 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7732 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7733 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7734 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7735 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7736 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7737 | } |
| 7738 | |
| 7739 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7740 | unsigned int res) |
| 7741 | { |
| 7742 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7743 | alc883_medion_md2_automute(codec); |
| 7744 | } |
| 7745 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7746 | /* toggle speaker-output according to the hp-jack state */ |
| 7747 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7748 | { |
| 7749 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7750 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7751 | |
| 7752 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7753 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7754 | bits = present ? HDA_AMP_MUTE : 0; |
| 7755 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7756 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7757 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7758 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7759 | } |
| 7760 | |
| 7761 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7762 | { |
| 7763 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7764 | alc883_tagra_automute(codec); |
| 7765 | } |
| 7766 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7767 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7768 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7769 | { |
| 7770 | unsigned int present; |
| 7771 | unsigned char bits; |
| 7772 | |
| 7773 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7774 | & AC_PINSENSE_PRESENCE; |
| 7775 | bits = present ? HDA_AMP_MUTE : 0; |
| 7776 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7777 | HDA_AMP_MUTE, bits); |
| 7778 | } |
| 7779 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7780 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7781 | { |
| 7782 | unsigned int present; |
| 7783 | |
| 7784 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7785 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7786 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7787 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7788 | } |
| 7789 | |
| 7790 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7791 | { |
| 7792 | alc883_clevo_m720_hp_automute(codec); |
| 7793 | alc883_clevo_m720_mic_automute(codec); |
| 7794 | } |
| 7795 | |
| 7796 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7797 | unsigned int res) |
| 7798 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7799 | switch (res >> 26) { |
| 7800 | case ALC880_HP_EVENT: |
| 7801 | alc883_clevo_m720_hp_automute(codec); |
| 7802 | break; |
| 7803 | case ALC880_MIC_EVENT: |
| 7804 | alc883_clevo_m720_mic_automute(codec); |
| 7805 | break; |
| 7806 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7807 | } |
| 7808 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7809 | /* toggle speaker-output according to the hp-jack state */ |
| 7810 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7811 | { |
| 7812 | unsigned int present; |
| 7813 | unsigned char bits; |
| 7814 | |
| 7815 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7816 | & AC_PINSENSE_PRESENCE; |
| 7817 | bits = present ? HDA_AMP_MUTE : 0; |
| 7818 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7819 | HDA_AMP_MUTE, bits); |
| 7820 | } |
| 7821 | |
| 7822 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7823 | unsigned int res) |
| 7824 | { |
| 7825 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7826 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7827 | } |
| 7828 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7829 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7830 | { |
| 7831 | unsigned int present; |
| 7832 | unsigned char bits; |
| 7833 | |
| 7834 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7835 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7836 | bits = present ? 0x80 : 0; |
| 7837 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7838 | 0x80, bits); |
| 7839 | } |
| 7840 | |
| 7841 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7842 | unsigned int res) |
| 7843 | { |
| 7844 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7845 | alc883_haier_w66_automute(codec); |
| 7846 | } |
| 7847 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7848 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7849 | { |
| 7850 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7851 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7852 | |
| 7853 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7854 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7855 | bits = present ? HDA_AMP_MUTE : 0; |
| 7856 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7857 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7858 | } |
| 7859 | |
| 7860 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7861 | { |
| 7862 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7863 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7864 | |
| 7865 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7866 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7867 | bits = present ? HDA_AMP_MUTE : 0; |
| 7868 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7869 | HDA_AMP_MUTE, bits); |
| 7870 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7871 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7872 | } |
| 7873 | |
| 7874 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7875 | unsigned int res) |
| 7876 | { |
| 7877 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7878 | alc883_lenovo_101e_all_automute(codec); |
| 7879 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7880 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7881 | } |
| 7882 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7883 | /* toggle speaker-output according to the hp-jack state */ |
| 7884 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7885 | { |
| 7886 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7887 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7888 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7889 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7890 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7891 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7892 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7893 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7894 | } |
| 7895 | |
| 7896 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7897 | unsigned int res) |
| 7898 | { |
| 7899 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7900 | alc883_acer_aspire_automute(codec); |
| 7901 | } |
| 7902 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7903 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7904 | /* HP Pin: output 0 (0x0c) */ |
| 7905 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7906 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7907 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7908 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7909 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7910 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7911 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7912 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7913 | /* eanable EAPD on medion laptop */ |
| 7914 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7915 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7916 | /* enable unsolicited event */ |
| 7917 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7918 | { } |
| 7919 | }; |
| 7920 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7921 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7922 | { |
| 7923 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7924 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7925 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7926 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7927 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7928 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7929 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7930 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7931 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7932 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7933 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7934 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7935 | } |
| 7936 | |
| 7937 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7938 | unsigned int res) |
| 7939 | { |
| 7940 | switch (res >> 26) { |
| 7941 | case ALC880_HP_EVENT: |
| 7942 | printk("hp_event\n"); |
| 7943 | alc888_6st_dell_front_automute(codec); |
| 7944 | break; |
| 7945 | } |
| 7946 | } |
| 7947 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7948 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 7949 | { |
| 7950 | unsigned int mute; |
| 7951 | unsigned int present; |
| 7952 | |
| 7953 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7954 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7955 | AC_VERB_GET_PIN_SENSE, 0); |
| 7956 | present = (present & 0x80000000) != 0; |
| 7957 | if (present) { |
| 7958 | /* mute internal speaker */ |
| 7959 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7960 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7961 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7962 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7963 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7964 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7965 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7966 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7967 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7968 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7969 | } else { |
| 7970 | /* unmute internal speaker if necessary */ |
| 7971 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 7972 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7973 | HDA_AMP_MUTE, mute); |
| 7974 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7975 | HDA_AMP_MUTE, mute); |
| 7976 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7977 | HDA_AMP_MUTE, mute); |
| 7978 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7979 | HDA_AMP_MUTE, mute); |
| 7980 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7981 | HDA_AMP_MUTE, mute); |
| 7982 | } |
| 7983 | } |
| 7984 | |
| 7985 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 7986 | unsigned int res) |
| 7987 | { |
| 7988 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7989 | alc888_lenovo_sky_front_automute(codec); |
| 7990 | } |
| 7991 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7992 | /* |
| 7993 | * generic initialization of ADC, input mixers and output mixers |
| 7994 | */ |
| 7995 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7996 | /* |
| 7997 | * Unmute ADC0-2 and set the default input to mic-in |
| 7998 | */ |
| 7999 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8000 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8001 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8002 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8003 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8004 | /* 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] | 8005 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8006 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8007 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8008 | */ |
| 8009 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8010 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8014 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8015 | |
| 8016 | /* |
| 8017 | * Set up output mixers (0x0c - 0x0f) |
| 8018 | */ |
| 8019 | /* set vol=0 to output mixers */ |
| 8020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8022 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8023 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8024 | /* set up input amps for analog loopback */ |
| 8025 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8027 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8029 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8030 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8031 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8032 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8033 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8034 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8035 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8036 | |
| 8037 | /* FIXME: use matrix-type input source selection */ |
| 8038 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8039 | /* Input mixer1 */ |
| 8040 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8041 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8042 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8043 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8044 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8045 | /* Input mixer2 */ |
| 8046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8048 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8049 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8050 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8051 | |
| 8052 | { } |
| 8053 | }; |
| 8054 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8055 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8059 | /* enable unsolicited event */ |
| 8060 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8061 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8062 | { } /* end */ |
| 8063 | }; |
| 8064 | |
| 8065 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8066 | { |
| 8067 | unsigned int present; |
| 8068 | |
| 8069 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8070 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8071 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8072 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8073 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8074 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8075 | } |
| 8076 | |
| 8077 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8078 | { |
| 8079 | unsigned int present; |
| 8080 | unsigned char bits; |
| 8081 | |
| 8082 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8083 | AC_VERB_GET_PIN_SENSE, 0) |
| 8084 | & AC_PINSENSE_PRESENCE; |
| 8085 | bits = present ? 0 : PIN_OUT; |
| 8086 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8087 | bits); |
| 8088 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8089 | bits); |
| 8090 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8091 | bits); |
| 8092 | } |
| 8093 | |
| 8094 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8095 | unsigned int res) |
| 8096 | { |
| 8097 | switch (res >> 26) { |
| 8098 | case ALC880_HP_EVENT: |
| 8099 | alc883_M90V_speaker_automute(codec); |
| 8100 | break; |
| 8101 | case ALC880_MIC_EVENT: |
| 8102 | alc883_nb_mic_automute(codec); |
| 8103 | break; |
| 8104 | } |
| 8105 | } |
| 8106 | |
| 8107 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8108 | { |
| 8109 | alc883_M90V_speaker_automute(codec); |
| 8110 | alc883_nb_mic_automute(codec); |
| 8111 | } |
| 8112 | |
| 8113 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8114 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8115 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8117 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8118 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8119 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8120 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8121 | /* enable unsolicited event */ |
| 8122 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8123 | { } /* end */ |
| 8124 | }; |
| 8125 | |
| 8126 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8127 | { |
| 8128 | unsigned int present; |
| 8129 | unsigned char bits; |
| 8130 | |
| 8131 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8132 | AC_VERB_GET_PIN_SENSE, 0) |
| 8133 | & AC_PINSENSE_PRESENCE; |
| 8134 | bits = present ? 0 : PIN_OUT; |
| 8135 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8136 | bits); |
| 8137 | } |
| 8138 | |
| 8139 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8140 | unsigned int res) |
| 8141 | { |
| 8142 | switch (res >> 26) { |
| 8143 | case ALC880_HP_EVENT: |
| 8144 | alc883_eee1601_speaker_automute(codec); |
| 8145 | break; |
| 8146 | } |
| 8147 | } |
| 8148 | |
| 8149 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8150 | { |
| 8151 | alc883_eee1601_speaker_automute(codec); |
| 8152 | } |
| 8153 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8154 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8155 | #define alc883_loopbacks alc880_loopbacks |
| 8156 | #endif |
| 8157 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8158 | /* pcm configuration: identiacal with ALC880 */ |
| 8159 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8160 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8161 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8162 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8163 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8164 | |
| 8165 | /* |
| 8166 | * configuration and preset |
| 8167 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8168 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8169 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8170 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8171 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8172 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8173 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8174 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8175 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8176 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8177 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8178 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8179 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8180 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8181 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8182 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8183 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8184 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8185 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8186 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8187 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8188 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8189 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8190 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8191 | [ALC883_AUTO] = "auto", |
| 8192 | }; |
| 8193 | |
| 8194 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8195 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8196 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 8197 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8198 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8199 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8200 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8201 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8202 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8203 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8204 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8205 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8206 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8207 | 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] | 8208 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8209 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8210 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8211 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8212 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8213 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8214 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8215 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8216 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8217 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8218 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8219 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8220 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8221 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8222 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8223 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8224 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8225 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8226 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8227 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8228 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8229 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8230 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8231 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8232 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8233 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8234 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8235 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8236 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8237 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8238 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8239 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8240 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8241 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8242 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8243 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8244 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8245 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8246 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8247 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8248 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8249 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8250 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8251 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8252 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8253 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8254 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8255 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8256 | {} |
| 8257 | }; |
| 8258 | |
| 8259 | static struct alc_config_preset alc883_presets[] = { |
| 8260 | [ALC883_3ST_2ch_DIG] = { |
| 8261 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8262 | .init_verbs = { alc883_init_verbs }, |
| 8263 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8264 | .dac_nids = alc883_dac_nids, |
| 8265 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8266 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8267 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8268 | .channel_mode = alc883_3ST_2ch_modes, |
| 8269 | .input_mux = &alc883_capture_source, |
| 8270 | }, |
| 8271 | [ALC883_3ST_6ch_DIG] = { |
| 8272 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8273 | .init_verbs = { alc883_init_verbs }, |
| 8274 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8275 | .dac_nids = alc883_dac_nids, |
| 8276 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8277 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8278 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8279 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8280 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8281 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8282 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8283 | [ALC883_3ST_6ch] = { |
| 8284 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8285 | .init_verbs = { alc883_init_verbs }, |
| 8286 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8287 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8288 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8289 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8290 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8291 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8292 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8293 | [ALC883_3ST_6ch_INTEL] = { |
| 8294 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8295 | .init_verbs = { alc883_init_verbs }, |
| 8296 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8297 | .dac_nids = alc883_dac_nids, |
| 8298 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8299 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8300 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8301 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8302 | .need_dac_fix = 1, |
| 8303 | .input_mux = &alc883_3stack_6ch_intel, |
| 8304 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8305 | [ALC883_6ST_DIG] = { |
| 8306 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8307 | .init_verbs = { alc883_init_verbs }, |
| 8308 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8309 | .dac_nids = alc883_dac_nids, |
| 8310 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8311 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8312 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8313 | .channel_mode = alc883_sixstack_modes, |
| 8314 | .input_mux = &alc883_capture_source, |
| 8315 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8316 | [ALC883_TARGA_DIG] = { |
| 8317 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8318 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8319 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8320 | .dac_nids = alc883_dac_nids, |
| 8321 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8322 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8323 | .channel_mode = alc883_3ST_6ch_modes, |
| 8324 | .need_dac_fix = 1, |
| 8325 | .input_mux = &alc883_capture_source, |
| 8326 | .unsol_event = alc883_tagra_unsol_event, |
| 8327 | .init_hook = alc883_tagra_automute, |
| 8328 | }, |
| 8329 | [ALC883_TARGA_2ch_DIG] = { |
| 8330 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8331 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8332 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8333 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8334 | .adc_nids = alc883_adc_nids_alt, |
| 8335 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8336 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8337 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8338 | .channel_mode = alc883_3ST_2ch_modes, |
| 8339 | .input_mux = &alc883_capture_source, |
| 8340 | .unsol_event = alc883_tagra_unsol_event, |
| 8341 | .init_hook = alc883_tagra_automute, |
| 8342 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8343 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8344 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8345 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8346 | * and the headphone jack. Turn this on and rely on the |
| 8347 | * standard mute methods whenever the user wants to turn |
| 8348 | * these outputs off. |
| 8349 | */ |
| 8350 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8351 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8352 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8353 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8354 | .channel_mode = alc883_3ST_2ch_modes, |
| 8355 | .input_mux = &alc883_capture_source, |
| 8356 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8357 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8358 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8359 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8360 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8361 | .dac_nids = alc883_dac_nids, |
| 8362 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8363 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8364 | .channel_mode = alc883_3ST_2ch_modes, |
| 8365 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8366 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8367 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8368 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8369 | [ALC883_MEDION] = { |
| 8370 | .mixers = { alc883_fivestack_mixer, |
| 8371 | alc883_chmode_mixer }, |
| 8372 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8373 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8374 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8375 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8376 | .adc_nids = alc883_adc_nids_alt, |
| 8377 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8378 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8379 | .channel_mode = alc883_sixstack_modes, |
| 8380 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8381 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8382 | [ALC883_MEDION_MD2] = { |
| 8383 | .mixers = { alc883_medion_md2_mixer}, |
| 8384 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8385 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8386 | .dac_nids = alc883_dac_nids, |
| 8387 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8388 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8389 | .channel_mode = alc883_3ST_2ch_modes, |
| 8390 | .input_mux = &alc883_capture_source, |
| 8391 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8392 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8393 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8394 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8395 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8396 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8397 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8398 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8399 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8400 | .channel_mode = alc883_3ST_2ch_modes, |
| 8401 | .input_mux = &alc883_capture_source, |
| 8402 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8403 | [ALC883_CLEVO_M720] = { |
| 8404 | .mixers = { alc883_clevo_m720_mixer }, |
| 8405 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8406 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8407 | .dac_nids = alc883_dac_nids, |
| 8408 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8409 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8410 | .channel_mode = alc883_3ST_2ch_modes, |
| 8411 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8412 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8413 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8414 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8415 | [ALC883_LENOVO_101E_2ch] = { |
| 8416 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8417 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8418 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8419 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8420 | .adc_nids = alc883_adc_nids_alt, |
| 8421 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8422 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8423 | .channel_mode = alc883_3ST_2ch_modes, |
| 8424 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8425 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8426 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8427 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8428 | [ALC883_LENOVO_NB0763] = { |
| 8429 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8430 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8431 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8432 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8433 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8434 | .channel_mode = alc883_3ST_2ch_modes, |
| 8435 | .need_dac_fix = 1, |
| 8436 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8437 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8438 | .init_hook = alc883_medion_md2_automute, |
| 8439 | }, |
| 8440 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8441 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8442 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8443 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8444 | .dac_nids = alc883_dac_nids, |
| 8445 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8446 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8447 | .channel_mode = alc883_3ST_6ch_modes, |
| 8448 | .need_dac_fix = 1, |
| 8449 | .input_mux = &alc883_capture_source, |
| 8450 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8451 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8452 | }, |
| 8453 | [ALC883_HAIER_W66] = { |
| 8454 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8455 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8457 | .dac_nids = alc883_dac_nids, |
| 8458 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8459 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8460 | .channel_mode = alc883_3ST_2ch_modes, |
| 8461 | .input_mux = &alc883_capture_source, |
| 8462 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8463 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8464 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8465 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8466 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8467 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8468 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8469 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8470 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8471 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8472 | .need_dac_fix = 1, |
| 8473 | .input_mux = &alc883_capture_source, |
| 8474 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8475 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8476 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8477 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8478 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8479 | .dac_nids = alc883_dac_nids, |
| 8480 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8481 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8482 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8483 | .channel_mode = alc883_sixstack_modes, |
| 8484 | .input_mux = &alc883_capture_source, |
| 8485 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8486 | .init_hook = alc888_6st_dell_front_automute, |
| 8487 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8488 | [ALC883_MITAC] = { |
| 8489 | .mixers = { alc883_mitac_mixer }, |
| 8490 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8491 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8492 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8493 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8494 | .channel_mode = alc883_3ST_2ch_modes, |
| 8495 | .input_mux = &alc883_capture_source, |
| 8496 | .unsol_event = alc883_mitac_unsol_event, |
| 8497 | .init_hook = alc883_mitac_automute, |
| 8498 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8499 | [ALC883_FUJITSU_PI2515] = { |
| 8500 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8501 | .init_verbs = { alc883_init_verbs, |
| 8502 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8503 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8504 | .dac_nids = alc883_dac_nids, |
| 8505 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8506 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8507 | .channel_mode = alc883_3ST_2ch_modes, |
| 8508 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8509 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8510 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8511 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8512 | [ALC888_LENOVO_SKY] = { |
| 8513 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8514 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8515 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8516 | .dac_nids = alc883_dac_nids, |
| 8517 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8518 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8519 | .channel_mode = alc883_sixstack_modes, |
| 8520 | .need_dac_fix = 1, |
| 8521 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8522 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8523 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8524 | }, |
| 8525 | [ALC888_ASUS_M90V] = { |
| 8526 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8527 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8528 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8529 | .dac_nids = alc883_dac_nids, |
| 8530 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8531 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8532 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8533 | .channel_mode = alc883_3ST_6ch_modes, |
| 8534 | .need_dac_fix = 1, |
| 8535 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8536 | .unsol_event = alc883_mode2_unsol_event, |
| 8537 | .init_hook = alc883_mode2_inithook, |
| 8538 | }, |
| 8539 | [ALC888_ASUS_EEE1601] = { |
| 8540 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8541 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8542 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8543 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8544 | .dac_nids = alc883_dac_nids, |
| 8545 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8546 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8547 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8548 | .channel_mode = alc883_3ST_2ch_modes, |
| 8549 | .need_dac_fix = 1, |
| 8550 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8551 | .unsol_event = alc883_eee1601_unsol_event, |
| 8552 | .init_hook = alc883_eee1601_inithook, |
| 8553 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8554 | }; |
| 8555 | |
| 8556 | |
| 8557 | /* |
| 8558 | * BIOS auto configuration |
| 8559 | */ |
| 8560 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8561 | hda_nid_t nid, int pin_type, |
| 8562 | int dac_idx) |
| 8563 | { |
| 8564 | /* set as output */ |
| 8565 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8566 | int idx; |
| 8567 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8568 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8569 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8570 | idx = 4; |
| 8571 | else |
| 8572 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8573 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8574 | |
| 8575 | } |
| 8576 | |
| 8577 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8578 | { |
| 8579 | struct alc_spec *spec = codec->spec; |
| 8580 | int i; |
| 8581 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8582 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8583 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8584 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8585 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8586 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8587 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8588 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8589 | } |
| 8590 | } |
| 8591 | |
| 8592 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8593 | { |
| 8594 | struct alc_spec *spec = codec->spec; |
| 8595 | hda_nid_t pin; |
| 8596 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8597 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8598 | if (pin) /* connect to front */ |
| 8599 | /* use dac 0 */ |
| 8600 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8601 | pin = spec->autocfg.speaker_pins[0]; |
| 8602 | if (pin) |
| 8603 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8604 | } |
| 8605 | |
| 8606 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8607 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8608 | |
| 8609 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8610 | { |
| 8611 | struct alc_spec *spec = codec->spec; |
| 8612 | int i; |
| 8613 | |
| 8614 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8615 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8616 | if (alc883_is_input_pin(nid)) { |
| 8617 | snd_hda_codec_write(codec, nid, 0, |
| 8618 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8619 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8620 | PIN_VREF80 : PIN_IN)); |
| 8621 | if (nid != ALC883_PIN_CD_NID) |
| 8622 | snd_hda_codec_write(codec, nid, 0, |
| 8623 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8624 | AMP_OUT_MUTE); |
| 8625 | } |
| 8626 | } |
| 8627 | } |
| 8628 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8629 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8630 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8631 | /* almost identical with ALC880 parser... */ |
| 8632 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8633 | { |
| 8634 | struct alc_spec *spec = codec->spec; |
| 8635 | int err = alc880_parse_auto_config(codec); |
| 8636 | |
| 8637 | if (err < 0) |
| 8638 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8639 | else if (!err) |
| 8640 | return 0; /* no config found */ |
| 8641 | |
| 8642 | err = alc_auto_add_mic_boost(codec); |
| 8643 | if (err < 0) |
| 8644 | return err; |
| 8645 | |
| 8646 | /* hack - override the init verbs */ |
| 8647 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8648 | |
| 8649 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8650 | } |
| 8651 | |
| 8652 | /* additional initialization for auto-configuration model */ |
| 8653 | static void alc883_auto_init(struct hda_codec *codec) |
| 8654 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8655 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8656 | alc883_auto_init_multi_out(codec); |
| 8657 | alc883_auto_init_hp_out(codec); |
| 8658 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8659 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8660 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 8661 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8662 | } |
| 8663 | |
| 8664 | static int patch_alc883(struct hda_codec *codec) |
| 8665 | { |
| 8666 | struct alc_spec *spec; |
| 8667 | int err, board_config; |
| 8668 | |
| 8669 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8670 | if (spec == NULL) |
| 8671 | return -ENOMEM; |
| 8672 | |
| 8673 | codec->spec = spec; |
| 8674 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8675 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8676 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8677 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8678 | alc883_models, |
| 8679 | alc883_cfg_tbl); |
| 8680 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8681 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8682 | "trying auto-probe from BIOS...\n"); |
| 8683 | board_config = ALC883_AUTO; |
| 8684 | } |
| 8685 | |
| 8686 | if (board_config == ALC883_AUTO) { |
| 8687 | /* automatic parse from the BIOS config */ |
| 8688 | err = alc883_parse_auto_config(codec); |
| 8689 | if (err < 0) { |
| 8690 | alc_free(codec); |
| 8691 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8692 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8693 | printk(KERN_INFO |
| 8694 | "hda_codec: Cannot set up configuration " |
| 8695 | "from BIOS. Using base mode...\n"); |
| 8696 | board_config = ALC883_3ST_2ch_DIG; |
| 8697 | } |
| 8698 | } |
| 8699 | |
| 8700 | if (board_config != ALC883_AUTO) |
| 8701 | setup_preset(spec, &alc883_presets[board_config]); |
| 8702 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8703 | switch (codec->vendor_id) { |
| 8704 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 8705 | if (codec->revision_id == 0x100101) { |
| 8706 | spec->stream_name_analog = "ALC1200 Analog"; |
| 8707 | spec->stream_name_digital = "ALC1200 Digital"; |
| 8708 | } else { |
| 8709 | spec->stream_name_analog = "ALC888 Analog"; |
| 8710 | spec->stream_name_digital = "ALC888 Digital"; |
| 8711 | } |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8712 | break; |
| 8713 | case 0x10ec0889: |
| 8714 | spec->stream_name_analog = "ALC889 Analog"; |
| 8715 | spec->stream_name_digital = "ALC889 Digital"; |
| 8716 | break; |
| 8717 | default: |
| 8718 | spec->stream_name_analog = "ALC883 Analog"; |
| 8719 | spec->stream_name_digital = "ALC883 Digital"; |
| 8720 | break; |
| 8721 | } |
| 8722 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8723 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8724 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8725 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8726 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8727 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8728 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8729 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8730 | if (!spec->num_adc_nids) { |
| 8731 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8732 | spec->adc_nids = alc883_adc_nids; |
| 8733 | } |
| 8734 | if (!spec->capsrc_nids) |
| 8735 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8736 | spec->is_mix_capture = 1; /* matrix-style capture */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8737 | if (!spec->cap_mixer) |
| 8738 | set_capture_mixer(spec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8739 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8740 | spec->vmaster_nid = 0x0c; |
| 8741 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8742 | codec->patch_ops = alc_patch_ops; |
| 8743 | if (board_config == ALC883_AUTO) |
| 8744 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8745 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8746 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8747 | if (!spec->loopback.amplist) |
| 8748 | spec->loopback.amplist = alc883_loopbacks; |
| 8749 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8750 | |
| 8751 | return 0; |
| 8752 | } |
| 8753 | |
| 8754 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8755 | * ALC262 support |
| 8756 | */ |
| 8757 | |
| 8758 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8759 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8760 | |
| 8761 | #define alc262_dac_nids alc260_dac_nids |
| 8762 | #define alc262_adc_nids alc882_adc_nids |
| 8763 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8764 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8765 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8766 | |
| 8767 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8768 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8769 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8770 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 8771 | /* ADC0 */ |
| 8772 | 0x09 |
| 8773 | }; |
| 8774 | |
| 8775 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 8776 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8777 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8779 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8780 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8781 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8783 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8784 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8786 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8787 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8788 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8789 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8790 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8791 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8792 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8794 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8795 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8796 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8797 | }; |
| 8798 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8799 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8801 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8802 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8803 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8804 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8805 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8808 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8809 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8810 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8811 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8812 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8813 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8814 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8815 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8816 | { } /* end */ |
| 8817 | }; |
| 8818 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8819 | /* update HP, line and mono-out pins according to the master switch */ |
| 8820 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8821 | { |
| 8822 | struct alc_spec *spec = codec->spec; |
| 8823 | int val = spec->master_sw; |
| 8824 | |
| 8825 | /* HP & line-out */ |
| 8826 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8827 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8828 | val ? PIN_HP : 0); |
| 8829 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8830 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8831 | val ? PIN_HP : 0); |
| 8832 | /* mono (speaker) depending on the HP jack sense */ |
| 8833 | val = val && !spec->jack_present; |
| 8834 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8835 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8836 | val ? PIN_OUT : 0); |
| 8837 | } |
| 8838 | |
| 8839 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8840 | { |
| 8841 | struct alc_spec *spec = codec->spec; |
| 8842 | unsigned int presence; |
| 8843 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8844 | AC_VERB_GET_PIN_SENSE, 0); |
| 8845 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8846 | alc262_hp_master_update(codec); |
| 8847 | } |
| 8848 | |
| 8849 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8850 | { |
| 8851 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8852 | return; |
| 8853 | alc262_hp_bpc_automute(codec); |
| 8854 | } |
| 8855 | |
| 8856 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8857 | { |
| 8858 | struct alc_spec *spec = codec->spec; |
| 8859 | unsigned int presence; |
| 8860 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8861 | AC_VERB_GET_PIN_SENSE, 0); |
| 8862 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8863 | alc262_hp_master_update(codec); |
| 8864 | } |
| 8865 | |
| 8866 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8867 | unsigned int res) |
| 8868 | { |
| 8869 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8870 | return; |
| 8871 | alc262_hp_wildwest_automute(codec); |
| 8872 | } |
| 8873 | |
| 8874 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8875 | struct snd_ctl_elem_value *ucontrol) |
| 8876 | { |
| 8877 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8878 | struct alc_spec *spec = codec->spec; |
| 8879 | *ucontrol->value.integer.value = spec->master_sw; |
| 8880 | return 0; |
| 8881 | } |
| 8882 | |
| 8883 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8884 | struct snd_ctl_elem_value *ucontrol) |
| 8885 | { |
| 8886 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8887 | struct alc_spec *spec = codec->spec; |
| 8888 | int val = !!*ucontrol->value.integer.value; |
| 8889 | |
| 8890 | if (val == spec->master_sw) |
| 8891 | return 0; |
| 8892 | spec->master_sw = val; |
| 8893 | alc262_hp_master_update(codec); |
| 8894 | return 1; |
| 8895 | } |
| 8896 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8897 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8898 | { |
| 8899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8900 | .name = "Master Playback Switch", |
| 8901 | .info = snd_ctl_boolean_mono_info, |
| 8902 | .get = alc262_hp_master_sw_get, |
| 8903 | .put = alc262_hp_master_sw_put, |
| 8904 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8905 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8906 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8907 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8908 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8909 | HDA_OUTPUT), |
| 8910 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8911 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8914 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8915 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8916 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8917 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8918 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8919 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8920 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8921 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8922 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8923 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8924 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8925 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8926 | { } /* end */ |
| 8927 | }; |
| 8928 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8929 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8930 | { |
| 8931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8932 | .name = "Master Playback Switch", |
| 8933 | .info = snd_ctl_boolean_mono_info, |
| 8934 | .get = alc262_hp_master_sw_get, |
| 8935 | .put = alc262_hp_master_sw_put, |
| 8936 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8937 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8938 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8939 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8940 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8941 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8942 | HDA_OUTPUT), |
| 8943 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8944 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8945 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8946 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8947 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8948 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8949 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8950 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8951 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8952 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8953 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8954 | { } /* end */ |
| 8955 | }; |
| 8956 | |
| 8957 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8958 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8959 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8960 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8961 | { } /* end */ |
| 8962 | }; |
| 8963 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8964 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8965 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8966 | { |
| 8967 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8968 | |
| 8969 | if (force || !spec->sense_updated) { |
| 8970 | unsigned int present; |
| 8971 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8972 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8973 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8974 | spec->sense_updated = 1; |
| 8975 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8976 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8977 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8978 | } |
| 8979 | |
| 8980 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8981 | unsigned int res) |
| 8982 | { |
| 8983 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8984 | return; |
| 8985 | alc262_hp_t5735_automute(codec, 1); |
| 8986 | } |
| 8987 | |
| 8988 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8989 | { |
| 8990 | alc262_hp_t5735_automute(codec, 1); |
| 8991 | } |
| 8992 | |
| 8993 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8994 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8995 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8996 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8997 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8998 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8999 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9000 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9001 | { } /* end */ |
| 9002 | }; |
| 9003 | |
| 9004 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9006 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9007 | |
| 9008 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9009 | { } |
| 9010 | }; |
| 9011 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9012 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9013 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9015 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9016 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9017 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9018 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9019 | { } /* end */ |
| 9020 | }; |
| 9021 | |
| 9022 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9023 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9024 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9025 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9026 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9027 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9028 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9029 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9030 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9033 | {} |
| 9034 | }; |
| 9035 | |
| 9036 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9037 | .num_items = 1, |
| 9038 | .items = { |
| 9039 | { "Line", 0x1 }, |
| 9040 | }, |
| 9041 | }; |
| 9042 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9043 | /* bind hp and internal speaker mute (with plug check) */ |
| 9044 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9045 | struct snd_ctl_elem_value *ucontrol) |
| 9046 | { |
| 9047 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9048 | long *valp = ucontrol->value.integer.value; |
| 9049 | int change; |
| 9050 | |
| 9051 | /* change hp mute */ |
| 9052 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9053 | HDA_AMP_MUTE, |
| 9054 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9055 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9056 | HDA_AMP_MUTE, |
| 9057 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9058 | if (change) { |
| 9059 | /* change speaker according to HP jack state */ |
| 9060 | struct alc_spec *spec = codec->spec; |
| 9061 | unsigned int mute; |
| 9062 | if (spec->jack_present) |
| 9063 | mute = HDA_AMP_MUTE; |
| 9064 | else |
| 9065 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9066 | HDA_OUTPUT, 0); |
| 9067 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9068 | HDA_AMP_MUTE, mute); |
| 9069 | } |
| 9070 | return change; |
| 9071 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9072 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9073 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9074 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9075 | { |
| 9076 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9077 | .name = "Master Playback Switch", |
| 9078 | .info = snd_hda_mixer_amp_switch_info, |
| 9079 | .get = snd_hda_mixer_amp_switch_get, |
| 9080 | .put = alc262_sony_master_sw_put, |
| 9081 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9082 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9084 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9085 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9086 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9087 | { } /* end */ |
| 9088 | }; |
| 9089 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9090 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9092 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9093 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9094 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9095 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9096 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9097 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9098 | { } /* end */ |
| 9099 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9100 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9101 | #define alc262_capture_mixer alc882_capture_mixer |
| 9102 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9103 | |
| 9104 | /* |
| 9105 | * generic initialization of ADC, input mixers and output mixers |
| 9106 | */ |
| 9107 | static struct hda_verb alc262_init_verbs[] = { |
| 9108 | /* |
| 9109 | * Unmute ADC0-2 and set the default input to mic-in |
| 9110 | */ |
| 9111 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9113 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9115 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9117 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9118 | /* 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] | 9119 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9120 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9121 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9122 | */ |
| 9123 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9124 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9125 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9126 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9129 | |
| 9130 | /* |
| 9131 | * Set up output mixers (0x0c - 0x0e) |
| 9132 | */ |
| 9133 | /* set vol=0 to output mixers */ |
| 9134 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9135 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9136 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9137 | /* set up input amps for analog loopback */ |
| 9138 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9139 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9140 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9141 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9142 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9143 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9144 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9145 | |
| 9146 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9148 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9149 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9150 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9151 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9152 | |
| 9153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9154 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9155 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9156 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9157 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9158 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9159 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9160 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9161 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9162 | /* FIXME: use matrix-type input source selection */ |
| 9163 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9164 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9165 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9166 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9167 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9168 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9169 | /* Input mixer2 */ |
| 9170 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9174 | /* Input mixer3 */ |
| 9175 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9176 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9179 | |
| 9180 | { } |
| 9181 | }; |
| 9182 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9183 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9184 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9185 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9186 | { } |
| 9187 | }; |
| 9188 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9189 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9190 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9191 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9192 | {} |
| 9193 | }; |
| 9194 | |
| 9195 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9196 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9197 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9198 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9199 | |
| 9200 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9201 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9202 | {} |
| 9203 | }; |
| 9204 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9205 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9207 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9208 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9209 | |
| 9210 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9211 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9212 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9213 | }; |
| 9214 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9215 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9216 | .num_items = 2, |
| 9217 | .items = { |
| 9218 | { "Int DMic", 0x9 }, |
| 9219 | { "Mic", 0x0 }, |
| 9220 | }, |
| 9221 | }; |
| 9222 | |
| 9223 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9224 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9225 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9227 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9228 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9229 | { } /* end */ |
| 9230 | }; |
| 9231 | |
| 9232 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9233 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9236 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9237 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9238 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9239 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9240 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9241 | {} |
| 9242 | }; |
| 9243 | |
| 9244 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9245 | { |
| 9246 | unsigned int present; |
| 9247 | |
| 9248 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9249 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9250 | snd_hda_codec_write(codec, 0x22, 0, |
| 9251 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9252 | } |
| 9253 | |
| 9254 | /* toggle speaker-output according to the hp-jack state */ |
| 9255 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9256 | { |
| 9257 | unsigned int present; |
| 9258 | unsigned char bits; |
| 9259 | |
| 9260 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9261 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9262 | bits = present ? 0 : PIN_OUT; |
| 9263 | snd_hda_codec_write(codec, 0x14, 0, |
| 9264 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9265 | } |
| 9266 | |
| 9267 | |
| 9268 | |
| 9269 | /* unsolicited event for HP jack sensing */ |
| 9270 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9271 | unsigned int res) |
| 9272 | { |
| 9273 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9274 | alc262_toshiba_s06_speaker_automute(codec); |
| 9275 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9276 | alc262_dmic_automute(codec); |
| 9277 | |
| 9278 | } |
| 9279 | |
| 9280 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9281 | { |
| 9282 | alc262_toshiba_s06_speaker_automute(codec); |
| 9283 | alc262_dmic_automute(codec); |
| 9284 | } |
| 9285 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9286 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9287 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9288 | { |
| 9289 | struct alc_spec *spec = codec->spec; |
| 9290 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9291 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9292 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9293 | /* need to execute and sync at first */ |
| 9294 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9295 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9296 | AC_VERB_GET_PIN_SENSE, 0); |
| 9297 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9298 | if (spec->jack_present) { |
| 9299 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9300 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9301 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9302 | } else { |
| 9303 | /* unmute internal speaker if necessary */ |
| 9304 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9305 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9306 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9307 | } |
| 9308 | } |
| 9309 | |
| 9310 | /* unsolicited event for HP jack sensing */ |
| 9311 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9312 | unsigned int res) |
| 9313 | { |
| 9314 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9315 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9316 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9317 | } |
| 9318 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9319 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9320 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9321 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9322 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9323 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9324 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9325 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9326 | AC_VERB_GET_PIN_SENSE, 0); |
| 9327 | present = (present & 0x80000000) != 0; |
| 9328 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9329 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9330 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9331 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9332 | } else { |
| 9333 | /* unmute internal speaker if necessary */ |
| 9334 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9335 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9336 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9337 | } |
| 9338 | } |
| 9339 | |
| 9340 | /* unsolicited event for HP jack sensing */ |
| 9341 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9342 | unsigned int res) |
| 9343 | { |
| 9344 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9345 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9346 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9347 | } |
| 9348 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9349 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9350 | * nec model |
| 9351 | * 0x15 = headphone |
| 9352 | * 0x16 = internal speaker |
| 9353 | * 0x18 = external mic |
| 9354 | */ |
| 9355 | |
| 9356 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9357 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9358 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9359 | |
| 9360 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9361 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9362 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9363 | |
| 9364 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9365 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9366 | { } /* end */ |
| 9367 | }; |
| 9368 | |
| 9369 | static struct hda_verb alc262_nec_verbs[] = { |
| 9370 | /* Unmute Speaker */ |
| 9371 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9372 | |
| 9373 | /* Headphone */ |
| 9374 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9375 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9376 | |
| 9377 | /* External mic to headphone */ |
| 9378 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9379 | /* External mic to speaker */ |
| 9380 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9381 | {} |
| 9382 | }; |
| 9383 | |
| 9384 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9385 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9386 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9387 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9388 | */ |
| 9389 | |
| 9390 | #define ALC_HP_EVENT 0x37 |
| 9391 | |
| 9392 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9393 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9394 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9395 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9396 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9397 | {} |
| 9398 | }; |
| 9399 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9400 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9401 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9402 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9403 | {} |
| 9404 | }; |
| 9405 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9406 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9407 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9408 | .items = { |
| 9409 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9410 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9411 | { "CD", 0x4 }, |
| 9412 | }, |
| 9413 | }; |
| 9414 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9415 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9416 | .num_items = 5, |
| 9417 | .items = { |
| 9418 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9419 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9420 | { "Line", 0x2 }, |
| 9421 | { "CD", 0x4 }, |
| 9422 | { "AUX IN", 0x6 }, |
| 9423 | }, |
| 9424 | }; |
| 9425 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9426 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9427 | .num_items = 4, |
| 9428 | .items = { |
| 9429 | { "Mic", 0x0 }, |
| 9430 | { "Front Mic", 0x2 }, |
| 9431 | { "Line", 0x1 }, |
| 9432 | { "CD", 0x4 }, |
| 9433 | }, |
| 9434 | }; |
| 9435 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9436 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9437 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9438 | { |
| 9439 | struct alc_spec *spec = codec->spec; |
| 9440 | unsigned int mute; |
| 9441 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9442 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9443 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9444 | /* need to execute and sync at first */ |
| 9445 | 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] | 9446 | /* check laptop HP jack */ |
| 9447 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9448 | AC_VERB_GET_PIN_SENSE, 0); |
| 9449 | /* need to execute and sync at first */ |
| 9450 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9451 | /* check docking HP jack */ |
| 9452 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9453 | AC_VERB_GET_PIN_SENSE, 0); |
| 9454 | if (present & AC_PINSENSE_PRESENCE) |
| 9455 | spec->jack_present = 1; |
| 9456 | else |
| 9457 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9458 | spec->sense_updated = 1; |
| 9459 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9460 | /* unmute internal speaker only if both HPs are unplugged and |
| 9461 | * master switch is on |
| 9462 | */ |
| 9463 | if (spec->jack_present) |
| 9464 | mute = HDA_AMP_MUTE; |
| 9465 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9466 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9467 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9468 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9469 | } |
| 9470 | |
| 9471 | /* unsolicited event for HP jack sensing */ |
| 9472 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9473 | unsigned int res) |
| 9474 | { |
| 9475 | if ((res >> 26) != ALC_HP_EVENT) |
| 9476 | return; |
| 9477 | alc262_fujitsu_automute(codec, 1); |
| 9478 | } |
| 9479 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9480 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9481 | { |
| 9482 | alc262_fujitsu_automute(codec, 1); |
| 9483 | } |
| 9484 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9485 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9486 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9487 | .ops = &snd_hda_bind_vol, |
| 9488 | .values = { |
| 9489 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9490 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9491 | 0 |
| 9492 | }, |
| 9493 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9494 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9495 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9496 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9497 | { |
| 9498 | struct alc_spec *spec = codec->spec; |
| 9499 | unsigned int mute; |
| 9500 | |
| 9501 | if (force || !spec->sense_updated) { |
| 9502 | unsigned int present_int_hp; |
| 9503 | /* need to execute and sync at first */ |
| 9504 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9505 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9506 | AC_VERB_GET_PIN_SENSE, 0); |
| 9507 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9508 | spec->sense_updated = 1; |
| 9509 | } |
| 9510 | if (spec->jack_present) { |
| 9511 | /* mute internal speaker */ |
| 9512 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9513 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9514 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9515 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9516 | } else { |
| 9517 | /* unmute internal speaker if necessary */ |
| 9518 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9519 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9520 | HDA_AMP_MUTE, mute); |
| 9521 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9522 | HDA_AMP_MUTE, mute); |
| 9523 | } |
| 9524 | } |
| 9525 | |
| 9526 | /* unsolicited event for HP jack sensing */ |
| 9527 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9528 | unsigned int res) |
| 9529 | { |
| 9530 | if ((res >> 26) != ALC_HP_EVENT) |
| 9531 | return; |
| 9532 | alc262_lenovo_3000_automute(codec, 1); |
| 9533 | } |
| 9534 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9535 | /* bind hp and internal speaker mute (with plug check) */ |
| 9536 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9537 | struct snd_ctl_elem_value *ucontrol) |
| 9538 | { |
| 9539 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9540 | long *valp = ucontrol->value.integer.value; |
| 9541 | int change; |
| 9542 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9543 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9544 | HDA_AMP_MUTE, |
| 9545 | valp ? 0 : HDA_AMP_MUTE); |
| 9546 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9547 | HDA_AMP_MUTE, |
| 9548 | valp ? 0 : HDA_AMP_MUTE); |
| 9549 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9550 | if (change) |
| 9551 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9552 | return change; |
| 9553 | } |
| 9554 | |
| 9555 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9556 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9557 | { |
| 9558 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9559 | .name = "Master Playback Switch", |
| 9560 | .info = snd_hda_mixer_amp_switch_info, |
| 9561 | .get = snd_hda_mixer_amp_switch_get, |
| 9562 | .put = alc262_fujitsu_master_sw_put, |
| 9563 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9564 | }, |
| 9565 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9566 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9567 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9568 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9569 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9570 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9571 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9572 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9573 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9574 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9575 | { } /* end */ |
| 9576 | }; |
| 9577 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9578 | /* bind hp and internal speaker mute (with plug check) */ |
| 9579 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9580 | struct snd_ctl_elem_value *ucontrol) |
| 9581 | { |
| 9582 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9583 | long *valp = ucontrol->value.integer.value; |
| 9584 | int change; |
| 9585 | |
| 9586 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9587 | HDA_AMP_MUTE, |
| 9588 | valp ? 0 : HDA_AMP_MUTE); |
| 9589 | |
| 9590 | if (change) |
| 9591 | alc262_lenovo_3000_automute(codec, 0); |
| 9592 | return change; |
| 9593 | } |
| 9594 | |
| 9595 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9596 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9597 | { |
| 9598 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9599 | .name = "Master Playback Switch", |
| 9600 | .info = snd_hda_mixer_amp_switch_info, |
| 9601 | .get = snd_hda_mixer_amp_switch_get, |
| 9602 | .put = alc262_lenovo_3000_master_sw_put, |
| 9603 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9604 | }, |
| 9605 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9606 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9607 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9608 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9609 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9610 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9611 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9612 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9613 | { } /* end */ |
| 9614 | }; |
| 9615 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 9616 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 9617 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9618 | { |
| 9619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9620 | .name = "Master Playback Switch", |
| 9621 | .info = snd_hda_mixer_amp_switch_info, |
| 9622 | .get = snd_hda_mixer_amp_switch_get, |
| 9623 | .put = alc262_sony_master_sw_put, |
| 9624 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9625 | }, |
| 9626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9628 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9629 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9630 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9631 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9632 | { } /* end */ |
| 9633 | }; |
| 9634 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9635 | /* additional init verbs for Benq laptops */ |
| 9636 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9637 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9638 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9639 | {} |
| 9640 | }; |
| 9641 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9642 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9643 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9644 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9645 | |
| 9646 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9647 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9648 | {} |
| 9649 | }; |
| 9650 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9651 | /* Samsung Q1 Ultra Vista model setup */ |
| 9652 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9653 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9654 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9655 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9656 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9657 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9658 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9659 | { } /* end */ |
| 9660 | }; |
| 9661 | |
| 9662 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9663 | /* output mixer */ |
| 9664 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9665 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9666 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9667 | /* speaker */ |
| 9668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9669 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9670 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9671 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9672 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9673 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9674 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9675 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9676 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9677 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9678 | /* internal mic */ |
| 9679 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9680 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9681 | /* ADC, choose mic */ |
| 9682 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9683 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9684 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9685 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9686 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9687 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9688 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9689 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9690 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9691 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9692 | {} |
| 9693 | }; |
| 9694 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9695 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9696 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9697 | { |
| 9698 | struct alc_spec *spec = codec->spec; |
| 9699 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9700 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9701 | mute = 0; |
| 9702 | /* auto-mute only when HP is used as HP */ |
| 9703 | if (!spec->cur_mux[0]) { |
| 9704 | unsigned int present; |
| 9705 | /* need to execute and sync at first */ |
| 9706 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9707 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9708 | AC_VERB_GET_PIN_SENSE, 0); |
| 9709 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9710 | if (spec->jack_present) |
| 9711 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9712 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9713 | /* mute/unmute internal speaker */ |
| 9714 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9715 | HDA_AMP_MUTE, mute); |
| 9716 | /* mute/unmute HP */ |
| 9717 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9718 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9719 | } |
| 9720 | |
| 9721 | /* unsolicited event for HP jack sensing */ |
| 9722 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9723 | unsigned int res) |
| 9724 | { |
| 9725 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9726 | return; |
| 9727 | alc262_ultra_automute(codec); |
| 9728 | } |
| 9729 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9730 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9731 | .num_items = 2, |
| 9732 | .items = { |
| 9733 | { "Mic", 0x1 }, |
| 9734 | { "Headphone", 0x7 }, |
| 9735 | }, |
| 9736 | }; |
| 9737 | |
| 9738 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9739 | struct snd_ctl_elem_value *ucontrol) |
| 9740 | { |
| 9741 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9742 | struct alc_spec *spec = codec->spec; |
| 9743 | int ret; |
| 9744 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9745 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9746 | if (!ret) |
| 9747 | return 0; |
| 9748 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9749 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9750 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9751 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9752 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9753 | return ret; |
| 9754 | } |
| 9755 | |
| 9756 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9757 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9758 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9759 | { |
| 9760 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9761 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9762 | .info = alc_mux_enum_info, |
| 9763 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9764 | .put = alc262_ultra_mux_enum_put, |
| 9765 | }, |
| 9766 | { } /* end */ |
| 9767 | }; |
| 9768 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9769 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9770 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9771 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9772 | { |
| 9773 | hda_nid_t nid; |
| 9774 | int err; |
| 9775 | |
| 9776 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9777 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9778 | spec->multiout.dac_nids[0] = 2; |
| 9779 | |
| 9780 | nid = cfg->line_out_pins[0]; |
| 9781 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9782 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9783 | "Front Playback Volume", |
| 9784 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9785 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9786 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9787 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9788 | "Front Playback Switch", |
| 9789 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9790 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9791 | return err; |
| 9792 | } |
| 9793 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9794 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9795 | if (nid) { |
| 9796 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9797 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9798 | "Speaker Playback Volume", |
| 9799 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9800 | HDA_OUTPUT)); |
| 9801 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9802 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9803 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9804 | "Speaker Playback Switch", |
| 9805 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9806 | HDA_OUTPUT)); |
| 9807 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9808 | return err; |
| 9809 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9810 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9811 | "Speaker Playback Switch", |
| 9812 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9813 | HDA_OUTPUT)); |
| 9814 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9815 | return err; |
| 9816 | } |
| 9817 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9818 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9819 | if (nid) { |
| 9820 | /* spec->multiout.hp_nid = 2; */ |
| 9821 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9822 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9823 | "Headphone Playback Volume", |
| 9824 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9825 | HDA_OUTPUT)); |
| 9826 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9827 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9828 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9829 | "Headphone Playback Switch", |
| 9830 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9831 | HDA_OUTPUT)); |
| 9832 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9833 | return err; |
| 9834 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9835 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9836 | "Headphone Playback Switch", |
| 9837 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9838 | HDA_OUTPUT)); |
| 9839 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9840 | return err; |
| 9841 | } |
| 9842 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9843 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9844 | } |
| 9845 | |
| 9846 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9847 | #define alc262_auto_create_analog_input_ctls \ |
| 9848 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9849 | |
| 9850 | /* |
| 9851 | * generic initialization of ADC, input mixers and output mixers |
| 9852 | */ |
| 9853 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9854 | /* |
| 9855 | * Unmute ADC0-2 and set the default input to mic-in |
| 9856 | */ |
| 9857 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9858 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9859 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9860 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9861 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9862 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9863 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9864 | /* 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] | 9865 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9866 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9867 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9868 | */ |
| 9869 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9870 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9871 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9872 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9873 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9874 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9875 | |
| 9876 | /* |
| 9877 | * Set up output mixers (0x0c - 0x0f) |
| 9878 | */ |
| 9879 | /* set vol=0 to output mixers */ |
| 9880 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9881 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9882 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9884 | /* set up input amps for analog loopback */ |
| 9885 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9888 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9889 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9890 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9891 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9892 | |
| 9893 | /* FIXME: use matrix-type input source selection */ |
| 9894 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9895 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9896 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9897 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9898 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9899 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9900 | /* Input mixer2 */ |
| 9901 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9902 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9903 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9904 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9905 | /* Input mixer3 */ |
| 9906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9908 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9909 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9910 | |
| 9911 | { } |
| 9912 | }; |
| 9913 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9914 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9915 | /* |
| 9916 | * Unmute ADC0-2 and set the default input to mic-in |
| 9917 | */ |
| 9918 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9920 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9921 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9922 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9923 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9924 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9925 | /* 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] | 9926 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9927 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9928 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9929 | */ |
| 9930 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9936 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9937 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9938 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9939 | /* |
| 9940 | * Set up output mixers (0x0c - 0x0e) |
| 9941 | */ |
| 9942 | /* set vol=0 to output mixers */ |
| 9943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9944 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9945 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9946 | |
| 9947 | /* set up input amps for analog loopback */ |
| 9948 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9949 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9951 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9952 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9953 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9954 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9955 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9956 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9958 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9959 | |
| 9960 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9961 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9962 | |
| 9963 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9964 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9965 | |
| 9966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9967 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9968 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9969 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9970 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9971 | |
| 9972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9973 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9974 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9975 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9976 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9977 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9978 | |
| 9979 | |
| 9980 | /* FIXME: use matrix-type input source selection */ |
| 9981 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9982 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9983 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9986 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9987 | /* Input mixer2 */ |
| 9988 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9989 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9990 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9991 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9992 | /* Input mixer3 */ |
| 9993 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9994 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9995 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9996 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9997 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9998 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9999 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10000 | { } |
| 10001 | }; |
| 10002 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10003 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10004 | /* |
| 10005 | * Unmute ADC0-2 and set the default input to mic-in |
| 10006 | */ |
| 10007 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10008 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10009 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10010 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10011 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10012 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10013 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10014 | /* 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] | 10015 | * mixer widget |
| 10016 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10017 | * panel mic (mic 2) |
| 10018 | */ |
| 10019 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10020 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10021 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10027 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10028 | /* |
| 10029 | * Set up output mixers (0x0c - 0x0e) |
| 10030 | */ |
| 10031 | /* set vol=0 to output mixers */ |
| 10032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10033 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10034 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10035 | |
| 10036 | /* set up input amps for analog loopback */ |
| 10037 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10043 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10044 | |
| 10045 | |
| 10046 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10047 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10048 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10049 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10050 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10051 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10052 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10053 | |
| 10054 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10055 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10056 | |
| 10057 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10058 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10059 | |
| 10060 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10061 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10062 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10063 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10064 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10065 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10066 | |
| 10067 | /* FIXME: use matrix-type input source selection */ |
| 10068 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10069 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10070 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10074 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10075 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10076 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10077 | /* Input mixer2 */ |
| 10078 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10079 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10082 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10083 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10084 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10085 | /* Input mixer3 */ |
| 10086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10089 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10091 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10093 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10094 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10095 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10096 | { } |
| 10097 | }; |
| 10098 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10099 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10100 | |
| 10101 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10102 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10103 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10104 | |
| 10105 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10106 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10107 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10108 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10109 | |
| 10110 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10111 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10112 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10113 | {} |
| 10114 | }; |
| 10115 | |
| 10116 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10117 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10118 | #define alc262_loopbacks alc880_loopbacks |
| 10119 | #endif |
| 10120 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10121 | /* pcm configuration: identiacal with ALC880 */ |
| 10122 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10123 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10124 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10125 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10126 | |
| 10127 | /* |
| 10128 | * BIOS auto configuration |
| 10129 | */ |
| 10130 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10131 | { |
| 10132 | struct alc_spec *spec = codec->spec; |
| 10133 | int err; |
| 10134 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10135 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10136 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10137 | alc262_ignore); |
| 10138 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10139 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10140 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10141 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10142 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10143 | if (err < 0) |
| 10144 | return err; |
| 10145 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10146 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10147 | return err; |
| 10148 | |
| 10149 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10150 | |
| 10151 | if (spec->autocfg.dig_out_pin) |
| 10152 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 10153 | if (spec->autocfg.dig_in_pin) |
| 10154 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10155 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10156 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10157 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10158 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10159 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10160 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10161 | spec->input_mux = &spec->private_imux; |
| 10162 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10163 | err = alc_auto_add_mic_boost(codec); |
| 10164 | if (err < 0) |
| 10165 | return err; |
| 10166 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 10167 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10168 | return 1; |
| 10169 | } |
| 10170 | |
| 10171 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10172 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10173 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10174 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10175 | |
| 10176 | |
| 10177 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10178 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10179 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10180 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10181 | alc262_auto_init_multi_out(codec); |
| 10182 | alc262_auto_init_hp_out(codec); |
| 10183 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10184 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10185 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10186 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10187 | } |
| 10188 | |
| 10189 | /* |
| 10190 | * configuration and preset |
| 10191 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10192 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10193 | [ALC262_BASIC] = "basic", |
| 10194 | [ALC262_HIPPO] = "hippo", |
| 10195 | [ALC262_HIPPO_1] = "hippo_1", |
| 10196 | [ALC262_FUJITSU] = "fujitsu", |
| 10197 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10198 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10199 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10200 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10201 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10202 | [ALC262_BENQ_T31] = "benq-t31", |
| 10203 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10204 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10205 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10206 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10207 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10208 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10209 | [ALC262_AUTO] = "auto", |
| 10210 | }; |
| 10211 | |
| 10212 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10213 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10214 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10215 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10216 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10217 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 10218 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10219 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10220 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10221 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10222 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10223 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10224 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10225 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10226 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10227 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10228 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10229 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10230 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10231 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10232 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10233 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10234 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10235 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10236 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10237 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10238 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10239 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10240 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10241 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10242 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10243 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10244 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10245 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10246 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10247 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10248 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10249 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10250 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10251 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10252 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10253 | {} |
| 10254 | }; |
| 10255 | |
| 10256 | static struct alc_config_preset alc262_presets[] = { |
| 10257 | [ALC262_BASIC] = { |
| 10258 | .mixers = { alc262_base_mixer }, |
| 10259 | .init_verbs = { alc262_init_verbs }, |
| 10260 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10261 | .dac_nids = alc262_dac_nids, |
| 10262 | .hp_nid = 0x03, |
| 10263 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10264 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10265 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10266 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10267 | [ALC262_HIPPO] = { |
| 10268 | .mixers = { alc262_base_mixer }, |
| 10269 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10270 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10271 | .dac_nids = alc262_dac_nids, |
| 10272 | .hp_nid = 0x03, |
| 10273 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10274 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10275 | .channel_mode = alc262_modes, |
| 10276 | .input_mux = &alc262_capture_source, |
| 10277 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10278 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10279 | }, |
| 10280 | [ALC262_HIPPO_1] = { |
| 10281 | .mixers = { alc262_hippo1_mixer }, |
| 10282 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10283 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10284 | .dac_nids = alc262_dac_nids, |
| 10285 | .hp_nid = 0x02, |
| 10286 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10287 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10288 | .channel_mode = alc262_modes, |
| 10289 | .input_mux = &alc262_capture_source, |
| 10290 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10291 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10292 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10293 | [ALC262_FUJITSU] = { |
| 10294 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10295 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10296 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10297 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10298 | .dac_nids = alc262_dac_nids, |
| 10299 | .hp_nid = 0x03, |
| 10300 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10301 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10302 | .channel_mode = alc262_modes, |
| 10303 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10304 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10305 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10306 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10307 | [ALC262_HP_BPC] = { |
| 10308 | .mixers = { alc262_HP_BPC_mixer }, |
| 10309 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10310 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10311 | .dac_nids = alc262_dac_nids, |
| 10312 | .hp_nid = 0x03, |
| 10313 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10314 | .channel_mode = alc262_modes, |
| 10315 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10316 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10317 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10318 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10319 | [ALC262_HP_BPC_D7000_WF] = { |
| 10320 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10321 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10322 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10323 | .dac_nids = alc262_dac_nids, |
| 10324 | .hp_nid = 0x03, |
| 10325 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10326 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10327 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10328 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10329 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10330 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10331 | [ALC262_HP_BPC_D7000_WL] = { |
| 10332 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10333 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10334 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10335 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10336 | .dac_nids = alc262_dac_nids, |
| 10337 | .hp_nid = 0x03, |
| 10338 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10339 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10340 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10341 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10342 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10343 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10344 | [ALC262_HP_TC_T5735] = { |
| 10345 | .mixers = { alc262_hp_t5735_mixer }, |
| 10346 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 10347 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10348 | .dac_nids = alc262_dac_nids, |
| 10349 | .hp_nid = 0x03, |
| 10350 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10351 | .channel_mode = alc262_modes, |
| 10352 | .input_mux = &alc262_capture_source, |
| 10353 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10354 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10355 | }, |
| 10356 | [ALC262_HP_RP5700] = { |
| 10357 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10358 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10359 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10360 | .dac_nids = alc262_dac_nids, |
| 10361 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10362 | .channel_mode = alc262_modes, |
| 10363 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10364 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10365 | [ALC262_BENQ_ED8] = { |
| 10366 | .mixers = { alc262_base_mixer }, |
| 10367 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10368 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10369 | .dac_nids = alc262_dac_nids, |
| 10370 | .hp_nid = 0x03, |
| 10371 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10372 | .channel_mode = alc262_modes, |
| 10373 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10374 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10375 | [ALC262_SONY_ASSAMD] = { |
| 10376 | .mixers = { alc262_sony_mixer }, |
| 10377 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10378 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10379 | .dac_nids = alc262_dac_nids, |
| 10380 | .hp_nid = 0x02, |
| 10381 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10382 | .channel_mode = alc262_modes, |
| 10383 | .input_mux = &alc262_capture_source, |
| 10384 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10385 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10386 | }, |
| 10387 | [ALC262_BENQ_T31] = { |
| 10388 | .mixers = { alc262_benq_t31_mixer }, |
| 10389 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10390 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10391 | .dac_nids = alc262_dac_nids, |
| 10392 | .hp_nid = 0x03, |
| 10393 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10394 | .channel_mode = alc262_modes, |
| 10395 | .input_mux = &alc262_capture_source, |
| 10396 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10397 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10398 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10399 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10400 | .mixers = { alc262_ultra_mixer }, |
| 10401 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10402 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10403 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10404 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10405 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10406 | .channel_mode = alc262_modes, |
| 10407 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10408 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10409 | .capsrc_nids = alc262_capsrc_nids, |
| 10410 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10411 | .unsol_event = alc262_ultra_unsol_event, |
| 10412 | .init_hook = alc262_ultra_automute, |
| 10413 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10414 | [ALC262_LENOVO_3000] = { |
| 10415 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10416 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10417 | alc262_lenovo_3000_unsol_verbs }, |
| 10418 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10419 | .dac_nids = alc262_dac_nids, |
| 10420 | .hp_nid = 0x03, |
| 10421 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10422 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10423 | .channel_mode = alc262_modes, |
| 10424 | .input_mux = &alc262_fujitsu_capture_source, |
| 10425 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10426 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10427 | [ALC262_NEC] = { |
| 10428 | .mixers = { alc262_nec_mixer }, |
| 10429 | .init_verbs = { alc262_nec_verbs }, |
| 10430 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10431 | .dac_nids = alc262_dac_nids, |
| 10432 | .hp_nid = 0x03, |
| 10433 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10434 | .channel_mode = alc262_modes, |
| 10435 | .input_mux = &alc262_capture_source, |
| 10436 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10437 | [ALC262_TOSHIBA_S06] = { |
| 10438 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10439 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10440 | alc262_eapd_verbs }, |
| 10441 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10442 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10443 | .dac_nids = alc262_dac_nids, |
| 10444 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10445 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10446 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10447 | .channel_mode = alc262_modes, |
| 10448 | .input_mux = &alc262_dmic_capture_source, |
| 10449 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10450 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10451 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10452 | [ALC262_TOSHIBA_RX1] = { |
| 10453 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10454 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10455 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10456 | .dac_nids = alc262_dac_nids, |
| 10457 | .hp_nid = 0x03, |
| 10458 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10459 | .channel_mode = alc262_modes, |
| 10460 | .input_mux = &alc262_capture_source, |
| 10461 | .unsol_event = alc262_hippo_unsol_event, |
| 10462 | .init_hook = alc262_hippo_automute, |
| 10463 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10464 | }; |
| 10465 | |
| 10466 | static int patch_alc262(struct hda_codec *codec) |
| 10467 | { |
| 10468 | struct alc_spec *spec; |
| 10469 | int board_config; |
| 10470 | int err; |
| 10471 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10472 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10473 | if (spec == NULL) |
| 10474 | return -ENOMEM; |
| 10475 | |
| 10476 | codec->spec = spec; |
| 10477 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10478 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10479 | * under-run |
| 10480 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10481 | { |
| 10482 | int tmp; |
| 10483 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10484 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10485 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10486 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10487 | } |
| 10488 | #endif |
| 10489 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10490 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10491 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10492 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10493 | alc262_models, |
| 10494 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10495 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10496 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10497 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10498 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10499 | board_config = ALC262_AUTO; |
| 10500 | } |
| 10501 | |
| 10502 | if (board_config == ALC262_AUTO) { |
| 10503 | /* automatic parse from the BIOS config */ |
| 10504 | err = alc262_parse_auto_config(codec); |
| 10505 | if (err < 0) { |
| 10506 | alc_free(codec); |
| 10507 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10508 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10509 | printk(KERN_INFO |
| 10510 | "hda_codec: Cannot set up configuration " |
| 10511 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10512 | board_config = ALC262_BASIC; |
| 10513 | } |
| 10514 | } |
| 10515 | |
| 10516 | if (board_config != ALC262_AUTO) |
| 10517 | setup_preset(spec, &alc262_presets[board_config]); |
| 10518 | |
| 10519 | spec->stream_name_analog = "ALC262 Analog"; |
| 10520 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10521 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10522 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10523 | spec->stream_name_digital = "ALC262 Digital"; |
| 10524 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10525 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10526 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10527 | spec->is_mix_capture = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10528 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10529 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10530 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10531 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10532 | /* get type */ |
| 10533 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10534 | if (wcap != AC_WID_AUD_IN) { |
| 10535 | spec->adc_nids = alc262_adc_nids_alt; |
| 10536 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10537 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10538 | } else { |
| 10539 | spec->adc_nids = alc262_adc_nids; |
| 10540 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10541 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10542 | } |
| 10543 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10544 | if (!spec->cap_mixer) |
| 10545 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10546 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10547 | spec->vmaster_nid = 0x0c; |
| 10548 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10549 | codec->patch_ops = alc_patch_ops; |
| 10550 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10551 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10552 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10553 | if (!spec->loopback.amplist) |
| 10554 | spec->loopback.amplist = alc262_loopbacks; |
| 10555 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10556 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10557 | return 0; |
| 10558 | } |
| 10559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10560 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10561 | * ALC268 channel source setting (2 channel) |
| 10562 | */ |
| 10563 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10564 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10565 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10566 | static hda_nid_t alc268_dac_nids[2] = { |
| 10567 | /* front, hp */ |
| 10568 | 0x02, 0x03 |
| 10569 | }; |
| 10570 | |
| 10571 | static hda_nid_t alc268_adc_nids[2] = { |
| 10572 | /* ADC0-1 */ |
| 10573 | 0x08, 0x07 |
| 10574 | }; |
| 10575 | |
| 10576 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10577 | /* ADC0 */ |
| 10578 | 0x08 |
| 10579 | }; |
| 10580 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10581 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10582 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10583 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10584 | /* output mixer control */ |
| 10585 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10586 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10587 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10588 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10589 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10590 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10591 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10592 | { } |
| 10593 | }; |
| 10594 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10595 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10596 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10597 | .ops = &snd_hda_bind_sw, |
| 10598 | .values = { |
| 10599 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10600 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10601 | 0 |
| 10602 | }, |
| 10603 | }; |
| 10604 | |
| 10605 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10606 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10607 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10608 | { } |
| 10609 | }; |
| 10610 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10611 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10612 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10613 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10614 | { } |
| 10615 | }; |
| 10616 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10617 | /* Toshiba specific */ |
| 10618 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10619 | |
| 10620 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10621 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10622 | { } /* end */ |
| 10623 | }; |
| 10624 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10625 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 10626 | .num_items = 2, |
| 10627 | .items = { |
| 10628 | { "i-Mic", 0x6 }, |
| 10629 | { "E-Mic", 0x0 }, |
| 10630 | }, |
| 10631 | }; |
| 10632 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10633 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10634 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10635 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10636 | .ops = &snd_hda_bind_vol, |
| 10637 | .values = { |
| 10638 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10639 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10640 | 0 |
| 10641 | }, |
| 10642 | }; |
| 10643 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10644 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10645 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10646 | { |
| 10647 | struct alc_spec *spec = codec->spec; |
| 10648 | unsigned int mute; |
| 10649 | |
| 10650 | if (force || !spec->sense_updated) { |
| 10651 | unsigned int present; |
| 10652 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10653 | AC_VERB_GET_PIN_SENSE, 0); |
| 10654 | spec->jack_present = (present & 0x80000000) != 0; |
| 10655 | spec->sense_updated = 1; |
| 10656 | } |
| 10657 | if (spec->jack_present) |
| 10658 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10659 | else /* unmute internal speaker if necessary */ |
| 10660 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10661 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10662 | HDA_AMP_MUTE, mute); |
| 10663 | } |
| 10664 | |
| 10665 | |
| 10666 | /* bind hp and internal speaker mute (with plug check) */ |
| 10667 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10668 | struct snd_ctl_elem_value *ucontrol) |
| 10669 | { |
| 10670 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10671 | long *valp = ucontrol->value.integer.value; |
| 10672 | int change; |
| 10673 | |
| 10674 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10675 | HDA_AMP_MUTE, |
| 10676 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10677 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10678 | HDA_AMP_MUTE, |
| 10679 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10680 | if (change) |
| 10681 | alc268_acer_automute(codec, 0); |
| 10682 | return change; |
| 10683 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10684 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10685 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 10686 | /* output mixer control */ |
| 10687 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10688 | { |
| 10689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10690 | .name = "Master Playback Switch", |
| 10691 | .info = snd_hda_mixer_amp_switch_info, |
| 10692 | .get = snd_hda_mixer_amp_switch_get, |
| 10693 | .put = alc268_acer_master_sw_put, |
| 10694 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10695 | }, |
| 10696 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 10697 | { } |
| 10698 | }; |
| 10699 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10700 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10701 | /* output mixer control */ |
| 10702 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10703 | { |
| 10704 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10705 | .name = "Master Playback Switch", |
| 10706 | .info = snd_hda_mixer_amp_switch_info, |
| 10707 | .get = snd_hda_mixer_amp_switch_get, |
| 10708 | .put = alc268_acer_master_sw_put, |
| 10709 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10710 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10711 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10712 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10713 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10714 | { } |
| 10715 | }; |
| 10716 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10717 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 10718 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10720 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10721 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10722 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 10723 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 10724 | { } |
| 10725 | }; |
| 10726 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10727 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10728 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10729 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10730 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10732 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10733 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10734 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10735 | { } |
| 10736 | }; |
| 10737 | |
| 10738 | /* unsolicited event for HP jack sensing */ |
| 10739 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10740 | unsigned int res) |
| 10741 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10742 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10743 | return; |
| 10744 | alc268_toshiba_automute(codec); |
| 10745 | } |
| 10746 | |
| 10747 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10748 | unsigned int res) |
| 10749 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10750 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10751 | return; |
| 10752 | alc268_acer_automute(codec, 1); |
| 10753 | } |
| 10754 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10755 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10756 | { |
| 10757 | alc268_acer_automute(codec, 1); |
| 10758 | } |
| 10759 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10760 | /* toggle speaker-output according to the hp-jack state */ |
| 10761 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 10762 | { |
| 10763 | unsigned int present; |
| 10764 | unsigned char bits; |
| 10765 | |
| 10766 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10767 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10768 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 10769 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 10770 | AMP_IN_MUTE(0), bits); |
| 10771 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 10772 | AMP_IN_MUTE(0), bits); |
| 10773 | } |
| 10774 | |
| 10775 | |
| 10776 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 10777 | { |
| 10778 | unsigned int present; |
| 10779 | |
| 10780 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10781 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10782 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 10783 | present ? 0x0 : 0x6); |
| 10784 | } |
| 10785 | |
| 10786 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 10787 | unsigned int res) |
| 10788 | { |
| 10789 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10790 | alc268_aspire_one_speaker_automute(codec); |
| 10791 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10792 | alc268_acer_mic_automute(codec); |
| 10793 | } |
| 10794 | |
| 10795 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 10796 | { |
| 10797 | alc268_aspire_one_speaker_automute(codec); |
| 10798 | alc268_acer_mic_automute(codec); |
| 10799 | } |
| 10800 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10801 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10802 | /* output mixer control */ |
| 10803 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10804 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10805 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10806 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10807 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10808 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10809 | { } |
| 10810 | }; |
| 10811 | |
| 10812 | static struct hda_verb alc268_dell_verbs[] = { |
| 10813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10815 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10816 | { } |
| 10817 | }; |
| 10818 | |
| 10819 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10820 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10821 | { |
| 10822 | unsigned int present; |
| 10823 | unsigned int mute; |
| 10824 | |
| 10825 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10826 | if (present & 0x80000000) |
| 10827 | mute = HDA_AMP_MUTE; |
| 10828 | else |
| 10829 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10830 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10831 | HDA_AMP_MUTE, mute); |
| 10832 | } |
| 10833 | |
| 10834 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10835 | unsigned int res) |
| 10836 | { |
| 10837 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10838 | return; |
| 10839 | alc268_dell_automute(codec); |
| 10840 | } |
| 10841 | |
| 10842 | #define alc268_dell_init_hook alc268_dell_automute |
| 10843 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10844 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10845 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10846 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10847 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10848 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10849 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10850 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10851 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10852 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10853 | { } |
| 10854 | }; |
| 10855 | |
| 10856 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10857 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10858 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10859 | { } |
| 10860 | }; |
| 10861 | |
| 10862 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10863 | { |
| 10864 | unsigned int present; |
| 10865 | |
| 10866 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10867 | & AC_PINSENSE_PRESENCE; |
| 10868 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10869 | present ? 0 : PIN_OUT); |
| 10870 | } |
| 10871 | |
| 10872 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10873 | { |
| 10874 | unsigned int present; |
| 10875 | |
| 10876 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10877 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10878 | snd_hda_codec_write(codec, 0x23, 0, |
| 10879 | AC_VERB_SET_CONNECT_SEL, |
| 10880 | present ? 0x00 : 0x01); |
| 10881 | } |
| 10882 | |
| 10883 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10884 | { |
| 10885 | alc267_quanta_il1_hp_automute(codec); |
| 10886 | alc267_quanta_il1_mic_automute(codec); |
| 10887 | } |
| 10888 | |
| 10889 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10890 | unsigned int res) |
| 10891 | { |
| 10892 | switch (res >> 26) { |
| 10893 | case ALC880_HP_EVENT: |
| 10894 | alc267_quanta_il1_hp_automute(codec); |
| 10895 | break; |
| 10896 | case ALC880_MIC_EVENT: |
| 10897 | alc267_quanta_il1_mic_automute(codec); |
| 10898 | break; |
| 10899 | } |
| 10900 | } |
| 10901 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10902 | /* |
| 10903 | * generic initialization of ADC, input mixers and output mixers |
| 10904 | */ |
| 10905 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10906 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10907 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10908 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10909 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10910 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10911 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10912 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10913 | |
| 10914 | /* |
| 10915 | * Set up output mixers (0x0c - 0x0e) |
| 10916 | */ |
| 10917 | /* set vol=0 to output mixers */ |
| 10918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10920 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10921 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10922 | |
| 10923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10924 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10925 | |
| 10926 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10928 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10930 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10931 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10932 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10933 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10934 | |
| 10935 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10936 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10937 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10938 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10939 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10940 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10941 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10942 | |
| 10943 | /* set PCBEEP vol = 0, mute connections */ |
| 10944 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10945 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10946 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10947 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10948 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10949 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10950 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10951 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10952 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10953 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10954 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10955 | { } |
| 10956 | }; |
| 10957 | |
| 10958 | /* |
| 10959 | * generic initialization of ADC, input mixers and output mixers |
| 10960 | */ |
| 10961 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10962 | /* set output DAC */ |
| 10963 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10964 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10965 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10966 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10967 | |
| 10968 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10969 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10970 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10971 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10972 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10973 | |
| 10974 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10975 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10976 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10977 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10978 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10979 | |
| 10980 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10982 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10983 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10984 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10985 | /* set PCBEEP vol = 0, mute connections */ |
| 10986 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10987 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10988 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10989 | |
| 10990 | { } |
| 10991 | }; |
| 10992 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10993 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10994 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10995 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10996 | { |
| 10997 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10998 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10999 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11000 | */ |
| 11001 | /* .name = "Capture Source", */ |
| 11002 | .name = "Input Source", |
| 11003 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11004 | .info = alc_mux_enum_info, |
| 11005 | .get = alc_mux_enum_get, |
| 11006 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11007 | }, |
| 11008 | { } /* end */ |
| 11009 | }; |
| 11010 | |
| 11011 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11012 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11013 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11014 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11015 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11016 | { |
| 11017 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11018 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11019 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11020 | */ |
| 11021 | /* .name = "Capture Source", */ |
| 11022 | .name = "Input Source", |
| 11023 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11024 | .info = alc_mux_enum_info, |
| 11025 | .get = alc_mux_enum_get, |
| 11026 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11027 | }, |
| 11028 | { } /* end */ |
| 11029 | }; |
| 11030 | |
| 11031 | static struct hda_input_mux alc268_capture_source = { |
| 11032 | .num_items = 4, |
| 11033 | .items = { |
| 11034 | { "Mic", 0x0 }, |
| 11035 | { "Front Mic", 0x1 }, |
| 11036 | { "Line", 0x2 }, |
| 11037 | { "CD", 0x3 }, |
| 11038 | }, |
| 11039 | }; |
| 11040 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11041 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11042 | .num_items = 3, |
| 11043 | .items = { |
| 11044 | { "Mic", 0x0 }, |
| 11045 | { "Internal Mic", 0x6 }, |
| 11046 | { "Line", 0x2 }, |
| 11047 | }, |
| 11048 | }; |
| 11049 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11050 | #ifdef CONFIG_SND_DEBUG |
| 11051 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11052 | /* Volume widgets */ |
| 11053 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11054 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11055 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11056 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11057 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11058 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11059 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11060 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11061 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11062 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11063 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11064 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11065 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11066 | /* The below appears problematic on some hardwares */ |
| 11067 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11068 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11069 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11070 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11071 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11072 | |
| 11073 | /* Modes for retasking pin widgets */ |
| 11074 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11075 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11076 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11077 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11078 | |
| 11079 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11080 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11081 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11082 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11083 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11084 | |
| 11085 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11086 | * The ALC268 does not have an SPDIF input. |
| 11087 | */ |
| 11088 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11089 | |
| 11090 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11091 | * this output to turn on an external amplifier. |
| 11092 | */ |
| 11093 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11094 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11095 | |
| 11096 | { } /* end */ |
| 11097 | }; |
| 11098 | #endif |
| 11099 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11100 | /* create input playback/capture controls for the given pin */ |
| 11101 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11102 | const char *ctlname, int idx) |
| 11103 | { |
| 11104 | char name[32]; |
| 11105 | int err; |
| 11106 | |
| 11107 | sprintf(name, "%s Playback Volume", ctlname); |
| 11108 | if (nid == 0x14) { |
| 11109 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11110 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11111 | HDA_OUTPUT)); |
| 11112 | if (err < 0) |
| 11113 | return err; |
| 11114 | } else if (nid == 0x15) { |
| 11115 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11116 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11117 | HDA_OUTPUT)); |
| 11118 | if (err < 0) |
| 11119 | return err; |
| 11120 | } else |
| 11121 | return -1; |
| 11122 | sprintf(name, "%s Playback Switch", ctlname); |
| 11123 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11124 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11125 | if (err < 0) |
| 11126 | return err; |
| 11127 | return 0; |
| 11128 | } |
| 11129 | |
| 11130 | /* add playback controls from the parsed DAC table */ |
| 11131 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11132 | const struct auto_pin_cfg *cfg) |
| 11133 | { |
| 11134 | hda_nid_t nid; |
| 11135 | int err; |
| 11136 | |
| 11137 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11138 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11139 | spec->multiout.dac_nids[0] = 2; |
| 11140 | spec->multiout.dac_nids[1] = 3; |
| 11141 | |
| 11142 | nid = cfg->line_out_pins[0]; |
| 11143 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11144 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11145 | |
| 11146 | nid = cfg->speaker_pins[0]; |
| 11147 | if (nid == 0x1d) { |
| 11148 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11149 | "Speaker Playback Volume", |
| 11150 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11151 | if (err < 0) |
| 11152 | return err; |
| 11153 | } |
| 11154 | nid = cfg->hp_pins[0]; |
| 11155 | if (nid) |
| 11156 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11157 | |
| 11158 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11159 | if (nid == 0x16) { |
| 11160 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11161 | "Mono Playback Switch", |
| 11162 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11163 | if (err < 0) |
| 11164 | return err; |
| 11165 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11166 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11167 | } |
| 11168 | |
| 11169 | /* create playback/capture controls for input pins */ |
| 11170 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11171 | const struct auto_pin_cfg *cfg) |
| 11172 | { |
| 11173 | struct hda_input_mux *imux = &spec->private_imux; |
| 11174 | int i, idx1; |
| 11175 | |
| 11176 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11177 | switch(cfg->input_pins[i]) { |
| 11178 | case 0x18: |
| 11179 | idx1 = 0; /* Mic 1 */ |
| 11180 | break; |
| 11181 | case 0x19: |
| 11182 | idx1 = 1; /* Mic 2 */ |
| 11183 | break; |
| 11184 | case 0x1a: |
| 11185 | idx1 = 2; /* Line In */ |
| 11186 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11187 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11188 | idx1 = 3; /* CD */ |
| 11189 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11190 | case 0x12: |
| 11191 | case 0x13: |
| 11192 | idx1 = 6; /* digital mics */ |
| 11193 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11194 | default: |
| 11195 | continue; |
| 11196 | } |
| 11197 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11198 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11199 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11200 | } |
| 11201 | return 0; |
| 11202 | } |
| 11203 | |
| 11204 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11205 | { |
| 11206 | struct alc_spec *spec = codec->spec; |
| 11207 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11208 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11209 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11210 | unsigned int dac_vol1, dac_vol2; |
| 11211 | |
| 11212 | if (speaker_nid) { |
| 11213 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11214 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11215 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11216 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11217 | AMP_IN_UNMUTE(1)); |
| 11218 | snd_hda_codec_write(codec, 0x10, 0, |
| 11219 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11220 | AMP_IN_UNMUTE(1)); |
| 11221 | } else { |
| 11222 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11223 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11224 | snd_hda_codec_write(codec, 0x10, 0, |
| 11225 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11226 | } |
| 11227 | |
| 11228 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11229 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11230 | dac_vol2 = AMP_OUT_ZERO; |
| 11231 | else if (line_nid == 0x15) |
| 11232 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11233 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11234 | dac_vol2 = AMP_OUT_ZERO; |
| 11235 | else if (hp_nid == 0x15) |
| 11236 | dac_vol1 = AMP_OUT_ZERO; |
| 11237 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11238 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11239 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11240 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11241 | |
| 11242 | snd_hda_codec_write(codec, 0x02, 0, |
| 11243 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11244 | snd_hda_codec_write(codec, 0x03, 0, |
| 11245 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11246 | } |
| 11247 | |
| 11248 | /* pcm configuration: identiacal with ALC880 */ |
| 11249 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11250 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11251 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11252 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11253 | |
| 11254 | /* |
| 11255 | * BIOS auto configuration |
| 11256 | */ |
| 11257 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11258 | { |
| 11259 | struct alc_spec *spec = codec->spec; |
| 11260 | int err; |
| 11261 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11262 | |
| 11263 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11264 | alc268_ignore); |
| 11265 | if (err < 0) |
| 11266 | return err; |
| 11267 | if (!spec->autocfg.line_outs) |
| 11268 | return 0; /* can't find valid BIOS pin config */ |
| 11269 | |
| 11270 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11271 | if (err < 0) |
| 11272 | return err; |
| 11273 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11274 | if (err < 0) |
| 11275 | return err; |
| 11276 | |
| 11277 | spec->multiout.max_channels = 2; |
| 11278 | |
| 11279 | /* digital only support output */ |
| 11280 | if (spec->autocfg.dig_out_pin) |
| 11281 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11282 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11283 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11284 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11285 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11286 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11287 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11288 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11289 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11290 | spec->num_mux_defs = 1; |
| 11291 | spec->input_mux = &spec->private_imux; |
| 11292 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11293 | err = alc_auto_add_mic_boost(codec); |
| 11294 | if (err < 0) |
| 11295 | return err; |
| 11296 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 11297 | store_pin_configs(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11298 | return 1; |
| 11299 | } |
| 11300 | |
| 11301 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11302 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11303 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11304 | |
| 11305 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11306 | static void alc268_auto_init(struct hda_codec *codec) |
| 11307 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11308 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11309 | alc268_auto_init_multi_out(codec); |
| 11310 | alc268_auto_init_hp_out(codec); |
| 11311 | alc268_auto_init_mono_speaker_out(codec); |
| 11312 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11313 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11314 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11315 | } |
| 11316 | |
| 11317 | /* |
| 11318 | * configuration and preset |
| 11319 | */ |
| 11320 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11321 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11322 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11323 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11324 | [ALC268_ACER] = "acer", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11325 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11326 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11327 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11328 | #ifdef CONFIG_SND_DEBUG |
| 11329 | [ALC268_TEST] = "test", |
| 11330 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11331 | [ALC268_AUTO] = "auto", |
| 11332 | }; |
| 11333 | |
| 11334 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11335 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11336 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11337 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11338 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11339 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11340 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11341 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11342 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11343 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11344 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11345 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11346 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11347 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11348 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11349 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11350 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11351 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11352 | {} |
| 11353 | }; |
| 11354 | |
| 11355 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11356 | [ALC267_QUANTA_IL1] = { |
| 11357 | .mixers = { alc267_quanta_il1_mixer }, |
| 11358 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11359 | alc267_quanta_il1_verbs }, |
| 11360 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11361 | .dac_nids = alc268_dac_nids, |
| 11362 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11363 | .adc_nids = alc268_adc_nids_alt, |
| 11364 | .hp_nid = 0x03, |
| 11365 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11366 | .channel_mode = alc268_modes, |
| 11367 | .input_mux = &alc268_capture_source, |
| 11368 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11369 | .init_hook = alc267_quanta_il1_automute, |
| 11370 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11371 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11372 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11373 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11374 | .init_verbs = { alc268_base_init_verbs }, |
| 11375 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11376 | .dac_nids = alc268_dac_nids, |
| 11377 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11378 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11379 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11380 | .hp_nid = 0x03, |
| 11381 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11382 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11383 | .channel_mode = alc268_modes, |
| 11384 | .input_mux = &alc268_capture_source, |
| 11385 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11386 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11387 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11388 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11389 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11390 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11391 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11392 | .dac_nids = alc268_dac_nids, |
| 11393 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11394 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11395 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11396 | .hp_nid = 0x03, |
| 11397 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11398 | .channel_mode = alc268_modes, |
| 11399 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11400 | .unsol_event = alc268_toshiba_unsol_event, |
| 11401 | .init_hook = alc268_toshiba_automute, |
| 11402 | }, |
| 11403 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11404 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11405 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11406 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11407 | alc268_acer_verbs }, |
| 11408 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11409 | .dac_nids = alc268_dac_nids, |
| 11410 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11411 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11412 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11413 | .hp_nid = 0x02, |
| 11414 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11415 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11416 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11417 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11418 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11419 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11420 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11421 | .mixers = { alc268_acer_aspire_one_mixer, |
| 11422 | alc268_capture_alt_mixer }, |
| 11423 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11424 | alc268_acer_aspire_one_verbs }, |
| 11425 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11426 | .dac_nids = alc268_dac_nids, |
| 11427 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11428 | .adc_nids = alc268_adc_nids_alt, |
| 11429 | .capsrc_nids = alc268_capsrc_nids, |
| 11430 | .hp_nid = 0x03, |
| 11431 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11432 | .channel_mode = alc268_modes, |
| 11433 | .input_mux = &alc268_acer_lc_capture_source, |
| 11434 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11435 | .init_hook = alc268_acer_lc_init_hook, |
| 11436 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11437 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11438 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11439 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11440 | alc268_dell_verbs }, |
| 11441 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11442 | .dac_nids = alc268_dac_nids, |
| 11443 | .hp_nid = 0x02, |
| 11444 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11445 | .channel_mode = alc268_modes, |
| 11446 | .unsol_event = alc268_dell_unsol_event, |
| 11447 | .init_hook = alc268_dell_init_hook, |
| 11448 | .input_mux = &alc268_capture_source, |
| 11449 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11450 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11451 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11452 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11453 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11454 | alc268_toshiba_verbs }, |
| 11455 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11456 | .dac_nids = alc268_dac_nids, |
| 11457 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11458 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11459 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11460 | .hp_nid = 0x03, |
| 11461 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11462 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11463 | .channel_mode = alc268_modes, |
| 11464 | .input_mux = &alc268_capture_source, |
| 11465 | .unsol_event = alc268_toshiba_unsol_event, |
| 11466 | .init_hook = alc268_toshiba_automute |
| 11467 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11468 | #ifdef CONFIG_SND_DEBUG |
| 11469 | [ALC268_TEST] = { |
| 11470 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11471 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11472 | alc268_volume_init_verbs }, |
| 11473 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11474 | .dac_nids = alc268_dac_nids, |
| 11475 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11476 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11477 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11478 | .hp_nid = 0x03, |
| 11479 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11480 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11481 | .channel_mode = alc268_modes, |
| 11482 | .input_mux = &alc268_capture_source, |
| 11483 | }, |
| 11484 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11485 | }; |
| 11486 | |
| 11487 | static int patch_alc268(struct hda_codec *codec) |
| 11488 | { |
| 11489 | struct alc_spec *spec; |
| 11490 | int board_config; |
| 11491 | int err; |
| 11492 | |
| 11493 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11494 | if (spec == NULL) |
| 11495 | return -ENOMEM; |
| 11496 | |
| 11497 | codec->spec = spec; |
| 11498 | |
| 11499 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11500 | alc268_models, |
| 11501 | alc268_cfg_tbl); |
| 11502 | |
| 11503 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11504 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11505 | "trying auto-probe from BIOS...\n"); |
| 11506 | board_config = ALC268_AUTO; |
| 11507 | } |
| 11508 | |
| 11509 | if (board_config == ALC268_AUTO) { |
| 11510 | /* automatic parse from the BIOS config */ |
| 11511 | err = alc268_parse_auto_config(codec); |
| 11512 | if (err < 0) { |
| 11513 | alc_free(codec); |
| 11514 | return err; |
| 11515 | } else if (!err) { |
| 11516 | printk(KERN_INFO |
| 11517 | "hda_codec: Cannot set up configuration " |
| 11518 | "from BIOS. Using base mode...\n"); |
| 11519 | board_config = ALC268_3ST; |
| 11520 | } |
| 11521 | } |
| 11522 | |
| 11523 | if (board_config != ALC268_AUTO) |
| 11524 | setup_preset(spec, &alc268_presets[board_config]); |
| 11525 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11526 | if (codec->vendor_id == 0x10ec0267) { |
| 11527 | spec->stream_name_analog = "ALC267 Analog"; |
| 11528 | spec->stream_name_digital = "ALC267 Digital"; |
| 11529 | } else { |
| 11530 | spec->stream_name_analog = "ALC268 Analog"; |
| 11531 | spec->stream_name_digital = "ALC268 Digital"; |
| 11532 | } |
| 11533 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11534 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11535 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11536 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11537 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11538 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11539 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11540 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11541 | /* override the amp caps for beep generator */ |
| 11542 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11543 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11544 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11545 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11546 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11547 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11548 | if (!spec->adc_nids && spec->input_mux) { |
| 11549 | /* check whether NID 0x07 is valid */ |
| 11550 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11551 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11552 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11553 | /* get type */ |
| 11554 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11555 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11556 | spec->adc_nids = alc268_adc_nids_alt; |
| 11557 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11558 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11559 | } else { |
| 11560 | spec->adc_nids = alc268_adc_nids; |
| 11561 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11562 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11563 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11564 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11565 | /* set default input source */ |
| 11566 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11567 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11568 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11569 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11570 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11571 | |
| 11572 | spec->vmaster_nid = 0x02; |
| 11573 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11574 | codec->patch_ops = alc_patch_ops; |
| 11575 | if (board_config == ALC268_AUTO) |
| 11576 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11577 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11578 | return 0; |
| 11579 | } |
| 11580 | |
| 11581 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11582 | * ALC269 channel source setting (2 channel) |
| 11583 | */ |
| 11584 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11585 | |
| 11586 | #define alc269_dac_nids alc260_dac_nids |
| 11587 | |
| 11588 | static hda_nid_t alc269_adc_nids[1] = { |
| 11589 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11590 | 0x08, |
| 11591 | }; |
| 11592 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11593 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 11594 | 0x23, |
| 11595 | }; |
| 11596 | |
| 11597 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 11598 | * not a mux! |
| 11599 | */ |
| 11600 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11601 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11602 | .num_items = 2, |
| 11603 | .items = { |
| 11604 | { "i-Mic", 0x5 }, |
| 11605 | { "e-Mic", 0x0 }, |
| 11606 | }, |
| 11607 | }; |
| 11608 | |
| 11609 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11610 | .num_items = 2, |
| 11611 | .items = { |
| 11612 | { "i-Mic", 0x1 }, |
| 11613 | { "e-Mic", 0x0 }, |
| 11614 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11615 | }; |
| 11616 | |
| 11617 | #define alc269_modes alc260_modes |
| 11618 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11619 | |
| 11620 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11621 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11622 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11623 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11624 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11625 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11626 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11627 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11628 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11629 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11630 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11631 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11632 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11634 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11635 | { } /* end */ |
| 11636 | }; |
| 11637 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11638 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 11639 | /* output mixer control */ |
| 11640 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11641 | { |
| 11642 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11643 | .name = "Master Playback Switch", |
| 11644 | .info = snd_hda_mixer_amp_switch_info, |
| 11645 | .get = snd_hda_mixer_amp_switch_get, |
| 11646 | .put = alc268_acer_master_sw_put, |
| 11647 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11648 | }, |
| 11649 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11650 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11651 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11652 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11653 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11654 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11655 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11656 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11657 | { } |
| 11658 | }; |
| 11659 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11660 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11661 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11662 | .ops = &snd_hda_bind_vol, |
| 11663 | .values = { |
| 11664 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11665 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11666 | 0 |
| 11667 | }, |
| 11668 | }; |
| 11669 | |
| 11670 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11671 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11672 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11673 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11674 | { } /* end */ |
| 11675 | }; |
| 11676 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11677 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11678 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11679 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11680 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 11681 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11682 | { } /* end */ |
| 11683 | }; |
| 11684 | |
| 11685 | /* FSC amilo */ |
| 11686 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 11687 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11689 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11690 | { } /* end */ |
| 11691 | }; |
| 11692 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11693 | /* beep control */ |
| 11694 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 11695 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11696 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 11697 | { } /* end */ |
| 11698 | }; |
| 11699 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11700 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 11701 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11702 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11703 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11704 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11705 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11706 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11707 | { } |
| 11708 | }; |
| 11709 | |
| 11710 | /* toggle speaker-output according to the hp-jack state */ |
| 11711 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 11712 | { |
| 11713 | unsigned int present; |
| 11714 | unsigned char bits; |
| 11715 | |
| 11716 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11717 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11718 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11719 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11720 | AMP_IN_MUTE(0), bits); |
| 11721 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11722 | AMP_IN_MUTE(0), bits); |
| 11723 | |
| 11724 | snd_hda_codec_write(codec, 0x20, 0, |
| 11725 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11726 | snd_hda_codec_write(codec, 0x20, 0, |
| 11727 | AC_VERB_SET_PROC_COEF, 0x680); |
| 11728 | |
| 11729 | snd_hda_codec_write(codec, 0x20, 0, |
| 11730 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11731 | snd_hda_codec_write(codec, 0x20, 0, |
| 11732 | AC_VERB_SET_PROC_COEF, 0x480); |
| 11733 | } |
| 11734 | |
| 11735 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 11736 | { |
| 11737 | unsigned int present; |
| 11738 | |
| 11739 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11740 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11741 | snd_hda_codec_write(codec, 0x23, 0, |
| 11742 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 11743 | } |
| 11744 | |
| 11745 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 11746 | unsigned int res) |
| 11747 | { |
| 11748 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11749 | alc269_quanta_fl1_speaker_automute(codec); |
| 11750 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11751 | alc269_quanta_fl1_mic_automute(codec); |
| 11752 | } |
| 11753 | |
| 11754 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 11755 | { |
| 11756 | alc269_quanta_fl1_speaker_automute(codec); |
| 11757 | alc269_quanta_fl1_mic_automute(codec); |
| 11758 | } |
| 11759 | |
| 11760 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11761 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11762 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 11763 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11764 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 11765 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11766 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11767 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11768 | {} |
| 11769 | }; |
| 11770 | |
| 11771 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 11772 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11773 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11774 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11775 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 11776 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11777 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11778 | {} |
| 11779 | }; |
| 11780 | |
| 11781 | /* toggle speaker-output according to the hp-jack state */ |
| 11782 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 11783 | { |
| 11784 | unsigned int present; |
| 11785 | unsigned char bits; |
| 11786 | |
| 11787 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11788 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11789 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11790 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11791 | AMP_IN_MUTE(0), bits); |
| 11792 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11793 | AMP_IN_MUTE(0), bits); |
| 11794 | } |
| 11795 | |
| 11796 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 11797 | { |
| 11798 | unsigned int present; |
| 11799 | |
| 11800 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11801 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11802 | snd_hda_codec_write(codec, 0x23, 0, |
| 11803 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 11804 | } |
| 11805 | |
| 11806 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 11807 | { |
| 11808 | unsigned int present; |
| 11809 | |
| 11810 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11811 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11812 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11813 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 11814 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11815 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 11816 | } |
| 11817 | |
| 11818 | /* unsolicited event for HP jack sensing */ |
| 11819 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 11820 | unsigned int res) |
| 11821 | { |
| 11822 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11823 | alc269_speaker_automute(codec); |
| 11824 | |
| 11825 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11826 | alc269_eeepc_dmic_automute(codec); |
| 11827 | } |
| 11828 | |
| 11829 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 11830 | { |
| 11831 | alc269_speaker_automute(codec); |
| 11832 | alc269_eeepc_dmic_automute(codec); |
| 11833 | } |
| 11834 | |
| 11835 | /* unsolicited event for HP jack sensing */ |
| 11836 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 11837 | unsigned int res) |
| 11838 | { |
| 11839 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11840 | alc269_speaker_automute(codec); |
| 11841 | |
| 11842 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11843 | alc269_eeepc_amic_automute(codec); |
| 11844 | } |
| 11845 | |
| 11846 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 11847 | { |
| 11848 | alc269_speaker_automute(codec); |
| 11849 | alc269_eeepc_amic_automute(codec); |
| 11850 | } |
| 11851 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11852 | /* |
| 11853 | * generic initialization of ADC, input mixers and output mixers |
| 11854 | */ |
| 11855 | static struct hda_verb alc269_init_verbs[] = { |
| 11856 | /* |
| 11857 | * Unmute ADC0 and set the default input to mic-in |
| 11858 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11859 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11860 | |
| 11861 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 11862 | * analog-loopback mixer widget |
| 11863 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11864 | * front panel mic (mic 2) |
| 11865 | */ |
| 11866 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11867 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11868 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11869 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11870 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11871 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11872 | |
| 11873 | /* |
| 11874 | * Set up output mixers (0x0c - 0x0e) |
| 11875 | */ |
| 11876 | /* set vol=0 to output mixers */ |
| 11877 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11878 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11879 | |
| 11880 | /* set up input amps for analog loopback */ |
| 11881 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11882 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11883 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11884 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11885 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11886 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11887 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11888 | |
| 11889 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11890 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11891 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11892 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11893 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11894 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11895 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11896 | |
| 11897 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11898 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11899 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11900 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11901 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11902 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11903 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11904 | |
| 11905 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11906 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11907 | |
| 11908 | /* FIXME: use matrix-type input source selection */ |
| 11909 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 11910 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11911 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11912 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11913 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11914 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11915 | |
| 11916 | /* set EAPD */ |
| 11917 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11918 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11919 | { } |
| 11920 | }; |
| 11921 | |
| 11922 | /* add playback controls from the parsed DAC table */ |
| 11923 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11924 | const struct auto_pin_cfg *cfg) |
| 11925 | { |
| 11926 | hda_nid_t nid; |
| 11927 | int err; |
| 11928 | |
| 11929 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11930 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11931 | spec->multiout.dac_nids[0] = 2; |
| 11932 | |
| 11933 | nid = cfg->line_out_pins[0]; |
| 11934 | if (nid) { |
| 11935 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11936 | "Front Playback Volume", |
| 11937 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 11938 | if (err < 0) |
| 11939 | return err; |
| 11940 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11941 | "Front Playback Switch", |
| 11942 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11943 | if (err < 0) |
| 11944 | return err; |
| 11945 | } |
| 11946 | |
| 11947 | nid = cfg->speaker_pins[0]; |
| 11948 | if (nid) { |
| 11949 | if (!cfg->line_out_pins[0]) { |
| 11950 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11951 | "Speaker Playback Volume", |
| 11952 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11953 | HDA_OUTPUT)); |
| 11954 | if (err < 0) |
| 11955 | return err; |
| 11956 | } |
| 11957 | if (nid == 0x16) { |
| 11958 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11959 | "Speaker Playback Switch", |
| 11960 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11961 | HDA_OUTPUT)); |
| 11962 | if (err < 0) |
| 11963 | return err; |
| 11964 | } else { |
| 11965 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11966 | "Speaker Playback Switch", |
| 11967 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11968 | HDA_OUTPUT)); |
| 11969 | if (err < 0) |
| 11970 | return err; |
| 11971 | } |
| 11972 | } |
| 11973 | nid = cfg->hp_pins[0]; |
| 11974 | if (nid) { |
| 11975 | /* spec->multiout.hp_nid = 2; */ |
| 11976 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 11977 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11978 | "Headphone Playback Volume", |
| 11979 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11980 | HDA_OUTPUT)); |
| 11981 | if (err < 0) |
| 11982 | return err; |
| 11983 | } |
| 11984 | if (nid == 0x16) { |
| 11985 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11986 | "Headphone Playback Switch", |
| 11987 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11988 | HDA_OUTPUT)); |
| 11989 | if (err < 0) |
| 11990 | return err; |
| 11991 | } else { |
| 11992 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11993 | "Headphone Playback Switch", |
| 11994 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11995 | HDA_OUTPUT)); |
| 11996 | if (err < 0) |
| 11997 | return err; |
| 11998 | } |
| 11999 | } |
| 12000 | return 0; |
| 12001 | } |
| 12002 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12003 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12004 | const struct auto_pin_cfg *cfg) |
| 12005 | { |
| 12006 | int err; |
| 12007 | |
| 12008 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12009 | if (err < 0) |
| 12010 | return err; |
| 12011 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12012 | * because it's under 0x18 |
| 12013 | */ |
| 12014 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12015 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 12016 | struct hda_input_mux *imux = &spec->private_imux; |
| 12017 | imux->items[imux->num_items].label = "Int Mic"; |
| 12018 | imux->items[imux->num_items].index = 0x05; |
| 12019 | imux->num_items++; |
| 12020 | } |
| 12021 | return 0; |
| 12022 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12023 | |
| 12024 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12025 | #define alc269_loopbacks alc880_loopbacks |
| 12026 | #endif |
| 12027 | |
| 12028 | /* pcm configuration: identiacal with ALC880 */ |
| 12029 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12030 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12031 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12032 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12033 | |
| 12034 | /* |
| 12035 | * BIOS auto configuration |
| 12036 | */ |
| 12037 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12038 | { |
| 12039 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12040 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12041 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12042 | |
| 12043 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12044 | alc269_ignore); |
| 12045 | if (err < 0) |
| 12046 | return err; |
| 12047 | |
| 12048 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12049 | if (err < 0) |
| 12050 | return err; |
| 12051 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12052 | if (err < 0) |
| 12053 | return err; |
| 12054 | |
| 12055 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12056 | |
| 12057 | if (spec->autocfg.dig_out_pin) |
| 12058 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12059 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12060 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12061 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12062 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12063 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 12064 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 12065 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 12066 | break; |
| 12067 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12068 | add_mixer(spec, alc269_beep_mixer); |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12069 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12070 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12071 | spec->num_mux_defs = 1; |
| 12072 | spec->input_mux = &spec->private_imux; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12073 | /* set default input source */ |
| 12074 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12075 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12076 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12077 | |
| 12078 | err = alc_auto_add_mic_boost(codec); |
| 12079 | if (err < 0) |
| 12080 | return err; |
| 12081 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12082 | if (!spec->cap_mixer) |
| 12083 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12084 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 12085 | store_pin_configs(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12086 | return 1; |
| 12087 | } |
| 12088 | |
| 12089 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12090 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12091 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12092 | |
| 12093 | |
| 12094 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12095 | static void alc269_auto_init(struct hda_codec *codec) |
| 12096 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12097 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12098 | alc269_auto_init_multi_out(codec); |
| 12099 | alc269_auto_init_hp_out(codec); |
| 12100 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12101 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12102 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12103 | } |
| 12104 | |
| 12105 | /* |
| 12106 | * configuration and preset |
| 12107 | */ |
| 12108 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12109 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12110 | [ALC269_QUANTA_FL1] = "quanta", |
| 12111 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12112 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
| 12113 | [ALC269_FUJITSU] = "fujitsu" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12114 | }; |
| 12115 | |
| 12116 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12117 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12118 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12119 | ALC269_ASUS_EEEPC_P703), |
| 12120 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12121 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12122 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12123 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12124 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12125 | {} |
| 12126 | }; |
| 12127 | |
| 12128 | static struct alc_config_preset alc269_presets[] = { |
| 12129 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12130 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12131 | .init_verbs = { alc269_init_verbs }, |
| 12132 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12133 | .dac_nids = alc269_dac_nids, |
| 12134 | .hp_nid = 0x03, |
| 12135 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12136 | .channel_mode = alc269_modes, |
| 12137 | .input_mux = &alc269_capture_source, |
| 12138 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12139 | [ALC269_QUANTA_FL1] = { |
| 12140 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12141 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12142 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12143 | .dac_nids = alc269_dac_nids, |
| 12144 | .hp_nid = 0x03, |
| 12145 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12146 | .channel_mode = alc269_modes, |
| 12147 | .input_mux = &alc269_capture_source, |
| 12148 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12149 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12150 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12151 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12152 | .mixers = { alc269_eeepc_mixer }, |
| 12153 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12154 | .init_verbs = { alc269_init_verbs, |
| 12155 | alc269_eeepc_amic_init_verbs }, |
| 12156 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12157 | .dac_nids = alc269_dac_nids, |
| 12158 | .hp_nid = 0x03, |
| 12159 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12160 | .channel_mode = alc269_modes, |
| 12161 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12162 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12163 | .init_hook = alc269_eeepc_amic_inithook, |
| 12164 | }, |
| 12165 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12166 | .mixers = { alc269_eeepc_mixer }, |
| 12167 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12168 | .init_verbs = { alc269_init_verbs, |
| 12169 | alc269_eeepc_dmic_init_verbs }, |
| 12170 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12171 | .dac_nids = alc269_dac_nids, |
| 12172 | .hp_nid = 0x03, |
| 12173 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12174 | .channel_mode = alc269_modes, |
| 12175 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12176 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12177 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12178 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12179 | [ALC269_FUJITSU] = { |
| 12180 | .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer }, |
| 12181 | .cap_mixer = alc269_epc_capture_mixer, |
| 12182 | .init_verbs = { alc269_init_verbs, |
| 12183 | alc269_eeepc_dmic_init_verbs }, |
| 12184 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12185 | .dac_nids = alc269_dac_nids, |
| 12186 | .hp_nid = 0x03, |
| 12187 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12188 | .channel_mode = alc269_modes, |
| 12189 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12190 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12191 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12192 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12193 | }; |
| 12194 | |
| 12195 | static int patch_alc269(struct hda_codec *codec) |
| 12196 | { |
| 12197 | struct alc_spec *spec; |
| 12198 | int board_config; |
| 12199 | int err; |
| 12200 | |
| 12201 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12202 | if (spec == NULL) |
| 12203 | return -ENOMEM; |
| 12204 | |
| 12205 | codec->spec = spec; |
| 12206 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12207 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12208 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12209 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12210 | alc269_models, |
| 12211 | alc269_cfg_tbl); |
| 12212 | |
| 12213 | if (board_config < 0) { |
| 12214 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12215 | "trying auto-probe from BIOS...\n"); |
| 12216 | board_config = ALC269_AUTO; |
| 12217 | } |
| 12218 | |
| 12219 | if (board_config == ALC269_AUTO) { |
| 12220 | /* automatic parse from the BIOS config */ |
| 12221 | err = alc269_parse_auto_config(codec); |
| 12222 | if (err < 0) { |
| 12223 | alc_free(codec); |
| 12224 | return err; |
| 12225 | } else if (!err) { |
| 12226 | printk(KERN_INFO |
| 12227 | "hda_codec: Cannot set up configuration " |
| 12228 | "from BIOS. Using base mode...\n"); |
| 12229 | board_config = ALC269_BASIC; |
| 12230 | } |
| 12231 | } |
| 12232 | |
| 12233 | if (board_config != ALC269_AUTO) |
| 12234 | setup_preset(spec, &alc269_presets[board_config]); |
| 12235 | |
| 12236 | spec->stream_name_analog = "ALC269 Analog"; |
| 12237 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12238 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12239 | |
| 12240 | spec->stream_name_digital = "ALC269 Digital"; |
| 12241 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12242 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12243 | |
| 12244 | spec->adc_nids = alc269_adc_nids; |
| 12245 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12246 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12247 | if (!spec->cap_mixer) |
| 12248 | set_capture_mixer(spec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12249 | |
| 12250 | codec->patch_ops = alc_patch_ops; |
| 12251 | if (board_config == ALC269_AUTO) |
| 12252 | spec->init_hook = alc269_auto_init; |
| 12253 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12254 | if (!spec->loopback.amplist) |
| 12255 | spec->loopback.amplist = alc269_loopbacks; |
| 12256 | #endif |
| 12257 | |
| 12258 | return 0; |
| 12259 | } |
| 12260 | |
| 12261 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12262 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12263 | */ |
| 12264 | |
| 12265 | /* |
| 12266 | * set the path ways for 2 channel output |
| 12267 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12268 | */ |
| 12269 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12270 | /* set pin widget 1Ah (line in) for input */ |
| 12271 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12272 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12273 | * the vref |
| 12274 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12275 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12276 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12277 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12278 | #if 0 |
| 12279 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12280 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12281 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12282 | { } /* end */ |
| 12283 | }; |
| 12284 | /* |
| 12285 | * 6ch mode |
| 12286 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12287 | */ |
| 12288 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12289 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12290 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12291 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12292 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12293 | |
| 12294 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12295 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12296 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12297 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12298 | #if 0 |
| 12299 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12300 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12301 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12302 | { } /* end */ |
| 12303 | }; |
| 12304 | |
| 12305 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 12306 | { 2, alc861_threestack_ch2_init }, |
| 12307 | { 6, alc861_threestack_ch6_init }, |
| 12308 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12309 | /* Set mic1 as input and unmute the mixer */ |
| 12310 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 12311 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12312 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12313 | { } /* end */ |
| 12314 | }; |
| 12315 | /* Set mic1 as output and mute mixer */ |
| 12316 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 12317 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12318 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12319 | { } /* end */ |
| 12320 | }; |
| 12321 | |
| 12322 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 12323 | { 2, alc861_uniwill_m31_ch2_init }, |
| 12324 | { 4, alc861_uniwill_m31_ch4_init }, |
| 12325 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12326 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12327 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 12328 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 12329 | /* set pin widget 1Ah (line in) for input */ |
| 12330 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12331 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12332 | * the vref |
| 12333 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12334 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12335 | |
| 12336 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12337 | #if 0 |
| 12338 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12339 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12340 | #endif |
| 12341 | { } /* end */ |
| 12342 | }; |
| 12343 | /* Set mic1 nad line-in as output and mute mixer */ |
| 12344 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 12345 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12346 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12347 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12348 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12349 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12350 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12351 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12352 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12353 | |
| 12354 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12355 | #if 0 |
| 12356 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12357 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12358 | #endif |
| 12359 | { } /* end */ |
| 12360 | }; |
| 12361 | |
| 12362 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 12363 | { 2, alc861_asus_ch2_init }, |
| 12364 | { 6, alc861_asus_ch6_init }, |
| 12365 | }; |
| 12366 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12367 | /* patch-ALC861 */ |
| 12368 | |
| 12369 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 12370 | /* output mixer control */ |
| 12371 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12372 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12373 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12374 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12375 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12376 | |
| 12377 | /*Input mixer control */ |
| 12378 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12379 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12380 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12381 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12382 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12383 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12384 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12385 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12386 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12387 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12388 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12389 | { } /* end */ |
| 12390 | }; |
| 12391 | |
| 12392 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 12393 | /* output mixer control */ |
| 12394 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12395 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12396 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12397 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12398 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12399 | |
| 12400 | /* Input mixer control */ |
| 12401 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12402 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12404 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12405 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12406 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12407 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12408 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12409 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12410 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12411 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12412 | { |
| 12413 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12414 | .name = "Channel Mode", |
| 12415 | .info = alc_ch_mode_info, |
| 12416 | .get = alc_ch_mode_get, |
| 12417 | .put = alc_ch_mode_put, |
| 12418 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 12419 | }, |
| 12420 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12421 | }; |
| 12422 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12423 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12424 | /* output mixer control */ |
| 12425 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12426 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12427 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12428 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12429 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12430 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12431 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12432 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 12433 | /* output mixer control */ |
| 12434 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12435 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12436 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12437 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12438 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12439 | |
| 12440 | /* Input mixer control */ |
| 12441 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12442 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12443 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12444 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12445 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12446 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12447 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12448 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12449 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12450 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12451 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12452 | { |
| 12453 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12454 | .name = "Channel Mode", |
| 12455 | .info = alc_ch_mode_info, |
| 12456 | .get = alc_ch_mode_get, |
| 12457 | .put = alc_ch_mode_put, |
| 12458 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12459 | }, |
| 12460 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12461 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12462 | |
| 12463 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 12464 | /* output mixer control */ |
| 12465 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12466 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12467 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12468 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12469 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12470 | |
| 12471 | /* Input mixer control */ |
| 12472 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12473 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12474 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12475 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12476 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12477 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12479 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12480 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12481 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 12482 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12483 | { |
| 12484 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12485 | .name = "Channel Mode", |
| 12486 | .info = alc_ch_mode_info, |
| 12487 | .get = alc_ch_mode_get, |
| 12488 | .put = alc_ch_mode_put, |
| 12489 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 12490 | }, |
| 12491 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12492 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12493 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12494 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12495 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12497 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12498 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12499 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12500 | { } |
| 12501 | }; |
| 12502 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12503 | /* |
| 12504 | * generic initialization of ADC, input mixers and output mixers |
| 12505 | */ |
| 12506 | static struct hda_verb alc861_base_init_verbs[] = { |
| 12507 | /* |
| 12508 | * Unmute ADC0 and set the default input to mic-in |
| 12509 | */ |
| 12510 | /* port-A for surround (rear panel) */ |
| 12511 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12512 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12513 | /* port-B for mic-in (rear panel) with vref */ |
| 12514 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12515 | /* port-C for line-in (rear panel) */ |
| 12516 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12517 | /* port-D for Front */ |
| 12518 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12519 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12520 | /* port-E for HP out (front panel) */ |
| 12521 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12522 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12523 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12524 | /* port-F for mic-in (front panel) with vref */ |
| 12525 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12526 | /* port-G for CLFE (rear panel) */ |
| 12527 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12528 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12529 | /* port-H for side (rear panel) */ |
| 12530 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12531 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12532 | /* CD-in */ |
| 12533 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12534 | /* route front mic to ADC1*/ |
| 12535 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12536 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12537 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12538 | /* Unmute DAC0~3 & spdif out*/ |
| 12539 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12540 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12541 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12542 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12544 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12545 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12546 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12547 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12548 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12549 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12550 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12551 | /* Unmute Stereo Mixer 15 */ |
| 12552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12553 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12554 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12555 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12556 | |
| 12557 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12558 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12559 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12560 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12561 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12562 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12563 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12564 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12565 | /* hp used DAC 3 (Front) */ |
| 12566 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12567 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12568 | |
| 12569 | { } |
| 12570 | }; |
| 12571 | |
| 12572 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 12573 | /* |
| 12574 | * Unmute ADC0 and set the default input to mic-in |
| 12575 | */ |
| 12576 | /* port-A for surround (rear panel) */ |
| 12577 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12578 | /* port-B for mic-in (rear panel) with vref */ |
| 12579 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12580 | /* port-C for line-in (rear panel) */ |
| 12581 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12582 | /* port-D for Front */ |
| 12583 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12584 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12585 | /* port-E for HP out (front panel) */ |
| 12586 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12587 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12588 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12589 | /* port-F for mic-in (front panel) with vref */ |
| 12590 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12591 | /* port-G for CLFE (rear panel) */ |
| 12592 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12593 | /* port-H for side (rear panel) */ |
| 12594 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12595 | /* CD-in */ |
| 12596 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12597 | /* route front mic to ADC1*/ |
| 12598 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12599 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12600 | /* Unmute DAC0~3 & spdif out*/ |
| 12601 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12602 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12603 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12604 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12605 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12606 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12607 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12608 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12609 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12610 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12611 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12612 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12613 | /* Unmute Stereo Mixer 15 */ |
| 12614 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12615 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12616 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12617 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12618 | |
| 12619 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12620 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12621 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12622 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12623 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12624 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12625 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12626 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12627 | /* hp used DAC 3 (Front) */ |
| 12628 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12629 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12630 | { } |
| 12631 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12632 | |
| 12633 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 12634 | /* |
| 12635 | * Unmute ADC0 and set the default input to mic-in |
| 12636 | */ |
| 12637 | /* port-A for surround (rear panel) */ |
| 12638 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12639 | /* port-B for mic-in (rear panel) with vref */ |
| 12640 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12641 | /* port-C for line-in (rear panel) */ |
| 12642 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12643 | /* port-D for Front */ |
| 12644 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12645 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12646 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12647 | /* this has to be set to VREF80 */ |
| 12648 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12649 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12650 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12651 | /* port-F for mic-in (front panel) with vref */ |
| 12652 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12653 | /* port-G for CLFE (rear panel) */ |
| 12654 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12655 | /* port-H for side (rear panel) */ |
| 12656 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12657 | /* CD-in */ |
| 12658 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12659 | /* route front mic to ADC1*/ |
| 12660 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12661 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12662 | /* Unmute DAC0~3 & spdif out*/ |
| 12663 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12664 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12665 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12666 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12667 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12668 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12669 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12670 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12671 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12672 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12673 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12674 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12675 | /* Unmute Stereo Mixer 15 */ |
| 12676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12677 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12678 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12680 | |
| 12681 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12682 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12683 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12684 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12685 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12686 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12687 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12688 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12689 | /* hp used DAC 3 (Front) */ |
| 12690 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12691 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12692 | { } |
| 12693 | }; |
| 12694 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12695 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12696 | /* |
| 12697 | * Unmute ADC0 and set the default input to mic-in |
| 12698 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12699 | /* port-A for surround (rear panel) |
| 12700 | * according to codec#0 this is the HP jack |
| 12701 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12702 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12703 | /* route front PCM to HP */ |
| 12704 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12705 | /* port-B for mic-in (rear panel) with vref */ |
| 12706 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12707 | /* port-C for line-in (rear panel) */ |
| 12708 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12709 | /* port-D for Front */ |
| 12710 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12711 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12712 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12713 | /* this has to be set to VREF80 */ |
| 12714 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12715 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12716 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12717 | /* port-F for mic-in (front panel) with vref */ |
| 12718 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12719 | /* port-G for CLFE (rear panel) */ |
| 12720 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12721 | /* port-H for side (rear panel) */ |
| 12722 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12723 | /* CD-in */ |
| 12724 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12725 | /* route front mic to ADC1*/ |
| 12726 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12727 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12728 | /* Unmute DAC0~3 & spdif out*/ |
| 12729 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12730 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12731 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12732 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12733 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12734 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12735 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12736 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12737 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12738 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12739 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12740 | /* Unmute Stereo Mixer 15 */ |
| 12741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12742 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12743 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12745 | |
| 12746 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12748 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12749 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12750 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12752 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12754 | /* hp used DAC 3 (Front) */ |
| 12755 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12756 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12757 | { } |
| 12758 | }; |
| 12759 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12760 | /* additional init verbs for ASUS laptops */ |
| 12761 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 12762 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 12763 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 12764 | { } |
| 12765 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12766 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12767 | /* |
| 12768 | * generic initialization of ADC, input mixers and output mixers |
| 12769 | */ |
| 12770 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 12771 | /* |
| 12772 | * Unmute ADC0 and set the default input to mic-in |
| 12773 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12774 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12775 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12776 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12777 | /* Unmute DAC0~3 & spdif out*/ |
| 12778 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12779 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12780 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12781 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12782 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12784 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12785 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12786 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12787 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12788 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12790 | /* Unmute Stereo Mixer 15 */ |
| 12791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12794 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 12795 | |
| 12796 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12797 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12798 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12799 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12800 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12801 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12802 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12803 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12804 | |
| 12805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12806 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12807 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12808 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12809 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12810 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12811 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12812 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12813 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12814 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12815 | |
| 12816 | { } |
| 12817 | }; |
| 12818 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12819 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 12820 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12821 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12822 | { } |
| 12823 | }; |
| 12824 | |
| 12825 | /* toggle speaker-output according to the hp-jack state */ |
| 12826 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 12827 | { |
| 12828 | unsigned int present; |
| 12829 | |
| 12830 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 12831 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12832 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 12833 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 12834 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 12835 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12836 | } |
| 12837 | |
| 12838 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 12839 | unsigned int res) |
| 12840 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12841 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12842 | alc861_toshiba_automute(codec); |
| 12843 | } |
| 12844 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12845 | /* pcm configuration: identiacal with ALC880 */ |
| 12846 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 12847 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 12848 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 12849 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 12850 | |
| 12851 | |
| 12852 | #define ALC861_DIGOUT_NID 0x07 |
| 12853 | |
| 12854 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 12855 | { 8, NULL } |
| 12856 | }; |
| 12857 | |
| 12858 | static hda_nid_t alc861_dac_nids[4] = { |
| 12859 | /* front, surround, clfe, side */ |
| 12860 | 0x03, 0x06, 0x05, 0x04 |
| 12861 | }; |
| 12862 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12863 | static hda_nid_t alc660_dac_nids[3] = { |
| 12864 | /* front, clfe, surround */ |
| 12865 | 0x03, 0x05, 0x06 |
| 12866 | }; |
| 12867 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12868 | static hda_nid_t alc861_adc_nids[1] = { |
| 12869 | /* ADC0-2 */ |
| 12870 | 0x08, |
| 12871 | }; |
| 12872 | |
| 12873 | static struct hda_input_mux alc861_capture_source = { |
| 12874 | .num_items = 5, |
| 12875 | .items = { |
| 12876 | { "Mic", 0x0 }, |
| 12877 | { "Front Mic", 0x3 }, |
| 12878 | { "Line", 0x1 }, |
| 12879 | { "CD", 0x4 }, |
| 12880 | { "Mixer", 0x5 }, |
| 12881 | }, |
| 12882 | }; |
| 12883 | |
| 12884 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12885 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 12886 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12887 | { |
| 12888 | int i; |
| 12889 | hda_nid_t nid; |
| 12890 | |
| 12891 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12892 | for (i = 0; i < cfg->line_outs; i++) { |
| 12893 | nid = cfg->line_out_pins[i]; |
| 12894 | if (nid) { |
| 12895 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 12896 | continue; |
| 12897 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 12898 | } |
| 12899 | } |
| 12900 | spec->multiout.num_dacs = cfg->line_outs; |
| 12901 | return 0; |
| 12902 | } |
| 12903 | |
| 12904 | /* add playback controls from the parsed DAC table */ |
| 12905 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12906 | const struct auto_pin_cfg *cfg) |
| 12907 | { |
| 12908 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12909 | static const char *chname[4] = { |
| 12910 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 12911 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12912 | hda_nid_t nid; |
| 12913 | int i, idx, err; |
| 12914 | |
| 12915 | for (i = 0; i < cfg->line_outs; i++) { |
| 12916 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12917 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12918 | continue; |
| 12919 | if (nid == 0x05) { |
| 12920 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12921 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12922 | "Center Playback Switch", |
| 12923 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 12924 | HDA_OUTPUT)); |
| 12925 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12926 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12927 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12928 | "LFE Playback Switch", |
| 12929 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12930 | HDA_OUTPUT)); |
| 12931 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12932 | return err; |
| 12933 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12934 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 12935 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12936 | if (nid == alc861_dac_nids[idx]) |
| 12937 | break; |
| 12938 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12939 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12940 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12941 | HDA_OUTPUT)); |
| 12942 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12943 | return err; |
| 12944 | } |
| 12945 | } |
| 12946 | return 0; |
| 12947 | } |
| 12948 | |
| 12949 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 12950 | { |
| 12951 | int err; |
| 12952 | hda_nid_t nid; |
| 12953 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12954 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12955 | return 0; |
| 12956 | |
| 12957 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 12958 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12959 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12960 | "Headphone Playback Switch", |
| 12961 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12962 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12963 | return err; |
| 12964 | spec->multiout.hp_nid = nid; |
| 12965 | } |
| 12966 | return 0; |
| 12967 | } |
| 12968 | |
| 12969 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12970 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12971 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12972 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12973 | struct hda_input_mux *imux = &spec->private_imux; |
| 12974 | int i, err, idx, idx1; |
| 12975 | |
| 12976 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12977 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12978 | case 0x0c: |
| 12979 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12980 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12981 | break; |
| 12982 | case 0x0f: |
| 12983 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12984 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12985 | break; |
| 12986 | case 0x0d: |
| 12987 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12988 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12989 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12990 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12991 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12992 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12993 | break; |
| 12994 | case 0x11: |
| 12995 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12996 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12997 | break; |
| 12998 | default: |
| 12999 | continue; |
| 13000 | } |
| 13001 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13002 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13003 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13004 | if (err < 0) |
| 13005 | return err; |
| 13006 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13007 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13008 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13009 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13010 | } |
| 13011 | return 0; |
| 13012 | } |
| 13013 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13014 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13015 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13016 | int pin_type, int dac_idx) |
| 13017 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13018 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13019 | pin_type); |
| 13020 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13021 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13022 | } |
| 13023 | |
| 13024 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13025 | { |
| 13026 | struct alc_spec *spec = codec->spec; |
| 13027 | int i; |
| 13028 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13029 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13030 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13031 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13032 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13033 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13034 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13035 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13036 | } |
| 13037 | } |
| 13038 | |
| 13039 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13040 | { |
| 13041 | struct alc_spec *spec = codec->spec; |
| 13042 | hda_nid_t pin; |
| 13043 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13044 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13045 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13046 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13047 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13048 | pin = spec->autocfg.speaker_pins[0]; |
| 13049 | if (pin) |
| 13050 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13051 | } |
| 13052 | |
| 13053 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13054 | { |
| 13055 | struct alc_spec *spec = codec->spec; |
| 13056 | int i; |
| 13057 | |
| 13058 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13059 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13060 | if (nid >= 0x0c && nid <= 0x11) { |
| 13061 | snd_hda_codec_write(codec, nid, 0, |
| 13062 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13063 | i <= AUTO_PIN_FRONT_MIC ? |
| 13064 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13065 | } |
| 13066 | } |
| 13067 | } |
| 13068 | |
| 13069 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13070 | /* return 1 if successful, 0 if the proper config is not found, |
| 13071 | * or a negative error code |
| 13072 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13073 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13074 | { |
| 13075 | struct alc_spec *spec = codec->spec; |
| 13076 | int err; |
| 13077 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13078 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13079 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13080 | alc861_ignore); |
| 13081 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13082 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13083 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13084 | return 0; /* can't find valid BIOS pin config */ |
| 13085 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13086 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13087 | if (err < 0) |
| 13088 | return err; |
| 13089 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13090 | if (err < 0) |
| 13091 | return err; |
| 13092 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13093 | if (err < 0) |
| 13094 | return err; |
| 13095 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13096 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13097 | return err; |
| 13098 | |
| 13099 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13100 | |
| 13101 | if (spec->autocfg.dig_out_pin) |
| 13102 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13103 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13104 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13105 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13106 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13107 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13108 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13109 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13110 | spec->input_mux = &spec->private_imux; |
| 13111 | |
| 13112 | spec->adc_nids = alc861_adc_nids; |
| 13113 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13114 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13115 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 13116 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13117 | return 1; |
| 13118 | } |
| 13119 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13120 | /* additional initialization for auto-configuration model */ |
| 13121 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13122 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13123 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13124 | alc861_auto_init_multi_out(codec); |
| 13125 | alc861_auto_init_hp_out(codec); |
| 13126 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13127 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13128 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13129 | } |
| 13130 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13131 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13132 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13133 | { 0x15, HDA_INPUT, 0 }, |
| 13134 | { 0x15, HDA_INPUT, 1 }, |
| 13135 | { 0x15, HDA_INPUT, 2 }, |
| 13136 | { 0x15, HDA_INPUT, 3 }, |
| 13137 | { } /* end */ |
| 13138 | }; |
| 13139 | #endif |
| 13140 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13141 | |
| 13142 | /* |
| 13143 | * configuration and preset |
| 13144 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13145 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13146 | [ALC861_3ST] = "3stack", |
| 13147 | [ALC660_3ST] = "3stack-660", |
| 13148 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13149 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13150 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13151 | [ALC861_TOSHIBA] = "toshiba", |
| 13152 | [ALC861_ASUS] = "asus", |
| 13153 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13154 | [ALC861_AUTO] = "auto", |
| 13155 | }; |
| 13156 | |
| 13157 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13158 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13159 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13160 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13161 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13162 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13163 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13164 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13165 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13166 | * Any other models that need this preset? |
| 13167 | */ |
| 13168 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13169 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13170 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13171 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13172 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13173 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13174 | /* FIXME: the below seems conflict */ |
| 13175 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13176 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13177 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13178 | {} |
| 13179 | }; |
| 13180 | |
| 13181 | static struct alc_config_preset alc861_presets[] = { |
| 13182 | [ALC861_3ST] = { |
| 13183 | .mixers = { alc861_3ST_mixer }, |
| 13184 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13185 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13186 | .dac_nids = alc861_dac_nids, |
| 13187 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13188 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13189 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13190 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13191 | .adc_nids = alc861_adc_nids, |
| 13192 | .input_mux = &alc861_capture_source, |
| 13193 | }, |
| 13194 | [ALC861_3ST_DIG] = { |
| 13195 | .mixers = { alc861_base_mixer }, |
| 13196 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13197 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13198 | .dac_nids = alc861_dac_nids, |
| 13199 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13200 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13201 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13202 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13203 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13204 | .adc_nids = alc861_adc_nids, |
| 13205 | .input_mux = &alc861_capture_source, |
| 13206 | }, |
| 13207 | [ALC861_6ST_DIG] = { |
| 13208 | .mixers = { alc861_base_mixer }, |
| 13209 | .init_verbs = { alc861_base_init_verbs }, |
| 13210 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13211 | .dac_nids = alc861_dac_nids, |
| 13212 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13213 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13214 | .channel_mode = alc861_8ch_modes, |
| 13215 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13216 | .adc_nids = alc861_adc_nids, |
| 13217 | .input_mux = &alc861_capture_source, |
| 13218 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13219 | [ALC660_3ST] = { |
| 13220 | .mixers = { alc861_3ST_mixer }, |
| 13221 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13222 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13223 | .dac_nids = alc660_dac_nids, |
| 13224 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13225 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13226 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13227 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13228 | .adc_nids = alc861_adc_nids, |
| 13229 | .input_mux = &alc861_capture_source, |
| 13230 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13231 | [ALC861_UNIWILL_M31] = { |
| 13232 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13233 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13234 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13235 | .dac_nids = alc861_dac_nids, |
| 13236 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13237 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13238 | .channel_mode = alc861_uniwill_m31_modes, |
| 13239 | .need_dac_fix = 1, |
| 13240 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13241 | .adc_nids = alc861_adc_nids, |
| 13242 | .input_mux = &alc861_capture_source, |
| 13243 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13244 | [ALC861_TOSHIBA] = { |
| 13245 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13246 | .init_verbs = { alc861_base_init_verbs, |
| 13247 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13248 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13249 | .dac_nids = alc861_dac_nids, |
| 13250 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13251 | .channel_mode = alc883_3ST_2ch_modes, |
| 13252 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13253 | .adc_nids = alc861_adc_nids, |
| 13254 | .input_mux = &alc861_capture_source, |
| 13255 | .unsol_event = alc861_toshiba_unsol_event, |
| 13256 | .init_hook = alc861_toshiba_automute, |
| 13257 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13258 | [ALC861_ASUS] = { |
| 13259 | .mixers = { alc861_asus_mixer }, |
| 13260 | .init_verbs = { alc861_asus_init_verbs }, |
| 13261 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13262 | .dac_nids = alc861_dac_nids, |
| 13263 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13264 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13265 | .channel_mode = alc861_asus_modes, |
| 13266 | .need_dac_fix = 1, |
| 13267 | .hp_nid = 0x06, |
| 13268 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13269 | .adc_nids = alc861_adc_nids, |
| 13270 | .input_mux = &alc861_capture_source, |
| 13271 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13272 | [ALC861_ASUS_LAPTOP] = { |
| 13273 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13274 | .init_verbs = { alc861_asus_init_verbs, |
| 13275 | alc861_asus_laptop_init_verbs }, |
| 13276 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13277 | .dac_nids = alc861_dac_nids, |
| 13278 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13279 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13280 | .channel_mode = alc883_3ST_2ch_modes, |
| 13281 | .need_dac_fix = 1, |
| 13282 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13283 | .adc_nids = alc861_adc_nids, |
| 13284 | .input_mux = &alc861_capture_source, |
| 13285 | }, |
| 13286 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13287 | |
| 13288 | |
| 13289 | static int patch_alc861(struct hda_codec *codec) |
| 13290 | { |
| 13291 | struct alc_spec *spec; |
| 13292 | int board_config; |
| 13293 | int err; |
| 13294 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13295 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13296 | if (spec == NULL) |
| 13297 | return -ENOMEM; |
| 13298 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13299 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13300 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13301 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 13302 | alc861_models, |
| 13303 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13304 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13305 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13306 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 13307 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13308 | board_config = ALC861_AUTO; |
| 13309 | } |
| 13310 | |
| 13311 | if (board_config == ALC861_AUTO) { |
| 13312 | /* automatic parse from the BIOS config */ |
| 13313 | err = alc861_parse_auto_config(codec); |
| 13314 | if (err < 0) { |
| 13315 | alc_free(codec); |
| 13316 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13317 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13318 | printk(KERN_INFO |
| 13319 | "hda_codec: Cannot set up configuration " |
| 13320 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13321 | board_config = ALC861_3ST_DIG; |
| 13322 | } |
| 13323 | } |
| 13324 | |
| 13325 | if (board_config != ALC861_AUTO) |
| 13326 | setup_preset(spec, &alc861_presets[board_config]); |
| 13327 | |
| 13328 | spec->stream_name_analog = "ALC861 Analog"; |
| 13329 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 13330 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 13331 | |
| 13332 | spec->stream_name_digital = "ALC861 Digital"; |
| 13333 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 13334 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 13335 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13336 | spec->vmaster_nid = 0x03; |
| 13337 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13338 | codec->patch_ops = alc_patch_ops; |
| 13339 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13340 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13341 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13342 | if (!spec->loopback.amplist) |
| 13343 | spec->loopback.amplist = alc861_loopbacks; |
| 13344 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13345 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13346 | return 0; |
| 13347 | } |
| 13348 | |
| 13349 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13350 | * ALC861-VD support |
| 13351 | * |
| 13352 | * Based on ALC882 |
| 13353 | * |
| 13354 | * In addition, an independent DAC |
| 13355 | */ |
| 13356 | #define ALC861VD_DIGOUT_NID 0x06 |
| 13357 | |
| 13358 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 13359 | /* front, surr, clfe, side surr */ |
| 13360 | 0x02, 0x03, 0x04, 0x05 |
| 13361 | }; |
| 13362 | |
| 13363 | /* dac_nids for ALC660vd are in a different order - according to |
| 13364 | * Realtek's driver. |
| 13365 | * This should probably tesult in a different mixer for 6stack models |
| 13366 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 13367 | * - and it is the same as in 861vd. |
| 13368 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 13369 | */ |
| 13370 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 13371 | /* front, rear, clfe, rear_surr */ |
| 13372 | 0x02, 0x04, 0x03 |
| 13373 | }; |
| 13374 | |
| 13375 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 13376 | /* ADC0 */ |
| 13377 | 0x09, |
| 13378 | }; |
| 13379 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13380 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 13381 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13382 | /* input MUX */ |
| 13383 | /* FIXME: should be a matrix-type input source selection */ |
| 13384 | static struct hda_input_mux alc861vd_capture_source = { |
| 13385 | .num_items = 4, |
| 13386 | .items = { |
| 13387 | { "Mic", 0x0 }, |
| 13388 | { "Front Mic", 0x1 }, |
| 13389 | { "Line", 0x2 }, |
| 13390 | { "CD", 0x4 }, |
| 13391 | }, |
| 13392 | }; |
| 13393 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13394 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13395 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13396 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13397 | { "Ext Mic", 0x0 }, |
| 13398 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13399 | }, |
| 13400 | }; |
| 13401 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13402 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 13403 | .num_items = 2, |
| 13404 | .items = { |
| 13405 | { "Front Mic", 0x0 }, |
| 13406 | { "ATAPI Mic", 0x1 }, |
| 13407 | }, |
| 13408 | }; |
| 13409 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13410 | /* |
| 13411 | * 2ch mode |
| 13412 | */ |
| 13413 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13414 | { 2, NULL } |
| 13415 | }; |
| 13416 | |
| 13417 | /* |
| 13418 | * 6ch mode |
| 13419 | */ |
| 13420 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13421 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13422 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13423 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13424 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13425 | { } /* end */ |
| 13426 | }; |
| 13427 | |
| 13428 | /* |
| 13429 | * 8ch mode |
| 13430 | */ |
| 13431 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13432 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13433 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13434 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13435 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13436 | { } /* end */ |
| 13437 | }; |
| 13438 | |
| 13439 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 13440 | { 6, alc861vd_6stack_ch6_init }, |
| 13441 | { 8, alc861vd_6stack_ch8_init }, |
| 13442 | }; |
| 13443 | |
| 13444 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 13445 | { |
| 13446 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13447 | .name = "Channel Mode", |
| 13448 | .info = alc_ch_mode_info, |
| 13449 | .get = alc_ch_mode_get, |
| 13450 | .put = alc_ch_mode_put, |
| 13451 | }, |
| 13452 | { } /* end */ |
| 13453 | }; |
| 13454 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13455 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13456 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13457 | */ |
| 13458 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 13459 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13460 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13461 | |
| 13462 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13463 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13464 | |
| 13465 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 13466 | HDA_OUTPUT), |
| 13467 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 13468 | HDA_OUTPUT), |
| 13469 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13470 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 13471 | |
| 13472 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 13473 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13474 | |
| 13475 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13476 | |
| 13477 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13479 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13480 | |
| 13481 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13482 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13483 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13484 | |
| 13485 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13486 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13487 | |
| 13488 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13489 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13490 | |
| 13491 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13492 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13493 | |
| 13494 | { } /* end */ |
| 13495 | }; |
| 13496 | |
| 13497 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 13498 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13499 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13500 | |
| 13501 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13502 | |
| 13503 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13504 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13506 | |
| 13507 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13508 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13509 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13510 | |
| 13511 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13512 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13513 | |
| 13514 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13515 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13516 | |
| 13517 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13518 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13519 | |
| 13520 | { } /* end */ |
| 13521 | }; |
| 13522 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13523 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 13524 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13525 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 13526 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13527 | |
| 13528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13529 | |
| 13530 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13531 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13533 | |
| 13534 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13535 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13536 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13537 | |
| 13538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13540 | |
| 13541 | { } /* end */ |
| 13542 | }; |
| 13543 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13544 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 13545 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13546 | */ |
| 13547 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13548 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13549 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13550 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13551 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13552 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13553 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13554 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13555 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13556 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13557 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13558 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 13559 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13560 | { } /* end */ |
| 13561 | }; |
| 13562 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13563 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 13564 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 13565 | */ |
| 13566 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 13567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13568 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13569 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13570 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13571 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13572 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13573 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13574 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13575 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13576 | { } /* end */ |
| 13577 | }; |
| 13578 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13579 | /* |
| 13580 | * generic initialization of ADC, input mixers and output mixers |
| 13581 | */ |
| 13582 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 13583 | /* |
| 13584 | * Unmute ADC0 and set the default input to mic-in |
| 13585 | */ |
| 13586 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13587 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13588 | |
| 13589 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 13590 | * the analog-loopback mixer widget |
| 13591 | */ |
| 13592 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13593 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13594 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13595 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13596 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13597 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13598 | |
| 13599 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13601 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13602 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13603 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13604 | |
| 13605 | /* |
| 13606 | * Set up output mixers (0x02 - 0x05) |
| 13607 | */ |
| 13608 | /* set vol=0 to output mixers */ |
| 13609 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13610 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13611 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13612 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13613 | |
| 13614 | /* set up input amps for analog loopback */ |
| 13615 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13616 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13618 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13620 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13622 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13624 | |
| 13625 | { } |
| 13626 | }; |
| 13627 | |
| 13628 | /* |
| 13629 | * 3-stack pin configuration: |
| 13630 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13631 | */ |
| 13632 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13633 | /* |
| 13634 | * Set pin mode and muting |
| 13635 | */ |
| 13636 | /* set front pin widgets 0x14 for output */ |
| 13637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13638 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13639 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13640 | |
| 13641 | /* Mic (rear) pin: input vref at 80% */ |
| 13642 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13643 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13644 | /* Front Mic pin: input vref at 80% */ |
| 13645 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13646 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13647 | /* Line In pin: input */ |
| 13648 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13649 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13650 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13651 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13652 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13653 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13654 | /* CD pin widget for input */ |
| 13655 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13656 | |
| 13657 | { } |
| 13658 | }; |
| 13659 | |
| 13660 | /* |
| 13661 | * 6-stack pin configuration: |
| 13662 | */ |
| 13663 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13664 | /* |
| 13665 | * Set pin mode and muting |
| 13666 | */ |
| 13667 | /* set front pin widgets 0x14 for output */ |
| 13668 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13669 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13670 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13671 | |
| 13672 | /* Rear Pin: output 1 (0x0d) */ |
| 13673 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13674 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13675 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13676 | /* CLFE Pin: output 2 (0x0e) */ |
| 13677 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13678 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13679 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13680 | /* Side Pin: output 3 (0x0f) */ |
| 13681 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13682 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13683 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13684 | |
| 13685 | /* Mic (rear) pin: input vref at 80% */ |
| 13686 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13687 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13688 | /* Front Mic pin: input vref at 80% */ |
| 13689 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13690 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13691 | /* Line In pin: input */ |
| 13692 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13693 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13694 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13695 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13696 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13697 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13698 | /* CD pin widget for input */ |
| 13699 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13700 | |
| 13701 | { } |
| 13702 | }; |
| 13703 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13704 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 13705 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13706 | { } |
| 13707 | }; |
| 13708 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13709 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 13710 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13711 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13712 | { } |
| 13713 | }; |
| 13714 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13715 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 13716 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13717 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13718 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 13719 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13720 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13721 | {} |
| 13722 | }; |
| 13723 | |
| 13724 | /* toggle speaker-output according to the hp-jack state */ |
| 13725 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 13726 | { |
| 13727 | unsigned int present; |
| 13728 | unsigned char bits; |
| 13729 | |
| 13730 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13731 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13732 | bits = present ? HDA_AMP_MUTE : 0; |
| 13733 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13734 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13735 | } |
| 13736 | |
| 13737 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 13738 | { |
| 13739 | unsigned int present; |
| 13740 | unsigned char bits; |
| 13741 | |
| 13742 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13743 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13744 | bits = present ? HDA_AMP_MUTE : 0; |
| 13745 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 13746 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13747 | } |
| 13748 | |
| 13749 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 13750 | { |
| 13751 | alc861vd_lenovo_hp_automute(codec); |
| 13752 | alc861vd_lenovo_mic_automute(codec); |
| 13753 | } |
| 13754 | |
| 13755 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 13756 | unsigned int res) |
| 13757 | { |
| 13758 | switch (res >> 26) { |
| 13759 | case ALC880_HP_EVENT: |
| 13760 | alc861vd_lenovo_hp_automute(codec); |
| 13761 | break; |
| 13762 | case ALC880_MIC_EVENT: |
| 13763 | alc861vd_lenovo_mic_automute(codec); |
| 13764 | break; |
| 13765 | } |
| 13766 | } |
| 13767 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13768 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 13769 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13770 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13771 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13772 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13773 | |
| 13774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13775 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13776 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13777 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13778 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13779 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13780 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13782 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13783 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13784 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13785 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13786 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13787 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13788 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13789 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13790 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13791 | |
| 13792 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13793 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13794 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13795 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13796 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13797 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13798 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13799 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13800 | |
| 13801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13805 | |
| 13806 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13807 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13808 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13809 | |
| 13810 | { } /* end */ |
| 13811 | }; |
| 13812 | |
| 13813 | /* toggle speaker-output according to the hp-jack state */ |
| 13814 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 13815 | { |
| 13816 | unsigned int present; |
| 13817 | |
| 13818 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13819 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13820 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13821 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13822 | } |
| 13823 | |
| 13824 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 13825 | { |
| 13826 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13827 | alc861vd_dallas_automute(codec); |
| 13828 | } |
| 13829 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13830 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13831 | #define alc861vd_loopbacks alc880_loopbacks |
| 13832 | #endif |
| 13833 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13834 | /* pcm configuration: identiacal with ALC880 */ |
| 13835 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 13836 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 13837 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 13838 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 13839 | |
| 13840 | /* |
| 13841 | * configuration and preset |
| 13842 | */ |
| 13843 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 13844 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13845 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame^] | 13846 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13847 | [ALC861VD_3ST] = "3stack", |
| 13848 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 13849 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13850 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13851 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13852 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13853 | [ALC861VD_AUTO] = "auto", |
| 13854 | }; |
| 13855 | |
| 13856 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13857 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 13858 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 13859 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13860 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame^] | 13861 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13862 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13863 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13864 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 13865 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13866 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 13867 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13868 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 13869 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13870 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 13871 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 13872 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 13873 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13874 | {} |
| 13875 | }; |
| 13876 | |
| 13877 | static struct alc_config_preset alc861vd_presets[] = { |
| 13878 | [ALC660VD_3ST] = { |
| 13879 | .mixers = { alc861vd_3st_mixer }, |
| 13880 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13881 | alc861vd_3stack_init_verbs }, |
| 13882 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13883 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13884 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13885 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13886 | .input_mux = &alc861vd_capture_source, |
| 13887 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13888 | [ALC660VD_3ST_DIG] = { |
| 13889 | .mixers = { alc861vd_3st_mixer }, |
| 13890 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13891 | alc861vd_3stack_init_verbs }, |
| 13892 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13893 | .dac_nids = alc660vd_dac_nids, |
| 13894 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13895 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13896 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13897 | .input_mux = &alc861vd_capture_source, |
| 13898 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13899 | [ALC861VD_3ST] = { |
| 13900 | .mixers = { alc861vd_3st_mixer }, |
| 13901 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13902 | alc861vd_3stack_init_verbs }, |
| 13903 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13904 | .dac_nids = alc861vd_dac_nids, |
| 13905 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13906 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13907 | .input_mux = &alc861vd_capture_source, |
| 13908 | }, |
| 13909 | [ALC861VD_3ST_DIG] = { |
| 13910 | .mixers = { alc861vd_3st_mixer }, |
| 13911 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13912 | alc861vd_3stack_init_verbs }, |
| 13913 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13914 | .dac_nids = alc861vd_dac_nids, |
| 13915 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13916 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13917 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13918 | .input_mux = &alc861vd_capture_source, |
| 13919 | }, |
| 13920 | [ALC861VD_6ST_DIG] = { |
| 13921 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 13922 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13923 | alc861vd_6stack_init_verbs }, |
| 13924 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13925 | .dac_nids = alc861vd_dac_nids, |
| 13926 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13927 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 13928 | .channel_mode = alc861vd_6stack_modes, |
| 13929 | .input_mux = &alc861vd_capture_source, |
| 13930 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13931 | [ALC861VD_LENOVO] = { |
| 13932 | .mixers = { alc861vd_lenovo_mixer }, |
| 13933 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13934 | alc861vd_3stack_init_verbs, |
| 13935 | alc861vd_eapd_verbs, |
| 13936 | alc861vd_lenovo_unsol_verbs }, |
| 13937 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13938 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13939 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13940 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13941 | .input_mux = &alc861vd_capture_source, |
| 13942 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 13943 | .init_hook = alc861vd_lenovo_automute, |
| 13944 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13945 | [ALC861VD_DALLAS] = { |
| 13946 | .mixers = { alc861vd_dallas_mixer }, |
| 13947 | .init_verbs = { alc861vd_dallas_verbs }, |
| 13948 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13949 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13950 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13951 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13952 | .input_mux = &alc861vd_dallas_capture_source, |
| 13953 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13954 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13955 | }, |
| 13956 | [ALC861VD_HP] = { |
| 13957 | .mixers = { alc861vd_hp_mixer }, |
| 13958 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 13959 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13960 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13961 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13962 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13963 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13964 | .input_mux = &alc861vd_hp_capture_source, |
| 13965 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13966 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13967 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame^] | 13968 | [ALC660VD_ASUS_V1S] = { |
| 13969 | .mixers = { alc861vd_lenovo_mixer }, |
| 13970 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13971 | alc861vd_3stack_init_verbs, |
| 13972 | alc861vd_eapd_verbs, |
| 13973 | alc861vd_lenovo_unsol_verbs }, |
| 13974 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13975 | .dac_nids = alc660vd_dac_nids, |
| 13976 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13977 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13978 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13979 | .input_mux = &alc861vd_capture_source, |
| 13980 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 13981 | .init_hook = alc861vd_lenovo_automute, |
| 13982 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13983 | }; |
| 13984 | |
| 13985 | /* |
| 13986 | * BIOS auto configuration |
| 13987 | */ |
| 13988 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13989 | hda_nid_t nid, int pin_type, int dac_idx) |
| 13990 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13991 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13992 | } |
| 13993 | |
| 13994 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 13995 | { |
| 13996 | struct alc_spec *spec = codec->spec; |
| 13997 | int i; |
| 13998 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13999 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14000 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14001 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14002 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14003 | if (nid) |
| 14004 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14005 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14006 | } |
| 14007 | } |
| 14008 | |
| 14009 | |
| 14010 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14011 | { |
| 14012 | struct alc_spec *spec = codec->spec; |
| 14013 | hda_nid_t pin; |
| 14014 | |
| 14015 | pin = spec->autocfg.hp_pins[0]; |
| 14016 | if (pin) /* connect to front and use dac 0 */ |
| 14017 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14018 | pin = spec->autocfg.speaker_pins[0]; |
| 14019 | if (pin) |
| 14020 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14021 | } |
| 14022 | |
| 14023 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14024 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14025 | |
| 14026 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14027 | { |
| 14028 | struct alc_spec *spec = codec->spec; |
| 14029 | int i; |
| 14030 | |
| 14031 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14032 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14033 | if (alc861vd_is_input_pin(nid)) { |
| 14034 | snd_hda_codec_write(codec, nid, 0, |
| 14035 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14036 | i <= AUTO_PIN_FRONT_MIC ? |
| 14037 | PIN_VREF80 : PIN_IN); |
| 14038 | if (nid != ALC861VD_PIN_CD_NID) |
| 14039 | snd_hda_codec_write(codec, nid, 0, |
| 14040 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14041 | AMP_OUT_MUTE); |
| 14042 | } |
| 14043 | } |
| 14044 | } |
| 14045 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14046 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14047 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14048 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14049 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14050 | |
| 14051 | /* add playback controls from the parsed DAC table */ |
| 14052 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14053 | * different NIDs for mute/unmute switch and volume control */ |
| 14054 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14055 | const struct auto_pin_cfg *cfg) |
| 14056 | { |
| 14057 | char name[32]; |
| 14058 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14059 | hda_nid_t nid_v, nid_s; |
| 14060 | int i, err; |
| 14061 | |
| 14062 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14063 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14064 | continue; |
| 14065 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14066 | alc880_dac_to_idx( |
| 14067 | spec->multiout.dac_nids[i])); |
| 14068 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14069 | alc880_dac_to_idx( |
| 14070 | spec->multiout.dac_nids[i])); |
| 14071 | |
| 14072 | if (i == 2) { |
| 14073 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14074 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14075 | "Center Playback Volume", |
| 14076 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14077 | HDA_OUTPUT)); |
| 14078 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14079 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14080 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14081 | "LFE Playback Volume", |
| 14082 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14083 | HDA_OUTPUT)); |
| 14084 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14085 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14086 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14087 | "Center Playback Switch", |
| 14088 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14089 | HDA_INPUT)); |
| 14090 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14091 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14092 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14093 | "LFE Playback Switch", |
| 14094 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14095 | HDA_INPUT)); |
| 14096 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14097 | return err; |
| 14098 | } else { |
| 14099 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14100 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14101 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14102 | HDA_OUTPUT)); |
| 14103 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14104 | return err; |
| 14105 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14106 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14107 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14108 | HDA_INPUT)); |
| 14109 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14110 | return err; |
| 14111 | } |
| 14112 | } |
| 14113 | return 0; |
| 14114 | } |
| 14115 | |
| 14116 | /* add playback controls for speaker and HP outputs */ |
| 14117 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14118 | * different NIDs for mute/unmute switch and volume control */ |
| 14119 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14120 | hda_nid_t pin, const char *pfx) |
| 14121 | { |
| 14122 | hda_nid_t nid_v, nid_s; |
| 14123 | int err; |
| 14124 | char name[32]; |
| 14125 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14126 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14127 | return 0; |
| 14128 | |
| 14129 | if (alc880_is_fixed_pin(pin)) { |
| 14130 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14131 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14132 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14133 | spec->multiout.hp_nid = nid_v; |
| 14134 | else |
| 14135 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14136 | /* control HP volume/switch on the output mixer amp */ |
| 14137 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14138 | alc880_fixed_pin_idx(pin)); |
| 14139 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14140 | alc880_fixed_pin_idx(pin)); |
| 14141 | |
| 14142 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14143 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14144 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14145 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14146 | return err; |
| 14147 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14148 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14149 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14150 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14151 | return err; |
| 14152 | } else if (alc880_is_multi_pin(pin)) { |
| 14153 | /* set manual connection */ |
| 14154 | /* we have only a switch on HP-out PIN */ |
| 14155 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14156 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14157 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14158 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14159 | return err; |
| 14160 | } |
| 14161 | return 0; |
| 14162 | } |
| 14163 | |
| 14164 | /* parse the BIOS configuration and set up the alc_spec |
| 14165 | * return 1 if successful, 0 if the proper config is not found, |
| 14166 | * or a negative error code |
| 14167 | * Based on ALC880 version - had to change it to override |
| 14168 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14169 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14170 | { |
| 14171 | struct alc_spec *spec = codec->spec; |
| 14172 | int err; |
| 14173 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14174 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14175 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14176 | alc861vd_ignore); |
| 14177 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14178 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14179 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14180 | return 0; /* can't find valid BIOS pin config */ |
| 14181 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14182 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14183 | if (err < 0) |
| 14184 | return err; |
| 14185 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14186 | if (err < 0) |
| 14187 | return err; |
| 14188 | err = alc861vd_auto_create_extra_out(spec, |
| 14189 | spec->autocfg.speaker_pins[0], |
| 14190 | "Speaker"); |
| 14191 | if (err < 0) |
| 14192 | return err; |
| 14193 | err = alc861vd_auto_create_extra_out(spec, |
| 14194 | spec->autocfg.hp_pins[0], |
| 14195 | "Headphone"); |
| 14196 | if (err < 0) |
| 14197 | return err; |
| 14198 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14199 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14200 | return err; |
| 14201 | |
| 14202 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14203 | |
| 14204 | if (spec->autocfg.dig_out_pin) |
| 14205 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14206 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14207 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14208 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14209 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14210 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14211 | |
| 14212 | spec->num_mux_defs = 1; |
| 14213 | spec->input_mux = &spec->private_imux; |
| 14214 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14215 | err = alc_auto_add_mic_boost(codec); |
| 14216 | if (err < 0) |
| 14217 | return err; |
| 14218 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 14219 | store_pin_configs(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14220 | return 1; |
| 14221 | } |
| 14222 | |
| 14223 | /* additional initialization for auto-configuration model */ |
| 14224 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14225 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14226 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14227 | alc861vd_auto_init_multi_out(codec); |
| 14228 | alc861vd_auto_init_hp_out(codec); |
| 14229 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14230 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14231 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14232 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14233 | } |
| 14234 | |
| 14235 | static int patch_alc861vd(struct hda_codec *codec) |
| 14236 | { |
| 14237 | struct alc_spec *spec; |
| 14238 | int err, board_config; |
| 14239 | |
| 14240 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14241 | if (spec == NULL) |
| 14242 | return -ENOMEM; |
| 14243 | |
| 14244 | codec->spec = spec; |
| 14245 | |
| 14246 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14247 | alc861vd_models, |
| 14248 | alc861vd_cfg_tbl); |
| 14249 | |
| 14250 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14251 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14252 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14253 | board_config = ALC861VD_AUTO; |
| 14254 | } |
| 14255 | |
| 14256 | if (board_config == ALC861VD_AUTO) { |
| 14257 | /* automatic parse from the BIOS config */ |
| 14258 | err = alc861vd_parse_auto_config(codec); |
| 14259 | if (err < 0) { |
| 14260 | alc_free(codec); |
| 14261 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14262 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14263 | printk(KERN_INFO |
| 14264 | "hda_codec: Cannot set up configuration " |
| 14265 | "from BIOS. Using base mode...\n"); |
| 14266 | board_config = ALC861VD_3ST; |
| 14267 | } |
| 14268 | } |
| 14269 | |
| 14270 | if (board_config != ALC861VD_AUTO) |
| 14271 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14272 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14273 | if (codec->vendor_id == 0x10ec0660) { |
| 14274 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14275 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14276 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14277 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14278 | } else { |
| 14279 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14280 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14281 | } |
| 14282 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14283 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14284 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14285 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14286 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14287 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 14288 | |
| 14289 | spec->adc_nids = alc861vd_adc_nids; |
| 14290 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14291 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 14292 | spec->is_mix_capture = 1; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14293 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14294 | set_capture_mixer(spec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14295 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14296 | spec->vmaster_nid = 0x02; |
| 14297 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14298 | codec->patch_ops = alc_patch_ops; |
| 14299 | |
| 14300 | if (board_config == ALC861VD_AUTO) |
| 14301 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14302 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14303 | if (!spec->loopback.amplist) |
| 14304 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14305 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14306 | |
| 14307 | return 0; |
| 14308 | } |
| 14309 | |
| 14310 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14311 | * ALC662 support |
| 14312 | * |
| 14313 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 14314 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 14315 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 14316 | * 6-channel independent captures. |
| 14317 | * |
| 14318 | * In addition, an independent DAC for the multi-playback (not used in this |
| 14319 | * driver yet). |
| 14320 | */ |
| 14321 | #define ALC662_DIGOUT_NID 0x06 |
| 14322 | #define ALC662_DIGIN_NID 0x0a |
| 14323 | |
| 14324 | static hda_nid_t alc662_dac_nids[4] = { |
| 14325 | /* front, rear, clfe, rear_surr */ |
| 14326 | 0x02, 0x03, 0x04 |
| 14327 | }; |
| 14328 | |
| 14329 | static hda_nid_t alc662_adc_nids[1] = { |
| 14330 | /* ADC1-2 */ |
| 14331 | 0x09, |
| 14332 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14333 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 14334 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14335 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14336 | /* input MUX */ |
| 14337 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14338 | static struct hda_input_mux alc662_capture_source = { |
| 14339 | .num_items = 4, |
| 14340 | .items = { |
| 14341 | { "Mic", 0x0 }, |
| 14342 | { "Front Mic", 0x1 }, |
| 14343 | { "Line", 0x2 }, |
| 14344 | { "CD", 0x4 }, |
| 14345 | }, |
| 14346 | }; |
| 14347 | |
| 14348 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 14349 | .num_items = 2, |
| 14350 | .items = { |
| 14351 | { "Mic", 0x1 }, |
| 14352 | { "Line", 0x2 }, |
| 14353 | }, |
| 14354 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14355 | |
| 14356 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 14357 | .num_items = 2, |
| 14358 | .items = { |
| 14359 | { "i-Mic", 0x1 }, |
| 14360 | { "e-Mic", 0x0 }, |
| 14361 | }, |
| 14362 | }; |
| 14363 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14364 | static struct hda_input_mux alc663_capture_source = { |
| 14365 | .num_items = 3, |
| 14366 | .items = { |
| 14367 | { "Mic", 0x0 }, |
| 14368 | { "Front Mic", 0x1 }, |
| 14369 | { "Line", 0x2 }, |
| 14370 | }, |
| 14371 | }; |
| 14372 | |
| 14373 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 14374 | .num_items = 2, |
| 14375 | .items = { |
| 14376 | { "Ext-Mic", 0x0 }, |
| 14377 | { "D-Mic", 0x9 }, |
| 14378 | }, |
| 14379 | }; |
| 14380 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14381 | /* |
| 14382 | * 2ch mode |
| 14383 | */ |
| 14384 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 14385 | { 2, NULL } |
| 14386 | }; |
| 14387 | |
| 14388 | /* |
| 14389 | * 2ch mode |
| 14390 | */ |
| 14391 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 14392 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 14393 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14394 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14395 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14396 | { } /* end */ |
| 14397 | }; |
| 14398 | |
| 14399 | /* |
| 14400 | * 6ch mode |
| 14401 | */ |
| 14402 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14403 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14404 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14405 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14406 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14407 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14408 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14409 | { } /* end */ |
| 14410 | }; |
| 14411 | |
| 14412 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14413 | { 2, alc662_3ST_ch2_init }, |
| 14414 | { 6, alc662_3ST_ch6_init }, |
| 14415 | }; |
| 14416 | |
| 14417 | /* |
| 14418 | * 2ch mode |
| 14419 | */ |
| 14420 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14421 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14422 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14423 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14424 | { } /* end */ |
| 14425 | }; |
| 14426 | |
| 14427 | /* |
| 14428 | * 6ch mode |
| 14429 | */ |
| 14430 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14431 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14432 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14433 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14434 | { } /* end */ |
| 14435 | }; |
| 14436 | |
| 14437 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 14438 | { 2, alc662_sixstack_ch6_init }, |
| 14439 | { 6, alc662_sixstack_ch8_init }, |
| 14440 | }; |
| 14441 | |
| 14442 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14443 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14444 | */ |
| 14445 | |
| 14446 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 14447 | /* output mixer control */ |
| 14448 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14449 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14450 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14451 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14452 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14453 | 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] | 14454 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14455 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14456 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14457 | |
| 14458 | /*Input mixer control */ |
| 14459 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 14460 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 14461 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 14462 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 14463 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 14464 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 14465 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 14466 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14467 | { } /* end */ |
| 14468 | }; |
| 14469 | |
| 14470 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 14471 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14472 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14473 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14474 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14475 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14476 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14477 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14479 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14480 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14481 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14482 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14483 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14484 | { } /* end */ |
| 14485 | }; |
| 14486 | |
| 14487 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 14488 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14489 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14490 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14491 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14492 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14493 | 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] | 14494 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14495 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14496 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14497 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14498 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14500 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14504 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14505 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14506 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14507 | { } /* end */ |
| 14508 | }; |
| 14509 | |
| 14510 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 14511 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14512 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14513 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14514 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14516 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14517 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14518 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14519 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14520 | { } /* end */ |
| 14521 | }; |
| 14522 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14523 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14524 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14525 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 14526 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14527 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14528 | |
| 14529 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 14530 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14531 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14532 | |
| 14533 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 14534 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14535 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14536 | { } /* end */ |
| 14537 | }; |
| 14538 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14539 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 14540 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14541 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14542 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14543 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 14544 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14545 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 14546 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 14547 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14548 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14549 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14550 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14551 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14552 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14553 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14554 | { } /* end */ |
| 14555 | }; |
| 14556 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14557 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 14558 | .ops = &snd_hda_bind_vol, |
| 14559 | .values = { |
| 14560 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14561 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 14562 | 0 |
| 14563 | }, |
| 14564 | }; |
| 14565 | |
| 14566 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 14567 | .ops = &snd_hda_bind_sw, |
| 14568 | .values = { |
| 14569 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14570 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14571 | 0 |
| 14572 | }, |
| 14573 | }; |
| 14574 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14575 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14576 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14577 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 14578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14580 | { } /* end */ |
| 14581 | }; |
| 14582 | |
| 14583 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 14584 | .ops = &snd_hda_bind_sw, |
| 14585 | .values = { |
| 14586 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14587 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14588 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14589 | 0 |
| 14590 | }, |
| 14591 | }; |
| 14592 | |
| 14593 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 14594 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14595 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 14596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14597 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14598 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14599 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14600 | |
| 14601 | { } /* end */ |
| 14602 | }; |
| 14603 | |
| 14604 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 14605 | .ops = &snd_hda_bind_sw, |
| 14606 | .values = { |
| 14607 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14608 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14609 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 14610 | 0 |
| 14611 | }, |
| 14612 | }; |
| 14613 | |
| 14614 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 14615 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14616 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 14617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14618 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14619 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14620 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14621 | { } /* end */ |
| 14622 | }; |
| 14623 | |
| 14624 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14625 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14626 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14627 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14628 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14629 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14630 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14631 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14632 | { } /* end */ |
| 14633 | }; |
| 14634 | |
| 14635 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 14636 | .ops = &snd_hda_bind_vol, |
| 14637 | .values = { |
| 14638 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14639 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 14640 | 0 |
| 14641 | }, |
| 14642 | }; |
| 14643 | |
| 14644 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 14645 | .ops = &snd_hda_bind_sw, |
| 14646 | .values = { |
| 14647 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14648 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 14649 | 0 |
| 14650 | }, |
| 14651 | }; |
| 14652 | |
| 14653 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 14654 | HDA_BIND_VOL("Master Playback Volume", |
| 14655 | &alc663_asus_two_bind_master_vol), |
| 14656 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14657 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14658 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14661 | { } /* end */ |
| 14662 | }; |
| 14663 | |
| 14664 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 14665 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14666 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14667 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14668 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14671 | { } /* end */ |
| 14672 | }; |
| 14673 | |
| 14674 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 14675 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14676 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14677 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14678 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14679 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14680 | |
| 14681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14683 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14684 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14685 | { } /* end */ |
| 14686 | }; |
| 14687 | |
| 14688 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 14689 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14690 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14691 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14692 | |
| 14693 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14694 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14695 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14696 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14697 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14698 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14699 | { } /* end */ |
| 14700 | }; |
| 14701 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14702 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 14703 | { |
| 14704 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14705 | .name = "Channel Mode", |
| 14706 | .info = alc_ch_mode_info, |
| 14707 | .get = alc_ch_mode_get, |
| 14708 | .put = alc_ch_mode_put, |
| 14709 | }, |
| 14710 | { } /* end */ |
| 14711 | }; |
| 14712 | |
| 14713 | static struct hda_verb alc662_init_verbs[] = { |
| 14714 | /* ADC: mute amp left and right */ |
| 14715 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14716 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14717 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 14718 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14719 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14720 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14721 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14724 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14726 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14727 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14728 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14729 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14730 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14731 | |
| 14732 | /* Front Pin: output 0 (0x0c) */ |
| 14733 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14734 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14735 | |
| 14736 | /* Rear Pin: output 1 (0x0d) */ |
| 14737 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14739 | |
| 14740 | /* CLFE Pin: output 2 (0x0e) */ |
| 14741 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14742 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14743 | |
| 14744 | /* Mic (rear) pin: input vref at 80% */ |
| 14745 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14746 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14747 | /* Front Mic pin: input vref at 80% */ |
| 14748 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14750 | /* Line In pin: input */ |
| 14751 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14753 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14754 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14755 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14756 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14757 | /* CD pin widget for input */ |
| 14758 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14759 | |
| 14760 | /* FIXME: use matrix-type input source selection */ |
| 14761 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14762 | /* Input mixer */ |
| 14763 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14764 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14765 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14766 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14767 | |
| 14768 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14769 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14770 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14771 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14772 | |
| 14773 | /* always trun on EAPD */ |
| 14774 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14775 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14776 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14777 | { } |
| 14778 | }; |
| 14779 | |
| 14780 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 14781 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14782 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14783 | {} |
| 14784 | }; |
| 14785 | |
| 14786 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 14787 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14788 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14789 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14790 | }; |
| 14791 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14792 | /* Set Unsolicited Event*/ |
| 14793 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 14794 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14795 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14796 | {} |
| 14797 | }; |
| 14798 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14799 | /* |
| 14800 | * generic initialization of ADC, input mixers and output mixers |
| 14801 | */ |
| 14802 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 14803 | /* |
| 14804 | * Unmute ADC and set the default input to mic-in |
| 14805 | */ |
| 14806 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14807 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14808 | |
| 14809 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 14810 | * mixer widget |
| 14811 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 14812 | * panel mic (mic 2) |
| 14813 | */ |
| 14814 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14815 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14816 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14817 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14818 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14819 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14820 | |
| 14821 | /* |
| 14822 | * Set up output mixers (0x0c - 0x0f) |
| 14823 | */ |
| 14824 | /* set vol=0 to output mixers */ |
| 14825 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14826 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14827 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14828 | |
| 14829 | /* set up input amps for analog loopback */ |
| 14830 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14832 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14833 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14834 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14835 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14836 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14837 | |
| 14838 | |
| 14839 | /* FIXME: use matrix-type input source selection */ |
| 14840 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14841 | /* Input mixer */ |
| 14842 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14843 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14844 | { } |
| 14845 | }; |
| 14846 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 14847 | /* additional verbs for ALC663 */ |
| 14848 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 14849 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14850 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14851 | { } |
| 14852 | }; |
| 14853 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14854 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14855 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14856 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14857 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14858 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14859 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 14860 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14861 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14862 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14863 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14864 | {} |
| 14865 | }; |
| 14866 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14867 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 14868 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14869 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14870 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 14871 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14872 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14873 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14874 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14875 | {} |
| 14876 | }; |
| 14877 | |
| 14878 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 14879 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14880 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14881 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14882 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14883 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14885 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14886 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14887 | {} |
| 14888 | }; |
| 14889 | |
| 14890 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 14891 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14892 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14893 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 14894 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14896 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14897 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14898 | {} |
| 14899 | }; |
| 14900 | |
| 14901 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 14902 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14903 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14904 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14905 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 14906 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14907 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14908 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 14909 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14910 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14911 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14912 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14913 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14914 | {} |
| 14915 | }; |
| 14916 | |
| 14917 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 14918 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14919 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14920 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14921 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 14922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14924 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 14925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14927 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14928 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14929 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14930 | {} |
| 14931 | }; |
| 14932 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14933 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 14934 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14935 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 14936 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 14937 | |
| 14938 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14939 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14940 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14941 | |
| 14942 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14943 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 14944 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 14945 | {} |
| 14946 | }; |
| 14947 | |
| 14948 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 14949 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14950 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14951 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 14952 | |
| 14953 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14954 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14955 | {} |
| 14956 | }; |
| 14957 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14958 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 14959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 14960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14961 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14962 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14963 | {} |
| 14964 | }; |
| 14965 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14966 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 14967 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14968 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 14969 | { } /* end */ |
| 14970 | }; |
| 14971 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14972 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 14973 | { |
| 14974 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14975 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14976 | |
| 14977 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 14978 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14979 | bits = present ? HDA_AMP_MUTE : 0; |
| 14980 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14981 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14982 | } |
| 14983 | |
| 14984 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 14985 | { |
| 14986 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14987 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14988 | |
| 14989 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 14990 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14991 | bits = present ? HDA_AMP_MUTE : 0; |
| 14992 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14993 | HDA_AMP_MUTE, bits); |
| 14994 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14995 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14996 | } |
| 14997 | |
| 14998 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 14999 | unsigned int res) |
| 15000 | { |
| 15001 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15002 | alc662_lenovo_101e_all_automute(codec); |
| 15003 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15004 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15005 | } |
| 15006 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15007 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15008 | { |
| 15009 | unsigned int present; |
| 15010 | |
| 15011 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15012 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15013 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15014 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15015 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15016 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15017 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15018 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15019 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15020 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15021 | } |
| 15022 | |
| 15023 | /* unsolicited event for HP jack sensing */ |
| 15024 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15025 | unsigned int res) |
| 15026 | { |
| 15027 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15028 | alc262_hippo1_automute( codec ); |
| 15029 | |
| 15030 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15031 | alc662_eeepc_mic_automute(codec); |
| 15032 | } |
| 15033 | |
| 15034 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15035 | { |
| 15036 | alc262_hippo1_automute( codec ); |
| 15037 | alc662_eeepc_mic_automute(codec); |
| 15038 | } |
| 15039 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15040 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15041 | { |
| 15042 | unsigned int mute; |
| 15043 | unsigned int present; |
| 15044 | |
| 15045 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15046 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15047 | AC_VERB_GET_PIN_SENSE, 0); |
| 15048 | present = (present & 0x80000000) != 0; |
| 15049 | if (present) { |
| 15050 | /* mute internal speaker */ |
| 15051 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15052 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15053 | } else { |
| 15054 | /* unmute internal speaker if necessary */ |
| 15055 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15056 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15057 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15058 | } |
| 15059 | } |
| 15060 | |
| 15061 | /* unsolicited event for HP jack sensing */ |
| 15062 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15063 | unsigned int res) |
| 15064 | { |
| 15065 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15066 | alc662_eeepc_ep20_automute(codec); |
| 15067 | } |
| 15068 | |
| 15069 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15070 | { |
| 15071 | alc662_eeepc_ep20_automute(codec); |
| 15072 | } |
| 15073 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15074 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15075 | { |
| 15076 | unsigned int present; |
| 15077 | unsigned char bits; |
| 15078 | |
| 15079 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15080 | AC_VERB_GET_PIN_SENSE, 0) |
| 15081 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15082 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15083 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15084 | AMP_IN_MUTE(0), bits); |
| 15085 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15086 | AMP_IN_MUTE(0), bits); |
| 15087 | } |
| 15088 | |
| 15089 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15090 | { |
| 15091 | unsigned int present; |
| 15092 | unsigned char bits; |
| 15093 | |
| 15094 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15095 | AC_VERB_GET_PIN_SENSE, 0) |
| 15096 | & AC_PINSENSE_PRESENCE; |
| 15097 | bits = present ? HDA_AMP_MUTE : 0; |
| 15098 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15099 | AMP_IN_MUTE(0), bits); |
| 15100 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15101 | AMP_IN_MUTE(0), bits); |
| 15102 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15103 | AMP_IN_MUTE(0), bits); |
| 15104 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15105 | AMP_IN_MUTE(0), bits); |
| 15106 | } |
| 15107 | |
| 15108 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15109 | { |
| 15110 | unsigned int present; |
| 15111 | unsigned char bits; |
| 15112 | |
| 15113 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15114 | AC_VERB_GET_PIN_SENSE, 0) |
| 15115 | & AC_PINSENSE_PRESENCE; |
| 15116 | bits = present ? HDA_AMP_MUTE : 0; |
| 15117 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15118 | AMP_IN_MUTE(0), bits); |
| 15119 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15120 | AMP_IN_MUTE(0), bits); |
| 15121 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15122 | AMP_IN_MUTE(0), bits); |
| 15123 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15124 | AMP_IN_MUTE(0), bits); |
| 15125 | } |
| 15126 | |
| 15127 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15128 | { |
| 15129 | unsigned int present; |
| 15130 | unsigned char bits; |
| 15131 | |
| 15132 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15133 | AC_VERB_GET_PIN_SENSE, 0) |
| 15134 | & AC_PINSENSE_PRESENCE; |
| 15135 | bits = present ? 0 : PIN_OUT; |
| 15136 | snd_hda_codec_write(codec, 0x14, 0, |
| 15137 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15138 | } |
| 15139 | |
| 15140 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15141 | { |
| 15142 | unsigned int present1, present2; |
| 15143 | |
| 15144 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15145 | AC_VERB_GET_PIN_SENSE, 0) |
| 15146 | & AC_PINSENSE_PRESENCE; |
| 15147 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15148 | AC_VERB_GET_PIN_SENSE, 0) |
| 15149 | & AC_PINSENSE_PRESENCE; |
| 15150 | |
| 15151 | if (present1 || present2) { |
| 15152 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15153 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15154 | } else { |
| 15155 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15156 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15157 | } |
| 15158 | } |
| 15159 | |
| 15160 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15161 | { |
| 15162 | unsigned int present1, present2; |
| 15163 | |
| 15164 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15165 | AC_VERB_GET_PIN_SENSE, 0) |
| 15166 | & AC_PINSENSE_PRESENCE; |
| 15167 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15168 | AC_VERB_GET_PIN_SENSE, 0) |
| 15169 | & AC_PINSENSE_PRESENCE; |
| 15170 | |
| 15171 | if (present1 || present2) { |
| 15172 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15173 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15174 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15175 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15176 | } else { |
| 15177 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15178 | AMP_IN_MUTE(0), 0); |
| 15179 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15180 | AMP_IN_MUTE(0), 0); |
| 15181 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15182 | } |
| 15183 | |
| 15184 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15185 | { |
| 15186 | unsigned int present; |
| 15187 | |
| 15188 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15189 | AC_VERB_GET_PIN_SENSE, 0) |
| 15190 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15191 | 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] | 15192 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15193 | 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] | 15194 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15195 | 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] | 15196 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15197 | 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] | 15198 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15199 | } |
| 15200 | |
| 15201 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15202 | unsigned int res) |
| 15203 | { |
| 15204 | switch (res >> 26) { |
| 15205 | case ALC880_HP_EVENT: |
| 15206 | alc663_m51va_speaker_automute(codec); |
| 15207 | break; |
| 15208 | case ALC880_MIC_EVENT: |
| 15209 | alc663_m51va_mic_automute(codec); |
| 15210 | break; |
| 15211 | } |
| 15212 | } |
| 15213 | |
| 15214 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15215 | { |
| 15216 | alc663_m51va_speaker_automute(codec); |
| 15217 | alc663_m51va_mic_automute(codec); |
| 15218 | } |
| 15219 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15220 | /* ***************** Mode1 ******************************/ |
| 15221 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15222 | unsigned int res) |
| 15223 | { |
| 15224 | switch (res >> 26) { |
| 15225 | case ALC880_HP_EVENT: |
| 15226 | alc663_m51va_speaker_automute(codec); |
| 15227 | break; |
| 15228 | case ALC880_MIC_EVENT: |
| 15229 | alc662_eeepc_mic_automute(codec); |
| 15230 | break; |
| 15231 | } |
| 15232 | } |
| 15233 | |
| 15234 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15235 | { |
| 15236 | alc663_m51va_speaker_automute(codec); |
| 15237 | alc662_eeepc_mic_automute(codec); |
| 15238 | } |
| 15239 | /* ***************** Mode2 ******************************/ |
| 15240 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15241 | unsigned int res) |
| 15242 | { |
| 15243 | switch (res >> 26) { |
| 15244 | case ALC880_HP_EVENT: |
| 15245 | alc662_f5z_speaker_automute(codec); |
| 15246 | break; |
| 15247 | case ALC880_MIC_EVENT: |
| 15248 | alc662_eeepc_mic_automute(codec); |
| 15249 | break; |
| 15250 | } |
| 15251 | } |
| 15252 | |
| 15253 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15254 | { |
| 15255 | alc662_f5z_speaker_automute(codec); |
| 15256 | alc662_eeepc_mic_automute(codec); |
| 15257 | } |
| 15258 | /* ***************** Mode3 ******************************/ |
| 15259 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15260 | unsigned int res) |
| 15261 | { |
| 15262 | switch (res >> 26) { |
| 15263 | case ALC880_HP_EVENT: |
| 15264 | alc663_two_hp_m1_speaker_automute(codec); |
| 15265 | break; |
| 15266 | case ALC880_MIC_EVENT: |
| 15267 | alc662_eeepc_mic_automute(codec); |
| 15268 | break; |
| 15269 | } |
| 15270 | } |
| 15271 | |
| 15272 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 15273 | { |
| 15274 | alc663_two_hp_m1_speaker_automute(codec); |
| 15275 | alc662_eeepc_mic_automute(codec); |
| 15276 | } |
| 15277 | /* ***************** Mode4 ******************************/ |
| 15278 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15279 | unsigned int res) |
| 15280 | { |
| 15281 | switch (res >> 26) { |
| 15282 | case ALC880_HP_EVENT: |
| 15283 | alc663_21jd_two_speaker_automute(codec); |
| 15284 | break; |
| 15285 | case ALC880_MIC_EVENT: |
| 15286 | alc662_eeepc_mic_automute(codec); |
| 15287 | break; |
| 15288 | } |
| 15289 | } |
| 15290 | |
| 15291 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 15292 | { |
| 15293 | alc663_21jd_two_speaker_automute(codec); |
| 15294 | alc662_eeepc_mic_automute(codec); |
| 15295 | } |
| 15296 | /* ***************** Mode5 ******************************/ |
| 15297 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 15298 | unsigned int res) |
| 15299 | { |
| 15300 | switch (res >> 26) { |
| 15301 | case ALC880_HP_EVENT: |
| 15302 | alc663_15jd_two_speaker_automute(codec); |
| 15303 | break; |
| 15304 | case ALC880_MIC_EVENT: |
| 15305 | alc662_eeepc_mic_automute(codec); |
| 15306 | break; |
| 15307 | } |
| 15308 | } |
| 15309 | |
| 15310 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 15311 | { |
| 15312 | alc663_15jd_two_speaker_automute(codec); |
| 15313 | alc662_eeepc_mic_automute(codec); |
| 15314 | } |
| 15315 | /* ***************** Mode6 ******************************/ |
| 15316 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 15317 | unsigned int res) |
| 15318 | { |
| 15319 | switch (res >> 26) { |
| 15320 | case ALC880_HP_EVENT: |
| 15321 | alc663_two_hp_m2_speaker_automute(codec); |
| 15322 | break; |
| 15323 | case ALC880_MIC_EVENT: |
| 15324 | alc662_eeepc_mic_automute(codec); |
| 15325 | break; |
| 15326 | } |
| 15327 | } |
| 15328 | |
| 15329 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 15330 | { |
| 15331 | alc663_two_hp_m2_speaker_automute(codec); |
| 15332 | alc662_eeepc_mic_automute(codec); |
| 15333 | } |
| 15334 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15335 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 15336 | { |
| 15337 | unsigned int present; |
| 15338 | unsigned char bits; |
| 15339 | |
| 15340 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15341 | AC_VERB_GET_PIN_SENSE, 0) |
| 15342 | & AC_PINSENSE_PRESENCE; |
| 15343 | bits = present ? HDA_AMP_MUTE : 0; |
| 15344 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15345 | HDA_AMP_MUTE, bits); |
| 15346 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15347 | HDA_AMP_MUTE, bits); |
| 15348 | } |
| 15349 | |
| 15350 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 15351 | { |
| 15352 | unsigned int present; |
| 15353 | unsigned char bits; |
| 15354 | |
| 15355 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15356 | AC_VERB_GET_PIN_SENSE, 0) |
| 15357 | & AC_PINSENSE_PRESENCE; |
| 15358 | bits = present ? HDA_AMP_MUTE : 0; |
| 15359 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15360 | HDA_AMP_MUTE, bits); |
| 15361 | } |
| 15362 | |
| 15363 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 15364 | unsigned int res) |
| 15365 | { |
| 15366 | switch (res >> 26) { |
| 15367 | case ALC880_HP_EVENT: |
| 15368 | alc663_g71v_hp_automute(codec); |
| 15369 | break; |
| 15370 | case ALC880_FRONT_EVENT: |
| 15371 | alc663_g71v_front_automute(codec); |
| 15372 | break; |
| 15373 | case ALC880_MIC_EVENT: |
| 15374 | alc662_eeepc_mic_automute(codec); |
| 15375 | break; |
| 15376 | } |
| 15377 | } |
| 15378 | |
| 15379 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 15380 | { |
| 15381 | alc663_g71v_front_automute(codec); |
| 15382 | alc663_g71v_hp_automute(codec); |
| 15383 | alc662_eeepc_mic_automute(codec); |
| 15384 | } |
| 15385 | |
| 15386 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 15387 | unsigned int res) |
| 15388 | { |
| 15389 | switch (res >> 26) { |
| 15390 | case ALC880_HP_EVENT: |
| 15391 | alc663_m51va_speaker_automute(codec); |
| 15392 | break; |
| 15393 | case ALC880_MIC_EVENT: |
| 15394 | alc662_eeepc_mic_automute(codec); |
| 15395 | break; |
| 15396 | } |
| 15397 | } |
| 15398 | |
| 15399 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 15400 | { |
| 15401 | alc663_m51va_speaker_automute(codec); |
| 15402 | alc662_eeepc_mic_automute(codec); |
| 15403 | } |
| 15404 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15405 | /* bind hp and internal speaker mute (with plug check) */ |
| 15406 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 15407 | struct snd_ctl_elem_value *ucontrol) |
| 15408 | { |
| 15409 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 15410 | long *valp = ucontrol->value.integer.value; |
| 15411 | int change; |
| 15412 | |
| 15413 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 15414 | HDA_AMP_MUTE, |
| 15415 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 15416 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 15417 | HDA_AMP_MUTE, |
| 15418 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 15419 | if (change) |
| 15420 | alc262_hippo1_automute(codec); |
| 15421 | return change; |
| 15422 | } |
| 15423 | |
| 15424 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 15425 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15426 | { |
| 15427 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15428 | .name = "Master Playback Switch", |
| 15429 | .info = snd_hda_mixer_amp_switch_info, |
| 15430 | .get = snd_hda_mixer_amp_switch_get, |
| 15431 | .put = alc662_ecs_master_sw_put, |
| 15432 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15433 | }, |
| 15434 | |
| 15435 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 15436 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15437 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15438 | |
| 15439 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15440 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15441 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15442 | { } /* end */ |
| 15443 | }; |
| 15444 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15445 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15446 | #define alc662_loopbacks alc880_loopbacks |
| 15447 | #endif |
| 15448 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15449 | |
| 15450 | /* pcm configuration: identiacal with ALC880 */ |
| 15451 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 15452 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 15453 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 15454 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 15455 | |
| 15456 | /* |
| 15457 | * configuration and preset |
| 15458 | */ |
| 15459 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 15460 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 15461 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 15462 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 15463 | [ALC662_5ST_DIG] = "6stack-dig", |
| 15464 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 15465 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15466 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15467 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15468 | [ALC663_ASUS_M51VA] = "m51va", |
| 15469 | [ALC663_ASUS_G71V] = "g71v", |
| 15470 | [ALC663_ASUS_H13] = "h13", |
| 15471 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15472 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 15473 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 15474 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 15475 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 15476 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 15477 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15478 | [ALC662_AUTO] = "auto", |
| 15479 | }; |
| 15480 | |
| 15481 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15482 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 15483 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 15484 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15485 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15486 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15487 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 15488 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), |
| 15489 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 15490 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 15491 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 15492 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15493 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15494 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 15495 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 15496 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15497 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 15498 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 15499 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 15500 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 15501 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 15502 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15503 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
| 15504 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 15505 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 15506 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 15507 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15508 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 15509 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 15510 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 15511 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 15512 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 15513 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 15514 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
| 15515 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 15516 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 15517 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 15518 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 15519 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 15520 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15521 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15522 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 15523 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 15524 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 15525 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15526 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 15527 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15528 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15529 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 15530 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 15531 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15532 | {} |
| 15533 | }; |
| 15534 | |
| 15535 | static struct alc_config_preset alc662_presets[] = { |
| 15536 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15537 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15538 | .init_verbs = { alc662_init_verbs }, |
| 15539 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15540 | .dac_nids = alc662_dac_nids, |
| 15541 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15542 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15543 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15544 | .channel_mode = alc662_3ST_2ch_modes, |
| 15545 | .input_mux = &alc662_capture_source, |
| 15546 | }, |
| 15547 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15548 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15549 | .init_verbs = { alc662_init_verbs }, |
| 15550 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15551 | .dac_nids = alc662_dac_nids, |
| 15552 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15553 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15554 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15555 | .channel_mode = alc662_3ST_6ch_modes, |
| 15556 | .need_dac_fix = 1, |
| 15557 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15558 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15559 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15560 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15561 | .init_verbs = { alc662_init_verbs }, |
| 15562 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15563 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15564 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15565 | .channel_mode = alc662_3ST_6ch_modes, |
| 15566 | .need_dac_fix = 1, |
| 15567 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15568 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15569 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15570 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15571 | .init_verbs = { alc662_init_verbs }, |
| 15572 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15573 | .dac_nids = alc662_dac_nids, |
| 15574 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15575 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15576 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 15577 | .channel_mode = alc662_5stack_modes, |
| 15578 | .input_mux = &alc662_capture_source, |
| 15579 | }, |
| 15580 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15581 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15582 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 15583 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15584 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15585 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15586 | .channel_mode = alc662_3ST_2ch_modes, |
| 15587 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15588 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 15589 | .init_hook = alc662_lenovo_101e_all_automute, |
| 15590 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15591 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15592 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15593 | .init_verbs = { alc662_init_verbs, |
| 15594 | alc662_eeepc_sue_init_verbs }, |
| 15595 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15596 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15597 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15598 | .channel_mode = alc662_3ST_2ch_modes, |
| 15599 | .input_mux = &alc662_eeepc_capture_source, |
| 15600 | .unsol_event = alc662_eeepc_unsol_event, |
| 15601 | .init_hook = alc662_eeepc_inithook, |
| 15602 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15603 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15604 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15605 | alc662_chmode_mixer }, |
| 15606 | .init_verbs = { alc662_init_verbs, |
| 15607 | alc662_eeepc_ep20_sue_init_verbs }, |
| 15608 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15609 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15610 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15611 | .channel_mode = alc662_3ST_6ch_modes, |
| 15612 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15613 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 15614 | .init_hook = alc662_eeepc_ep20_inithook, |
| 15615 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15616 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15617 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15618 | .init_verbs = { alc662_init_verbs, |
| 15619 | alc662_ecs_init_verbs }, |
| 15620 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15621 | .dac_nids = alc662_dac_nids, |
| 15622 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15623 | .channel_mode = alc662_3ST_2ch_modes, |
| 15624 | .input_mux = &alc662_eeepc_capture_source, |
| 15625 | .unsol_event = alc662_eeepc_unsol_event, |
| 15626 | .init_hook = alc662_eeepc_inithook, |
| 15627 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15628 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15629 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15630 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15631 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15632 | .dac_nids = alc662_dac_nids, |
| 15633 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15634 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15635 | .channel_mode = alc662_3ST_2ch_modes, |
| 15636 | .input_mux = &alc663_m51va_capture_source, |
| 15637 | .unsol_event = alc663_m51va_unsol_event, |
| 15638 | .init_hook = alc663_m51va_inithook, |
| 15639 | }, |
| 15640 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15641 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15642 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 15643 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15644 | .dac_nids = alc662_dac_nids, |
| 15645 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15646 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15647 | .channel_mode = alc662_3ST_2ch_modes, |
| 15648 | .input_mux = &alc662_eeepc_capture_source, |
| 15649 | .unsol_event = alc663_g71v_unsol_event, |
| 15650 | .init_hook = alc663_g71v_inithook, |
| 15651 | }, |
| 15652 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15653 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15654 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15655 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15656 | .dac_nids = alc662_dac_nids, |
| 15657 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15658 | .channel_mode = alc662_3ST_2ch_modes, |
| 15659 | .input_mux = &alc663_m51va_capture_source, |
| 15660 | .unsol_event = alc663_m51va_unsol_event, |
| 15661 | .init_hook = alc663_m51va_inithook, |
| 15662 | }, |
| 15663 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15664 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15665 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 15666 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15667 | .dac_nids = alc662_dac_nids, |
| 15668 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15669 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15670 | .channel_mode = alc662_3ST_6ch_modes, |
| 15671 | .input_mux = &alc663_capture_source, |
| 15672 | .unsol_event = alc663_g50v_unsol_event, |
| 15673 | .init_hook = alc663_g50v_inithook, |
| 15674 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15675 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15676 | .mixers = { alc663_m51va_mixer }, |
| 15677 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15678 | .init_verbs = { alc662_init_verbs, |
| 15679 | alc663_21jd_amic_init_verbs }, |
| 15680 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15681 | .hp_nid = 0x03, |
| 15682 | .dac_nids = alc662_dac_nids, |
| 15683 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15684 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15685 | .channel_mode = alc662_3ST_2ch_modes, |
| 15686 | .input_mux = &alc662_eeepc_capture_source, |
| 15687 | .unsol_event = alc663_mode1_unsol_event, |
| 15688 | .init_hook = alc663_mode1_inithook, |
| 15689 | }, |
| 15690 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15691 | .mixers = { alc662_1bjd_mixer }, |
| 15692 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15693 | .init_verbs = { alc662_init_verbs, |
| 15694 | alc662_1bjd_amic_init_verbs }, |
| 15695 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15696 | .dac_nids = alc662_dac_nids, |
| 15697 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15698 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15699 | .channel_mode = alc662_3ST_2ch_modes, |
| 15700 | .input_mux = &alc662_eeepc_capture_source, |
| 15701 | .unsol_event = alc662_mode2_unsol_event, |
| 15702 | .init_hook = alc662_mode2_inithook, |
| 15703 | }, |
| 15704 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15705 | .mixers = { alc663_two_hp_m1_mixer }, |
| 15706 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15707 | .init_verbs = { alc662_init_verbs, |
| 15708 | alc663_two_hp_amic_m1_init_verbs }, |
| 15709 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15710 | .hp_nid = 0x03, |
| 15711 | .dac_nids = alc662_dac_nids, |
| 15712 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15713 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15714 | .channel_mode = alc662_3ST_2ch_modes, |
| 15715 | .input_mux = &alc662_eeepc_capture_source, |
| 15716 | .unsol_event = alc663_mode3_unsol_event, |
| 15717 | .init_hook = alc663_mode3_inithook, |
| 15718 | }, |
| 15719 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15720 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 15721 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15722 | .init_verbs = { alc662_init_verbs, |
| 15723 | alc663_21jd_amic_init_verbs}, |
| 15724 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15725 | .hp_nid = 0x03, |
| 15726 | .dac_nids = alc662_dac_nids, |
| 15727 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15728 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15729 | .channel_mode = alc662_3ST_2ch_modes, |
| 15730 | .input_mux = &alc662_eeepc_capture_source, |
| 15731 | .unsol_event = alc663_mode4_unsol_event, |
| 15732 | .init_hook = alc663_mode4_inithook, |
| 15733 | }, |
| 15734 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15735 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 15736 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15737 | .init_verbs = { alc662_init_verbs, |
| 15738 | alc663_15jd_amic_init_verbs }, |
| 15739 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15740 | .hp_nid = 0x03, |
| 15741 | .dac_nids = alc662_dac_nids, |
| 15742 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15743 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15744 | .channel_mode = alc662_3ST_2ch_modes, |
| 15745 | .input_mux = &alc662_eeepc_capture_source, |
| 15746 | .unsol_event = alc663_mode5_unsol_event, |
| 15747 | .init_hook = alc663_mode5_inithook, |
| 15748 | }, |
| 15749 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15750 | .mixers = { alc663_two_hp_m2_mixer }, |
| 15751 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15752 | .init_verbs = { alc662_init_verbs, |
| 15753 | alc663_two_hp_amic_m2_init_verbs }, |
| 15754 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15755 | .hp_nid = 0x03, |
| 15756 | .dac_nids = alc662_dac_nids, |
| 15757 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15758 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15759 | .channel_mode = alc662_3ST_2ch_modes, |
| 15760 | .input_mux = &alc662_eeepc_capture_source, |
| 15761 | .unsol_event = alc663_mode6_unsol_event, |
| 15762 | .init_hook = alc663_mode6_inithook, |
| 15763 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15764 | }; |
| 15765 | |
| 15766 | |
| 15767 | /* |
| 15768 | * BIOS auto configuration |
| 15769 | */ |
| 15770 | |
| 15771 | /* add playback controls from the parsed DAC table */ |
| 15772 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15773 | const struct auto_pin_cfg *cfg) |
| 15774 | { |
| 15775 | char name[32]; |
| 15776 | static const char *chname[4] = { |
| 15777 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15778 | }; |
| 15779 | hda_nid_t nid; |
| 15780 | int i, err; |
| 15781 | |
| 15782 | for (i = 0; i < cfg->line_outs; i++) { |
| 15783 | if (!spec->multiout.dac_nids[i]) |
| 15784 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15785 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15786 | if (i == 2) { |
| 15787 | /* Center/LFE */ |
| 15788 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15789 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15790 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 15791 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15792 | if (err < 0) |
| 15793 | return err; |
| 15794 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15795 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15796 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 15797 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15798 | if (err < 0) |
| 15799 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15800 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15801 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15802 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15803 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15804 | if (err < 0) |
| 15805 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15806 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15807 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15808 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15809 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15810 | if (err < 0) |
| 15811 | return err; |
| 15812 | } else { |
| 15813 | sprintf(name, "%s Playback Volume", chname[i]); |
| 15814 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15815 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 15816 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15817 | if (err < 0) |
| 15818 | return err; |
| 15819 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15820 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15821 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 15822 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15823 | if (err < 0) |
| 15824 | return err; |
| 15825 | } |
| 15826 | } |
| 15827 | return 0; |
| 15828 | } |
| 15829 | |
| 15830 | /* add playback controls for speaker and HP outputs */ |
| 15831 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 15832 | const char *pfx) |
| 15833 | { |
| 15834 | hda_nid_t nid; |
| 15835 | int err; |
| 15836 | char name[32]; |
| 15837 | |
| 15838 | if (!pin) |
| 15839 | return 0; |
| 15840 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15841 | if (pin == 0x17) { |
| 15842 | /* ALC663 has a mono output pin on 0x17 */ |
| 15843 | sprintf(name, "%s Playback Switch", pfx); |
| 15844 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15845 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 15846 | return err; |
| 15847 | } |
| 15848 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15849 | if (alc880_is_fixed_pin(pin)) { |
| 15850 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15851 | /* printk("DAC nid=%x\n",nid); */ |
| 15852 | /* specify the DAC as the extra output */ |
| 15853 | if (!spec->multiout.hp_nid) |
| 15854 | spec->multiout.hp_nid = nid; |
| 15855 | else |
| 15856 | spec->multiout.extra_out_nid[0] = nid; |
| 15857 | /* control HP volume/switch on the output mixer amp */ |
| 15858 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15859 | sprintf(name, "%s Playback Volume", pfx); |
| 15860 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15861 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 15862 | if (err < 0) |
| 15863 | return err; |
| 15864 | sprintf(name, "%s Playback Switch", pfx); |
| 15865 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15866 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 15867 | if (err < 0) |
| 15868 | return err; |
| 15869 | } else if (alc880_is_multi_pin(pin)) { |
| 15870 | /* set manual connection */ |
| 15871 | /* we have only a switch on HP-out PIN */ |
| 15872 | sprintf(name, "%s Playback Switch", pfx); |
| 15873 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15874 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15875 | if (err < 0) |
| 15876 | return err; |
| 15877 | } |
| 15878 | return 0; |
| 15879 | } |
| 15880 | |
| 15881 | /* create playback/capture controls for input pins */ |
| 15882 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 15883 | const struct auto_pin_cfg *cfg) |
| 15884 | { |
| 15885 | struct hda_input_mux *imux = &spec->private_imux; |
| 15886 | int i, err, idx; |
| 15887 | |
| 15888 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15889 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 15890 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 15891 | err = new_analog_input(spec, cfg->input_pins[i], |
| 15892 | auto_pin_cfg_labels[i], |
| 15893 | idx, 0x0b); |
| 15894 | if (err < 0) |
| 15895 | return err; |
| 15896 | imux->items[imux->num_items].label = |
| 15897 | auto_pin_cfg_labels[i]; |
| 15898 | imux->items[imux->num_items].index = |
| 15899 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 15900 | imux->num_items++; |
| 15901 | } |
| 15902 | } |
| 15903 | return 0; |
| 15904 | } |
| 15905 | |
| 15906 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15907 | hda_nid_t nid, int pin_type, |
| 15908 | int dac_idx) |
| 15909 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15910 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15911 | /* need the manual connection? */ |
| 15912 | if (alc880_is_multi_pin(nid)) { |
| 15913 | struct alc_spec *spec = codec->spec; |
| 15914 | int idx = alc880_multi_pin_idx(nid); |
| 15915 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 15916 | AC_VERB_SET_CONNECT_SEL, |
| 15917 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 15918 | } |
| 15919 | } |
| 15920 | |
| 15921 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 15922 | { |
| 15923 | struct alc_spec *spec = codec->spec; |
| 15924 | int i; |
| 15925 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15926 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15927 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15928 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15929 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15930 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15931 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15932 | i); |
| 15933 | } |
| 15934 | } |
| 15935 | |
| 15936 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 15937 | { |
| 15938 | struct alc_spec *spec = codec->spec; |
| 15939 | hda_nid_t pin; |
| 15940 | |
| 15941 | pin = spec->autocfg.hp_pins[0]; |
| 15942 | if (pin) /* connect to front */ |
| 15943 | /* use dac 0 */ |
| 15944 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15945 | pin = spec->autocfg.speaker_pins[0]; |
| 15946 | if (pin) |
| 15947 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15948 | } |
| 15949 | |
| 15950 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15951 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 15952 | |
| 15953 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 15954 | { |
| 15955 | struct alc_spec *spec = codec->spec; |
| 15956 | int i; |
| 15957 | |
| 15958 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15959 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15960 | if (alc662_is_input_pin(nid)) { |
| 15961 | snd_hda_codec_write(codec, nid, 0, |
| 15962 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15963 | (i <= AUTO_PIN_FRONT_MIC ? |
| 15964 | PIN_VREF80 : PIN_IN)); |
| 15965 | if (nid != ALC662_PIN_CD_NID) |
| 15966 | snd_hda_codec_write(codec, nid, 0, |
| 15967 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15968 | AMP_OUT_MUTE); |
| 15969 | } |
| 15970 | } |
| 15971 | } |
| 15972 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15973 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 15974 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15975 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 15976 | { |
| 15977 | struct alc_spec *spec = codec->spec; |
| 15978 | int err; |
| 15979 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 15980 | |
| 15981 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15982 | alc662_ignore); |
| 15983 | if (err < 0) |
| 15984 | return err; |
| 15985 | if (!spec->autocfg.line_outs) |
| 15986 | return 0; /* can't find valid BIOS pin config */ |
| 15987 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15988 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15989 | if (err < 0) |
| 15990 | return err; |
| 15991 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15992 | if (err < 0) |
| 15993 | return err; |
| 15994 | err = alc662_auto_create_extra_out(spec, |
| 15995 | spec->autocfg.speaker_pins[0], |
| 15996 | "Speaker"); |
| 15997 | if (err < 0) |
| 15998 | return err; |
| 15999 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16000 | "Headphone"); |
| 16001 | if (err < 0) |
| 16002 | return err; |
| 16003 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16004 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16005 | return err; |
| 16006 | |
| 16007 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16008 | |
| 16009 | if (spec->autocfg.dig_out_pin) |
| 16010 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16011 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16012 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16013 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16014 | |
| 16015 | spec->num_mux_defs = 1; |
| 16016 | spec->input_mux = &spec->private_imux; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16017 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16018 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16019 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16020 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16021 | |
| 16022 | err = alc_auto_add_mic_boost(codec); |
| 16023 | if (err < 0) |
| 16024 | return err; |
| 16025 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 16026 | store_pin_configs(codec); |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16027 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16028 | } |
| 16029 | |
| 16030 | /* additional initialization for auto-configuration model */ |
| 16031 | static void alc662_auto_init(struct hda_codec *codec) |
| 16032 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16033 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16034 | alc662_auto_init_multi_out(codec); |
| 16035 | alc662_auto_init_hp_out(codec); |
| 16036 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16037 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16038 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16039 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16040 | } |
| 16041 | |
| 16042 | static int patch_alc662(struct hda_codec *codec) |
| 16043 | { |
| 16044 | struct alc_spec *spec; |
| 16045 | int err, board_config; |
| 16046 | |
| 16047 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16048 | if (!spec) |
| 16049 | return -ENOMEM; |
| 16050 | |
| 16051 | codec->spec = spec; |
| 16052 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16053 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16054 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16055 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16056 | alc662_models, |
| 16057 | alc662_cfg_tbl); |
| 16058 | if (board_config < 0) { |
| 16059 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16060 | "trying auto-probe from BIOS...\n"); |
| 16061 | board_config = ALC662_AUTO; |
| 16062 | } |
| 16063 | |
| 16064 | if (board_config == ALC662_AUTO) { |
| 16065 | /* automatic parse from the BIOS config */ |
| 16066 | err = alc662_parse_auto_config(codec); |
| 16067 | if (err < 0) { |
| 16068 | alc_free(codec); |
| 16069 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16070 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16071 | printk(KERN_INFO |
| 16072 | "hda_codec: Cannot set up configuration " |
| 16073 | "from BIOS. Using base mode...\n"); |
| 16074 | board_config = ALC662_3ST_2ch_DIG; |
| 16075 | } |
| 16076 | } |
| 16077 | |
| 16078 | if (board_config != ALC662_AUTO) |
| 16079 | setup_preset(spec, &alc662_presets[board_config]); |
| 16080 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16081 | if (codec->vendor_id == 0x10ec0663) { |
| 16082 | spec->stream_name_analog = "ALC663 Analog"; |
| 16083 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16084 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16085 | spec->stream_name_analog = "ALC272 Analog"; |
| 16086 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16087 | } else { |
| 16088 | spec->stream_name_analog = "ALC662 Analog"; |
| 16089 | spec->stream_name_digital = "ALC662 Digital"; |
| 16090 | } |
| 16091 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16092 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16093 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16094 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16095 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16096 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16097 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16098 | spec->adc_nids = alc662_adc_nids; |
| 16099 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16100 | spec->capsrc_nids = alc662_capsrc_nids; |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 16101 | spec->is_mix_capture = 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16102 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16103 | if (!spec->cap_mixer) |
| 16104 | set_capture_mixer(spec); |
| 16105 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16106 | spec->vmaster_nid = 0x02; |
| 16107 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16108 | codec->patch_ops = alc_patch_ops; |
| 16109 | if (board_config == ALC662_AUTO) |
| 16110 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16111 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16112 | if (!spec->loopback.amplist) |
| 16113 | spec->loopback.amplist = alc662_loopbacks; |
| 16114 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16115 | |
| 16116 | return 0; |
| 16117 | } |
| 16118 | |
| 16119 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16120 | * patch entries |
| 16121 | */ |
| 16122 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 16123 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16124 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16125 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16126 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16127 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16128 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16129 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16130 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16131 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16132 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16133 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16134 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16135 | .patch = patch_alc883 }, |
| 16136 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16137 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16138 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16139 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16140 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16141 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16142 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16143 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16144 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16145 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16146 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16147 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16148 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 16149 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 16150 | .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16151 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16152 | {} /* terminator */ |
| 16153 | }; |