Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 33 | #include "hda_patch.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 81 | #ifdef CONFIG_SND_DEBUG |
| 82 | ALC260_TEST, |
| 83 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 84 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 85 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 88 | /* ALC262 models */ |
| 89 | enum { |
| 90 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 91 | ALC262_HIPPO, |
| 92 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 93 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 94 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 95 | ALC262_HP_BPC_D7000_WL, |
| 96 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 97 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 98 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 99 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 100 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 101 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 102 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 103 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 104 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 105 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_RX1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 107 | ALC262_AUTO, |
| 108 | ALC262_MODEL_LAST /* last tag */ |
| 109 | }; |
| 110 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 111 | /* ALC268 models */ |
| 112 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 113 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 115 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 116 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 117 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 118 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 119 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 120 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 121 | #ifdef CONFIG_SND_DEBUG |
| 122 | ALC268_TEST, |
| 123 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 124 | ALC268_AUTO, |
| 125 | ALC268_MODEL_LAST /* last tag */ |
| 126 | }; |
| 127 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 128 | /* ALC269 models */ |
| 129 | enum { |
| 130 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 131 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 132 | ALC269_ASUS_EEEPC_P703, |
| 133 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 134 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 135 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 136 | ALC269_AUTO, |
| 137 | ALC269_MODEL_LAST /* last tag */ |
| 138 | }; |
| 139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 140 | /* ALC861 models */ |
| 141 | enum { |
| 142 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 143 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 144 | ALC861_3ST_DIG, |
| 145 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 146 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 147 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 148 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 149 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_AUTO, |
| 151 | ALC861_MODEL_LAST, |
| 152 | }; |
| 153 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 154 | /* ALC861-VD models */ |
| 155 | enum { |
| 156 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 157 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 158 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 159 | ALC861VD_3ST, |
| 160 | ALC861VD_3ST_DIG, |
| 161 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 162 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 163 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 164 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_AUTO, |
| 166 | ALC861VD_MODEL_LAST, |
| 167 | }; |
| 168 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 169 | /* ALC662 models */ |
| 170 | enum { |
| 171 | ALC662_3ST_2ch_DIG, |
| 172 | ALC662_3ST_6ch_DIG, |
| 173 | ALC662_3ST_6ch, |
| 174 | ALC662_5ST_DIG, |
| 175 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 176 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 177 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 178 | ALC663_ASUS_M51VA, |
| 179 | ALC663_ASUS_G71V, |
| 180 | ALC663_ASUS_H13, |
| 181 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 182 | ALC662_ECS, |
| 183 | ALC663_ASUS_MODE1, |
| 184 | ALC662_ASUS_MODE2, |
| 185 | ALC663_ASUS_MODE3, |
| 186 | ALC663_ASUS_MODE4, |
| 187 | ALC663_ASUS_MODE5, |
| 188 | ALC663_ASUS_MODE6, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 189 | ALC662_AUTO, |
| 190 | ALC662_MODEL_LAST, |
| 191 | }; |
| 192 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 193 | /* ALC882 models */ |
| 194 | enum { |
| 195 | ALC882_3ST_DIG, |
| 196 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 197 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 198 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 199 | ALC882_TARGA, |
| 200 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 201 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 202 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 203 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 204 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 205 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 206 | ALC882_MODEL_LAST, |
| 207 | }; |
| 208 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 209 | /* ALC883 models */ |
| 210 | enum { |
| 211 | ALC883_3ST_2ch_DIG, |
| 212 | ALC883_3ST_6ch_DIG, |
| 213 | ALC883_3ST_6ch, |
| 214 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 215 | ALC883_TARGA_DIG, |
| 216 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 217 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 218 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 219 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 220 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 221 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 222 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 223 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 224 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 225 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 226 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 227 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 228 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 229 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 230 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 231 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 232 | ALC883_3ST_6ch_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 233 | ALC888_ASUS_M90V, |
| 234 | ALC888_ASUS_EEE1601, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 235 | ALC1200_ASUS_P5Q, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 236 | ALC883_AUTO, |
| 237 | ALC883_MODEL_LAST, |
| 238 | }; |
| 239 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 240 | /* for GPIO Poll */ |
| 241 | #define GPIO_MASK 0x03 |
| 242 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | struct alc_spec { |
| 244 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 245 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 247 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 249 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 250 | * don't forget NULL |
| 251 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 252 | */ |
| 253 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 255 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | struct hda_pcm_stream *stream_analog_playback; |
| 257 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 258 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 259 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 261 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | struct hda_pcm_stream *stream_digital_playback; |
| 263 | struct hda_pcm_stream *stream_digital_capture; |
| 264 | |
| 265 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 266 | struct hda_multi_out multiout; /* playback set-up |
| 267 | * max_channels, dacs must be set |
| 268 | * dig_out_nid and hp_nid are optional |
| 269 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 270 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
| 272 | /* capture */ |
| 273 | unsigned int num_adc_nids; |
| 274 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 275 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 276 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 277 | unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | |
| 279 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 280 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | const struct hda_input_mux *input_mux; |
| 282 | unsigned int cur_mux[3]; |
| 283 | |
| 284 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 285 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 287 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | |
| 289 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 290 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 291 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 292 | /* dynamic controls, init_verbs and input_mux */ |
| 293 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 294 | struct snd_array kctls; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 295 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 296 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 297 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 298 | /* hooks */ |
| 299 | void (*init_hook)(struct hda_codec *codec); |
| 300 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 301 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 302 | /* for pin sensing */ |
| 303 | unsigned int sense_updated: 1; |
| 304 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 305 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 306 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 307 | /* for virtual master */ |
| 308 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 309 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 310 | struct hda_loopback_check loopback; |
| 311 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 312 | |
| 313 | /* for PLL fix */ |
| 314 | hda_nid_t pll_nid; |
| 315 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 316 | |
| 317 | #ifdef SND_HDA_NEEDS_RESUME |
| 318 | #define ALC_MAX_PINS 16 |
| 319 | unsigned int num_pins; |
| 320 | hda_nid_t pin_nids[ALC_MAX_PINS]; |
| 321 | unsigned int pin_cfgs[ALC_MAX_PINS]; |
| 322 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 323 | }; |
| 324 | |
| 325 | /* |
| 326 | * configuration template - to be copied to the spec instance |
| 327 | */ |
| 328 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 329 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 330 | * with spec |
| 331 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 332 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 333 | const struct hda_verb *init_verbs[5]; |
| 334 | unsigned int num_dacs; |
| 335 | hda_nid_t *dac_nids; |
| 336 | hda_nid_t dig_out_nid; /* optional */ |
| 337 | hda_nid_t hp_nid; /* optional */ |
| 338 | unsigned int num_adc_nids; |
| 339 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 340 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 341 | hda_nid_t dig_in_nid; |
| 342 | unsigned int num_channel_mode; |
| 343 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 344 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 345 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 346 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 347 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 348 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 350 | struct hda_amp_list *loopbacks; |
| 351 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | }; |
| 353 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | |
| 355 | /* |
| 356 | * input MUX handling |
| 357 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 358 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 359 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | { |
| 361 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 362 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 363 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 364 | if (mux_idx >= spec->num_mux_defs) |
| 365 | mux_idx = 0; |
| 366 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | } |
| 368 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 370 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | { |
| 372 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 373 | struct alc_spec *spec = codec->spec; |
| 374 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 375 | |
| 376 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 377 | return 0; |
| 378 | } |
| 379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 380 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 381 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | { |
| 383 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 384 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame^] | 385 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame^] | 387 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 388 | hda_nid_t nid = spec->capsrc_nids ? |
| 389 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame^] | 391 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 392 | imux = &spec->input_mux[mux_idx]; |
| 393 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 394 | if (spec->is_mix_capture) { |
| 395 | /* Matrix-mixer style (e.g. ALC882) */ |
| 396 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 397 | unsigned int i, idx; |
| 398 | |
| 399 | idx = ucontrol->value.enumerated.item[0]; |
| 400 | if (idx >= imux->num_items) |
| 401 | idx = imux->num_items - 1; |
| 402 | if (*cur_val == idx) |
| 403 | return 0; |
| 404 | for (i = 0; i < imux->num_items; i++) { |
| 405 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 406 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 407 | imux->items[i].index, |
| 408 | HDA_AMP_MUTE, v); |
| 409 | } |
| 410 | *cur_val = idx; |
| 411 | return 1; |
| 412 | } else { |
| 413 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame^] | 414 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 415 | &spec->cur_mux[adc_idx]); |
| 416 | } |
| 417 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 418 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | /* |
| 420 | * channel mode setting |
| 421 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 422 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 423 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | { |
| 425 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 426 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 427 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 428 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | } |
| 430 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 431 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 432 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | { |
| 434 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 435 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 436 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 437 | spec->num_channel_mode, |
| 438 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | } |
| 440 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 441 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 442 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | { |
| 444 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 445 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 446 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 447 | spec->num_channel_mode, |
| 448 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 449 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 450 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 451 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | } |
| 453 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 455 | * 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] | 456 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 457 | * being part of a format specifier. Maximum allowed length of a value is |
| 458 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 459 | * |
| 460 | * Note: some retasking pin complexes seem to ignore requests for input |
| 461 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 462 | * are requested. Therefore order this list so that this behaviour will not |
| 463 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 464 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 465 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 466 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 468 | "Mic 50pc bias", "Mic 80pc bias", |
| 469 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 470 | }; |
| 471 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 472 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 473 | }; |
| 474 | /* 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] | 475 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 476 | * addition, "input" pins may or may not process the mic bias option |
| 477 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 478 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 479 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 480 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 481 | #define ALC_PIN_DIR_IN 0x00 |
| 482 | #define ALC_PIN_DIR_OUT 0x01 |
| 483 | #define ALC_PIN_DIR_INOUT 0x02 |
| 484 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 485 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 486 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 487 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 488 | * For each direction the minimum and maximum values are given. |
| 489 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 490 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 491 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 492 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 493 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 494 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 495 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 496 | }; |
| 497 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 498 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 499 | #define alc_pin_mode_n_items(_dir) \ |
| 500 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 501 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 502 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 503 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 504 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 505 | unsigned int item_num = uinfo->value.enumerated.item; |
| 506 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 507 | |
| 508 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 509 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 511 | |
| 512 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 513 | item_num = alc_pin_mode_min(dir); |
| 514 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 515 | return 0; |
| 516 | } |
| 517 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 518 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 519 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 520 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 521 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 522 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 523 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 524 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 525 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 526 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 527 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 528 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 529 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 530 | /* Find enumerated value for current pinctl setting */ |
| 531 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 532 | 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] | 533 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | *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] | 535 | return 0; |
| 536 | } |
| 537 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 539 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | { |
| 541 | signed int change; |
| 542 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 543 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 544 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 545 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 547 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 548 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 549 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 550 | 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] | 551 | val = alc_pin_mode_min(dir); |
| 552 | |
| 553 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 554 | if (change) { |
| 555 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 556 | snd_hda_codec_write_cache(codec, nid, 0, |
| 557 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 558 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 559 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 560 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 561 | * for the requested pin mode. Enum values of 2 or less are |
| 562 | * input modes. |
| 563 | * |
| 564 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 565 | * reduces noise slightly (particularly on input) so we'll |
| 566 | * do it. However, having both input and output buffers |
| 567 | * enabled simultaneously doesn't seem to be problematic if |
| 568 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 569 | */ |
| 570 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 571 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 572 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 573 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 574 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 575 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 576 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 577 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 578 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 579 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 580 | } |
| 581 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 582 | return change; |
| 583 | } |
| 584 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 585 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 586 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 587 | .info = alc_pin_mode_info, \ |
| 588 | .get = alc_pin_mode_get, \ |
| 589 | .put = alc_pin_mode_put, \ |
| 590 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 591 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 592 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 593 | * together using a mask with more than one bit set. This control is |
| 594 | * currently used only by the ALC260 test model. At this stage they are not |
| 595 | * needed for any "production" models. |
| 596 | */ |
| 597 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 598 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 599 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 600 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 601 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 602 | { |
| 603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 604 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 605 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 606 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 607 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 608 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 609 | |
| 610 | *valp = (val & mask) != 0; |
| 611 | return 0; |
| 612 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 613 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 614 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 615 | { |
| 616 | signed int change; |
| 617 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 618 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 619 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 620 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 621 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 622 | AC_VERB_GET_GPIO_DATA, |
| 623 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 624 | |
| 625 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 627 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 628 | gpio_data &= ~mask; |
| 629 | else |
| 630 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 631 | snd_hda_codec_write_cache(codec, nid, 0, |
| 632 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 633 | |
| 634 | return change; |
| 635 | } |
| 636 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 637 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 638 | .info = alc_gpio_data_info, \ |
| 639 | .get = alc_gpio_data_get, \ |
| 640 | .put = alc_gpio_data_put, \ |
| 641 | .private_value = nid | (mask<<16) } |
| 642 | #endif /* CONFIG_SND_DEBUG */ |
| 643 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 644 | /* A switch control to allow the enabling of the digital IO pins on the |
| 645 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 646 | * to provide something in the test model allowing digital outputs to be |
| 647 | * identified if present. If models are found which can utilise these |
| 648 | * outputs a more complete mixer control can be devised for those models if |
| 649 | * necessary. |
| 650 | */ |
| 651 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 652 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 653 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 654 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 655 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 656 | { |
| 657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 658 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 659 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 660 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 661 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 662 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 663 | |
| 664 | *valp = (val & mask) != 0; |
| 665 | return 0; |
| 666 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 667 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 668 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 669 | { |
| 670 | signed int change; |
| 671 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 672 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 673 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 674 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 675 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 676 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 677 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 678 | |
| 679 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 680 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 681 | if (val==0) |
| 682 | ctrl_data &= ~mask; |
| 683 | else |
| 684 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 685 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 686 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 687 | |
| 688 | return change; |
| 689 | } |
| 690 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 691 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 692 | .info = alc_spdif_ctrl_info, \ |
| 693 | .get = alc_spdif_ctrl_get, \ |
| 694 | .put = alc_spdif_ctrl_put, \ |
| 695 | .private_value = nid | (mask<<16) } |
| 696 | #endif /* CONFIG_SND_DEBUG */ |
| 697 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 698 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 699 | * Again, this is only used in the ALC26x test models to help identify when |
| 700 | * the EAPD line must be asserted for features to work. |
| 701 | */ |
| 702 | #ifdef CONFIG_SND_DEBUG |
| 703 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 704 | |
| 705 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 706 | struct snd_ctl_elem_value *ucontrol) |
| 707 | { |
| 708 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 709 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 710 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 711 | long *valp = ucontrol->value.integer.value; |
| 712 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 713 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 714 | |
| 715 | *valp = (val & mask) != 0; |
| 716 | return 0; |
| 717 | } |
| 718 | |
| 719 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 720 | struct snd_ctl_elem_value *ucontrol) |
| 721 | { |
| 722 | int change; |
| 723 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 724 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 725 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 726 | long val = *ucontrol->value.integer.value; |
| 727 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 728 | AC_VERB_GET_EAPD_BTLENABLE, |
| 729 | 0x00); |
| 730 | |
| 731 | /* Set/unset the masked control bit(s) as needed */ |
| 732 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 733 | if (!val) |
| 734 | ctrl_data &= ~mask; |
| 735 | else |
| 736 | ctrl_data |= mask; |
| 737 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 738 | ctrl_data); |
| 739 | |
| 740 | return change; |
| 741 | } |
| 742 | |
| 743 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 744 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 745 | .info = alc_eapd_ctrl_info, \ |
| 746 | .get = alc_eapd_ctrl_get, \ |
| 747 | .put = alc_eapd_ctrl_put, \ |
| 748 | .private_value = nid | (mask<<16) } |
| 749 | #endif /* CONFIG_SND_DEBUG */ |
| 750 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 751 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 752 | */ |
| 753 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 754 | { |
| 755 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 756 | return; |
| 757 | spec->mixers[spec->num_mixers++] = mix; |
| 758 | } |
| 759 | |
| 760 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 761 | { |
| 762 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 763 | return; |
| 764 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 765 | } |
| 766 | |
| 767 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 768 | * set up from the preset table |
| 769 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 770 | static void setup_preset(struct alc_spec *spec, |
| 771 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 772 | { |
| 773 | int i; |
| 774 | |
| 775 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 776 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 777 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 778 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 779 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 780 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 781 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 782 | spec->channel_mode = preset->channel_mode; |
| 783 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 784 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 785 | |
| 786 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 787 | |
| 788 | spec->multiout.num_dacs = preset->num_dacs; |
| 789 | spec->multiout.dac_nids = preset->dac_nids; |
| 790 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 791 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 792 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 793 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 794 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 795 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 796 | spec->input_mux = preset->input_mux; |
| 797 | |
| 798 | spec->num_adc_nids = preset->num_adc_nids; |
| 799 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 800 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 801 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 802 | |
| 803 | spec->unsol_event = preset->unsol_event; |
| 804 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 805 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 806 | spec->loopback.amplist = preset->loopbacks; |
| 807 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 808 | } |
| 809 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 810 | /* Enable GPIO mask and set output */ |
| 811 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 812 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 813 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 814 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 815 | { } |
| 816 | }; |
| 817 | |
| 818 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 819 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 820 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 821 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 822 | { } |
| 823 | }; |
| 824 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 825 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 826 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 827 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 828 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 829 | { } |
| 830 | }; |
| 831 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 832 | /* |
| 833 | * Fix hardware PLL issue |
| 834 | * On some codecs, the analog PLL gating control must be off while |
| 835 | * the default value is 1. |
| 836 | */ |
| 837 | static void alc_fix_pll(struct hda_codec *codec) |
| 838 | { |
| 839 | struct alc_spec *spec = codec->spec; |
| 840 | unsigned int val; |
| 841 | |
| 842 | if (!spec->pll_nid) |
| 843 | return; |
| 844 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 845 | spec->pll_coef_idx); |
| 846 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 847 | AC_VERB_GET_PROC_COEF, 0); |
| 848 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 849 | spec->pll_coef_idx); |
| 850 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 851 | val & ~(1 << spec->pll_coef_bit)); |
| 852 | } |
| 853 | |
| 854 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 855 | unsigned int coef_idx, unsigned int coef_bit) |
| 856 | { |
| 857 | struct alc_spec *spec = codec->spec; |
| 858 | spec->pll_nid = nid; |
| 859 | spec->pll_coef_idx = coef_idx; |
| 860 | spec->pll_coef_bit = coef_bit; |
| 861 | alc_fix_pll(codec); |
| 862 | } |
| 863 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 864 | static void alc_sku_automute(struct hda_codec *codec) |
| 865 | { |
| 866 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 867 | unsigned int present; |
| 868 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 869 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 870 | |
| 871 | /* need to execute and sync at first */ |
| 872 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 873 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 874 | AC_VERB_GET_PIN_SENSE, 0); |
| 875 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 876 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 877 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 878 | } |
| 879 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 880 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 881 | static void alc_mic_automute(struct hda_codec *codec) |
| 882 | { |
| 883 | struct alc_spec *spec = codec->spec; |
| 884 | unsigned int present; |
| 885 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 886 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 887 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 888 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 889 | |
| 890 | capsrc_idx_mic = mic_nid - 0x18; |
| 891 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 892 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 893 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 894 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 895 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 896 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 897 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 898 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 899 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 900 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 901 | #else |
| 902 | #define alc_mic_automute(codec) /* NOP */ |
| 903 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 904 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | /* unsolicited event for HP jack sensing */ |
| 906 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 907 | { |
| 908 | if (codec->vendor_id == 0x10ec0880) |
| 909 | res >>= 28; |
| 910 | else |
| 911 | res >>= 26; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 912 | if (res == ALC880_HP_EVENT) |
| 913 | alc_sku_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 914 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 915 | if (res == ALC880_MIC_EVENT) |
| 916 | alc_mic_automute(codec); |
| 917 | } |
| 918 | |
| 919 | static void alc_inithook(struct hda_codec *codec) |
| 920 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 921 | alc_sku_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 922 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 923 | } |
| 924 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 925 | /* additional initialization for ALC888 variants */ |
| 926 | static void alc888_coef_init(struct hda_codec *codec) |
| 927 | { |
| 928 | unsigned int tmp; |
| 929 | |
| 930 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 931 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 932 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 933 | if ((tmp & 0xf0) == 2) |
| 934 | /* alc888S-VC */ |
| 935 | snd_hda_codec_read(codec, 0x20, 0, |
| 936 | AC_VERB_SET_PROC_COEF, 0x830); |
| 937 | else |
| 938 | /* alc888-VB */ |
| 939 | snd_hda_codec_read(codec, 0x20, 0, |
| 940 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 941 | } |
| 942 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 943 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 944 | * 31 ~ 16 : Manufacture ID |
| 945 | * 15 ~ 8 : SKU ID |
| 946 | * 7 ~ 0 : Assembly ID |
| 947 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 948 | */ |
| 949 | static void alc_subsystem_id(struct hda_codec *codec, |
| 950 | unsigned int porta, unsigned int porte, |
| 951 | unsigned int portd) |
| 952 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 953 | unsigned int ass, tmp, i; |
| 954 | unsigned nid; |
| 955 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 956 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 957 | ass = codec->subsystem_id & 0xffff; |
| 958 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 959 | goto do_sku; |
| 960 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 961 | /* |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | * 31~30 : port conetcivity |
| 963 | * 29~21 : reserve |
| 964 | * 20 : PCBEEP input |
| 965 | * 19~16 : Check sum (15:1) |
| 966 | * 15~1 : Custom |
| 967 | * 0 : override |
| 968 | */ |
| 969 | nid = 0x1d; |
| 970 | if (codec->vendor_id == 0x10ec0260) |
| 971 | nid = 0x17; |
| 972 | ass = snd_hda_codec_read(codec, nid, 0, |
| 973 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 974 | if (!(ass & 1) && !(ass & 0x100000)) |
| 975 | return; |
| 976 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 977 | return; |
| 978 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 979 | /* check sum */ |
| 980 | tmp = 0; |
| 981 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 982 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 983 | tmp++; |
| 984 | } |
| 985 | if (((ass >> 16) & 0xf) != tmp) |
| 986 | return; |
| 987 | do_sku: |
| 988 | /* |
| 989 | * 0 : override |
| 990 | * 1 : Swap Jack |
| 991 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 992 | * 3~5 : External Amplifier control |
| 993 | * 7~6 : Reserved |
| 994 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 995 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 996 | switch (tmp) { |
| 997 | case 1: |
| 998 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 999 | break; |
| 1000 | case 3: |
| 1001 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1002 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1003 | case 7: |
| 1004 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1005 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1006 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1007 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1008 | case 0x10ec0260: |
| 1009 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1010 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1011 | snd_hda_codec_write(codec, 0x10, 0, |
| 1012 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1013 | break; |
| 1014 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1015 | case 0x10ec0267: |
| 1016 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1017 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1018 | case 0x10ec0660: |
| 1019 | case 0x10ec0662: |
| 1020 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1021 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1022 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1023 | snd_hda_codec_write(codec, 0x14, 0, |
| 1024 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1025 | snd_hda_codec_write(codec, 0x15, 0, |
| 1026 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1027 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1028 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1029 | switch (codec->vendor_id) { |
| 1030 | case 0x10ec0260: |
| 1031 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1032 | AC_VERB_SET_COEF_INDEX, 7); |
| 1033 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1034 | AC_VERB_GET_PROC_COEF, 0); |
| 1035 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1036 | AC_VERB_SET_COEF_INDEX, 7); |
| 1037 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1038 | AC_VERB_SET_PROC_COEF, |
| 1039 | tmp | 0x2010); |
| 1040 | break; |
| 1041 | case 0x10ec0262: |
| 1042 | case 0x10ec0880: |
| 1043 | case 0x10ec0882: |
| 1044 | case 0x10ec0883: |
| 1045 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1046 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1047 | snd_hda_codec_write(codec, 0x20, 0, |
| 1048 | AC_VERB_SET_COEF_INDEX, 7); |
| 1049 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1050 | AC_VERB_GET_PROC_COEF, 0); |
| 1051 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1052 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1053 | snd_hda_codec_write(codec, 0x20, 0, |
| 1054 | AC_VERB_SET_PROC_COEF, |
| 1055 | tmp | 0x2010); |
| 1056 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1057 | case 0x10ec0888: |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 1058 | /*alc888_coef_init(codec);*/ /* called in alc_init() */ |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1059 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1060 | case 0x10ec0267: |
| 1061 | case 0x10ec0268: |
| 1062 | snd_hda_codec_write(codec, 0x20, 0, |
| 1063 | AC_VERB_SET_COEF_INDEX, 7); |
| 1064 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1065 | AC_VERB_GET_PROC_COEF, 0); |
| 1066 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1067 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1068 | snd_hda_codec_write(codec, 0x20, 0, |
| 1069 | AC_VERB_SET_PROC_COEF, |
| 1070 | tmp | 0x3000); |
| 1071 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1072 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1073 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1074 | break; |
| 1075 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1076 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1077 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1078 | * when the external headphone out jack is plugged" |
| 1079 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1080 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1081 | return; |
| 1082 | /* |
| 1083 | * 10~8 : Jack location |
| 1084 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1085 | * 14~13: Resvered |
| 1086 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1087 | * when the external headphone out jack is plugged" |
| 1088 | */ |
| 1089 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1090 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1091 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1092 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1093 | else |
| 1094 | return; |
| 1095 | } |
| 1096 | |
| 1097 | if (!spec->autocfg.hp_pins[0]) { |
| 1098 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1099 | if (tmp == 0) |
| 1100 | spec->autocfg.hp_pins[0] = porta; |
| 1101 | else if (tmp == 1) |
| 1102 | spec->autocfg.hp_pins[0] = porte; |
| 1103 | else if (tmp == 2) |
| 1104 | spec->autocfg.hp_pins[0] = portd; |
| 1105 | else |
| 1106 | return; |
| 1107 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1108 | if (spec->autocfg.hp_pins[0]) |
| 1109 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1110 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1111 | AC_USRSP_EN | ALC880_HP_EVENT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1113 | #if 0 /* it's broken in some acses -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1114 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
| 1115 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
| 1116 | snd_hda_codec_write(codec, |
| 1117 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
| 1118 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1119 | AC_USRSP_EN | ALC880_MIC_EVENT); |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 1120 | #endif /* disabled */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1121 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1122 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1123 | } |
| 1124 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1125 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1126 | * Fix-up pin default configurations |
| 1127 | */ |
| 1128 | |
| 1129 | struct alc_pincfg { |
| 1130 | hda_nid_t nid; |
| 1131 | u32 val; |
| 1132 | }; |
| 1133 | |
| 1134 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1135 | const struct snd_pci_quirk *quirk, |
| 1136 | const struct alc_pincfg **pinfix) |
| 1137 | { |
| 1138 | const struct alc_pincfg *cfg; |
| 1139 | |
| 1140 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1141 | if (!quirk) |
| 1142 | return; |
| 1143 | |
| 1144 | cfg = pinfix[quirk->value]; |
| 1145 | for (; cfg->nid; cfg++) { |
| 1146 | int i; |
| 1147 | u32 val = cfg->val; |
| 1148 | for (i = 0; i < 4; i++) { |
| 1149 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1150 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1151 | val & 0xff); |
| 1152 | val >>= 8; |
| 1153 | } |
| 1154 | } |
| 1155 | } |
| 1156 | |
| 1157 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1158 | * ALC880 3-stack model |
| 1159 | * |
| 1160 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1161 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1162 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1163 | */ |
| 1164 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1165 | static hda_nid_t alc880_dac_nids[4] = { |
| 1166 | /* front, rear, clfe, rear_surr */ |
| 1167 | 0x02, 0x05, 0x04, 0x03 |
| 1168 | }; |
| 1169 | |
| 1170 | static hda_nid_t alc880_adc_nids[3] = { |
| 1171 | /* ADC0-2 */ |
| 1172 | 0x07, 0x08, 0x09, |
| 1173 | }; |
| 1174 | |
| 1175 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1176 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1177 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1178 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1179 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1180 | /* ADC1-2 */ |
| 1181 | 0x08, 0x09, |
| 1182 | }; |
| 1183 | |
| 1184 | #define ALC880_DIGOUT_NID 0x06 |
| 1185 | #define ALC880_DIGIN_NID 0x0a |
| 1186 | |
| 1187 | static struct hda_input_mux alc880_capture_source = { |
| 1188 | .num_items = 4, |
| 1189 | .items = { |
| 1190 | { "Mic", 0x0 }, |
| 1191 | { "Front Mic", 0x3 }, |
| 1192 | { "Line", 0x2 }, |
| 1193 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1194 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1195 | }; |
| 1196 | |
| 1197 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1198 | /* 2ch mode */ |
| 1199 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1200 | /* set line-in to input, mute it */ |
| 1201 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1202 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1203 | /* set mic-in to input vref 80%, mute it */ |
| 1204 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1205 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1206 | { } /* end */ |
| 1207 | }; |
| 1208 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1209 | /* 6ch mode */ |
| 1210 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1211 | /* set line-in to output, unmute it */ |
| 1212 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1213 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1214 | /* set mic-in to output, unmute it */ |
| 1215 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1216 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1217 | { } /* end */ |
| 1218 | }; |
| 1219 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1220 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1221 | { 2, alc880_threestack_ch2_init }, |
| 1222 | { 6, alc880_threestack_ch6_init }, |
| 1223 | }; |
| 1224 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1225 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1226 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1227 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1228 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1229 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1230 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1231 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1232 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1233 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1234 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1235 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1237 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1240 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1241 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1242 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1243 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1244 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1245 | { |
| 1246 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1247 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1248 | .info = alc_ch_mode_info, |
| 1249 | .get = alc_ch_mode_get, |
| 1250 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1251 | }, |
| 1252 | { } /* end */ |
| 1253 | }; |
| 1254 | |
| 1255 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1256 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1257 | struct snd_ctl_elem_info *uinfo) |
| 1258 | { |
| 1259 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1260 | struct alc_spec *spec = codec->spec; |
| 1261 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1263 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1264 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1265 | HDA_INPUT); |
| 1266 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
| 1267 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1268 | return err; |
| 1269 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1270 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1271 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1272 | unsigned int size, unsigned int __user *tlv) |
| 1273 | { |
| 1274 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1275 | struct alc_spec *spec = codec->spec; |
| 1276 | int err; |
| 1277 | |
| 1278 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1279 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1280 | HDA_INPUT); |
| 1281 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
| 1282 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1283 | return err; |
| 1284 | } |
| 1285 | |
| 1286 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1287 | struct snd_ctl_elem_value *ucontrol); |
| 1288 | |
| 1289 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1290 | struct snd_ctl_elem_value *ucontrol, |
| 1291 | getput_call_t func) |
| 1292 | { |
| 1293 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1294 | struct alc_spec *spec = codec->spec; |
| 1295 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1296 | int err; |
| 1297 | |
| 1298 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1299 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1300 | 3, 0, HDA_INPUT); |
| 1301 | err = func(kcontrol, ucontrol); |
| 1302 | mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
| 1303 | return err; |
| 1304 | } |
| 1305 | |
| 1306 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1307 | struct snd_ctl_elem_value *ucontrol) |
| 1308 | { |
| 1309 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1310 | snd_hda_mixer_amp_volume_get); |
| 1311 | } |
| 1312 | |
| 1313 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1314 | struct snd_ctl_elem_value *ucontrol) |
| 1315 | { |
| 1316 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1317 | snd_hda_mixer_amp_volume_put); |
| 1318 | } |
| 1319 | |
| 1320 | /* capture mixer elements */ |
| 1321 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1322 | |
| 1323 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1324 | struct snd_ctl_elem_value *ucontrol) |
| 1325 | { |
| 1326 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1327 | snd_hda_mixer_amp_switch_get); |
| 1328 | } |
| 1329 | |
| 1330 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1331 | struct snd_ctl_elem_value *ucontrol) |
| 1332 | { |
| 1333 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1334 | snd_hda_mixer_amp_switch_put); |
| 1335 | } |
| 1336 | |
| 1337 | #define DEFINE_CAPMIX(num) \ |
| 1338 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1339 | { \ |
| 1340 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1341 | .name = "Capture Switch", \ |
| 1342 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1343 | .count = num, \ |
| 1344 | .info = alc_cap_sw_info, \ |
| 1345 | .get = alc_cap_sw_get, \ |
| 1346 | .put = alc_cap_sw_put, \ |
| 1347 | }, \ |
| 1348 | { \ |
| 1349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1350 | .name = "Capture Volume", \ |
| 1351 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1352 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1353 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1354 | .count = num, \ |
| 1355 | .info = alc_cap_vol_info, \ |
| 1356 | .get = alc_cap_vol_get, \ |
| 1357 | .put = alc_cap_vol_put, \ |
| 1358 | .tlv = { .c = alc_cap_vol_tlv }, \ |
| 1359 | }, \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1360 | { \ |
| 1361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1362 | /* .name = "Capture Source", */ \ |
| 1363 | .name = "Input Source", \ |
| 1364 | .count = num, \ |
| 1365 | .info = alc_mux_enum_info, \ |
| 1366 | .get = alc_mux_enum_get, \ |
| 1367 | .put = alc_mux_enum_put, \ |
| 1368 | }, \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1369 | { } /* end */ \ |
| 1370 | } |
| 1371 | |
| 1372 | /* up to three ADCs */ |
| 1373 | DEFINE_CAPMIX(1); |
| 1374 | DEFINE_CAPMIX(2); |
| 1375 | DEFINE_CAPMIX(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1376 | |
| 1377 | |
| 1378 | /* |
| 1379 | * ALC880 5-stack model |
| 1380 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1381 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1382 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1383 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1384 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1385 | */ |
| 1386 | |
| 1387 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1388 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1389 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1390 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1391 | { } /* end */ |
| 1392 | }; |
| 1393 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1394 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1395 | /* 6ch mode */ |
| 1396 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1397 | /* set line-in to input, mute it */ |
| 1398 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1399 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1400 | { } /* end */ |
| 1401 | }; |
| 1402 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1403 | /* 8ch mode */ |
| 1404 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1405 | /* set line-in to output, unmute it */ |
| 1406 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1407 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1408 | { } /* end */ |
| 1409 | }; |
| 1410 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1411 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1412 | { 6, alc880_fivestack_ch6_init }, |
| 1413 | { 8, alc880_fivestack_ch8_init }, |
| 1414 | }; |
| 1415 | |
| 1416 | |
| 1417 | /* |
| 1418 | * ALC880 6-stack model |
| 1419 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1420 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1421 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1422 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1423 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1424 | */ |
| 1425 | |
| 1426 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1427 | /* front, rear, clfe, rear_surr */ |
| 1428 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1429 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1430 | |
| 1431 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1432 | .num_items = 4, |
| 1433 | .items = { |
| 1434 | { "Mic", 0x0 }, |
| 1435 | { "Front Mic", 0x1 }, |
| 1436 | { "Line", 0x2 }, |
| 1437 | { "CD", 0x4 }, |
| 1438 | }, |
| 1439 | }; |
| 1440 | |
| 1441 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1442 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1443 | { 8, NULL }, |
| 1444 | }; |
| 1445 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1446 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1447 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1448 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1449 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1450 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1451 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1452 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1453 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1454 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1455 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1456 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1457 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1458 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1459 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1460 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1461 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1463 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1464 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1465 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1466 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1467 | { |
| 1468 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1469 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1470 | .info = alc_ch_mode_info, |
| 1471 | .get = alc_ch_mode_get, |
| 1472 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1473 | }, |
| 1474 | { } /* end */ |
| 1475 | }; |
| 1476 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1477 | |
| 1478 | /* |
| 1479 | * ALC880 W810 model |
| 1480 | * |
| 1481 | * W810 has rear IO for: |
| 1482 | * Front (DAC 02) |
| 1483 | * Surround (DAC 03) |
| 1484 | * Center/LFE (DAC 04) |
| 1485 | * Digital out (06) |
| 1486 | * |
| 1487 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1488 | * 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] | 1489 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1490 | * There is a variable resistor to control the speaker or headphone |
| 1491 | * volume. This is a hardware-only device without a software API. |
| 1492 | * |
| 1493 | * Plugging headphones in will disable the internal speakers. This is |
| 1494 | * implemented in hardware, not via the driver using jack sense. In |
| 1495 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1496 | * disable both the speakers and headphones. |
| 1497 | * |
| 1498 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1499 | * These may not do anything useful with this driver yet, because I |
| 1500 | * haven't setup any initialization verbs for these yet... |
| 1501 | */ |
| 1502 | |
| 1503 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1504 | /* front, rear/surround, clfe */ |
| 1505 | 0x02, 0x03, 0x04 |
| 1506 | }; |
| 1507 | |
| 1508 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1509 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1510 | { 6, NULL } |
| 1511 | }; |
| 1512 | |
| 1513 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1514 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1515 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1516 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1517 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1518 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1519 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1520 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1521 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1522 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1523 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1524 | { } /* end */ |
| 1525 | }; |
| 1526 | |
| 1527 | |
| 1528 | /* |
| 1529 | * Z710V model |
| 1530 | * |
| 1531 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1532 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1533 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1534 | */ |
| 1535 | |
| 1536 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1537 | 0x02 |
| 1538 | }; |
| 1539 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1540 | |
| 1541 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1542 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1543 | { 2, NULL } |
| 1544 | }; |
| 1545 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1546 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1548 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1549 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1550 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1551 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1552 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1553 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1554 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1555 | { } /* end */ |
| 1556 | }; |
| 1557 | |
| 1558 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1559 | /* |
| 1560 | * ALC880 F1734 model |
| 1561 | * |
| 1562 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1563 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1564 | */ |
| 1565 | |
| 1566 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1567 | 0x03 |
| 1568 | }; |
| 1569 | #define ALC880_F1734_HP_DAC 0x02 |
| 1570 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1571 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1572 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1573 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1574 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1575 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1580 | { } /* end */ |
| 1581 | }; |
| 1582 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1583 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1584 | .num_items = 2, |
| 1585 | .items = { |
| 1586 | { "Mic", 0x1 }, |
| 1587 | { "CD", 0x4 }, |
| 1588 | }, |
| 1589 | }; |
| 1590 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1591 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1592 | /* |
| 1593 | * ALC880 ASUS model |
| 1594 | * |
| 1595 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1596 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1597 | * Mic = 0x18, Line = 0x1a |
| 1598 | */ |
| 1599 | |
| 1600 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1601 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1602 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1603 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1604 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1605 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1606 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1607 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1608 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1609 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1610 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1611 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1612 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1613 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1614 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1615 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1618 | { |
| 1619 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1620 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1621 | .info = alc_ch_mode_info, |
| 1622 | .get = alc_ch_mode_get, |
| 1623 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1624 | }, |
| 1625 | { } /* end */ |
| 1626 | }; |
| 1627 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1628 | /* |
| 1629 | * ALC880 ASUS W1V model |
| 1630 | * |
| 1631 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1632 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1633 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1634 | */ |
| 1635 | |
| 1636 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1637 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1638 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1639 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1640 | { } /* end */ |
| 1641 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1642 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1643 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1644 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1645 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1646 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1647 | { } /* end */ |
| 1648 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1649 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1650 | /* TCL S700 */ |
| 1651 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1652 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1653 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1654 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1656 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1659 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1660 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1661 | { } /* end */ |
| 1662 | }; |
| 1663 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1664 | /* Uniwill */ |
| 1665 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1666 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1667 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1668 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1669 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1670 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1671 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1672 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1673 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1674 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1675 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1676 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1677 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1678 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1679 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1680 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1681 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1682 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1683 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1684 | { |
| 1685 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1686 | .name = "Channel Mode", |
| 1687 | .info = alc_ch_mode_info, |
| 1688 | .get = alc_ch_mode_get, |
| 1689 | .put = alc_ch_mode_put, |
| 1690 | }, |
| 1691 | { } /* end */ |
| 1692 | }; |
| 1693 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1694 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1695 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1696 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1697 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1698 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1700 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1701 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1702 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1703 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1704 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1705 | { } /* end */ |
| 1706 | }; |
| 1707 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1708 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1709 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1710 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1711 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1712 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1715 | { } /* end */ |
| 1716 | }; |
| 1717 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1718 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1719 | * virtual master controls |
| 1720 | */ |
| 1721 | |
| 1722 | /* |
| 1723 | * slave controls for virtual master |
| 1724 | */ |
| 1725 | static const char *alc_slave_vols[] = { |
| 1726 | "Front Playback Volume", |
| 1727 | "Surround Playback Volume", |
| 1728 | "Center Playback Volume", |
| 1729 | "LFE Playback Volume", |
| 1730 | "Side Playback Volume", |
| 1731 | "Headphone Playback Volume", |
| 1732 | "Speaker Playback Volume", |
| 1733 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1734 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 1735 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1736 | NULL, |
| 1737 | }; |
| 1738 | |
| 1739 | static const char *alc_slave_sws[] = { |
| 1740 | "Front Playback Switch", |
| 1741 | "Surround Playback Switch", |
| 1742 | "Center Playback Switch", |
| 1743 | "LFE Playback Switch", |
| 1744 | "Side Playback Switch", |
| 1745 | "Headphone Playback Switch", |
| 1746 | "Speaker Playback Switch", |
| 1747 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1748 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1749 | NULL, |
| 1750 | }; |
| 1751 | |
| 1752 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1753 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1754 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1755 | |
| 1756 | static void alc_free_kctls(struct hda_codec *codec); |
| 1757 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1758 | static int alc_build_controls(struct hda_codec *codec) |
| 1759 | { |
| 1760 | struct alc_spec *spec = codec->spec; |
| 1761 | int err; |
| 1762 | int i; |
| 1763 | |
| 1764 | for (i = 0; i < spec->num_mixers; i++) { |
| 1765 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1766 | if (err < 0) |
| 1767 | return err; |
| 1768 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1769 | if (spec->cap_mixer) { |
| 1770 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 1771 | if (err < 0) |
| 1772 | return err; |
| 1773 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1774 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1775 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1776 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1777 | if (err < 0) |
| 1778 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1779 | err = snd_hda_create_spdif_share_sw(codec, |
| 1780 | &spec->multiout); |
| 1781 | if (err < 0) |
| 1782 | return err; |
| 1783 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1784 | } |
| 1785 | if (spec->dig_in_nid) { |
| 1786 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1787 | if (err < 0) |
| 1788 | return err; |
| 1789 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1790 | |
| 1791 | /* if we have no master control, let's create it */ |
| 1792 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1793 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1794 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1795 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1796 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1797 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1798 | if (err < 0) |
| 1799 | return err; |
| 1800 | } |
| 1801 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1802 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1803 | NULL, alc_slave_sws); |
| 1804 | if (err < 0) |
| 1805 | return err; |
| 1806 | } |
| 1807 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1808 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1809 | return 0; |
| 1810 | } |
| 1811 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1812 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1813 | /* |
| 1814 | * initialize the codec volumes, etc |
| 1815 | */ |
| 1816 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1817 | /* |
| 1818 | * generic initialization of ADC, input mixers and output mixers |
| 1819 | */ |
| 1820 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1821 | /* |
| 1822 | * Unmute ADC0-2 and set the default input to mic-in |
| 1823 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1824 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1826 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1827 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1828 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1829 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1830 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1831 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1832 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1833 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1834 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1835 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1836 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1841 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1842 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1843 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1844 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1845 | /* |
| 1846 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1847 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1848 | /* set vol=0 to output mixers */ |
| 1849 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1850 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1852 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1853 | /* set up input amps for analog loopback */ |
| 1854 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1855 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1856 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1857 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1858 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1859 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1860 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1861 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1862 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1863 | |
| 1864 | { } |
| 1865 | }; |
| 1866 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1867 | /* |
| 1868 | * 3-stack pin configuration: |
| 1869 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1870 | */ |
| 1871 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1872 | /* |
| 1873 | * preset connection lists of input pins |
| 1874 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1875 | */ |
| 1876 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1877 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1878 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1879 | |
| 1880 | /* |
| 1881 | * Set pin mode and muting |
| 1882 | */ |
| 1883 | /* set front pin widgets 0x14 for output */ |
| 1884 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1885 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1886 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1887 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1888 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1889 | /* Mic2 (as headphone out) for HP output */ |
| 1890 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1891 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1892 | /* Line In pin widget for input */ |
| 1893 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1894 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1895 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1896 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1897 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1898 | /* CD pin widget for input */ |
| 1899 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1900 | |
| 1901 | { } |
| 1902 | }; |
| 1903 | |
| 1904 | /* |
| 1905 | * 5-stack pin configuration: |
| 1906 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1907 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1908 | */ |
| 1909 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1910 | /* |
| 1911 | * preset connection lists of input pins |
| 1912 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1913 | */ |
| 1914 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1915 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1916 | |
| 1917 | /* |
| 1918 | * Set pin mode and muting |
| 1919 | */ |
| 1920 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1921 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1923 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1924 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1925 | /* unmute pins for output (no gain on this amp) */ |
| 1926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1929 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1930 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1931 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1932 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1933 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1934 | /* Mic2 (as headphone out) for HP output */ |
| 1935 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1936 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1937 | /* Line In pin widget for input */ |
| 1938 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1940 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1941 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1942 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1943 | /* CD pin widget for input */ |
| 1944 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1945 | |
| 1946 | { } |
| 1947 | }; |
| 1948 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1949 | /* |
| 1950 | * W810 pin configuration: |
| 1951 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1952 | */ |
| 1953 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1954 | /* hphone/speaker input selector: front DAC */ |
| 1955 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1956 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1958 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1959 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1960 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1961 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1962 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1963 | |
| 1964 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1965 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1966 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1967 | { } |
| 1968 | }; |
| 1969 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1970 | /* |
| 1971 | * Z71V pin configuration: |
| 1972 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1973 | */ |
| 1974 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1975 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1976 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1977 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1978 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1979 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1980 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1981 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1983 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1984 | |
| 1985 | { } |
| 1986 | }; |
| 1987 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1988 | /* |
| 1989 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1990 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1991 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1992 | */ |
| 1993 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1994 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1995 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1996 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1997 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1998 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1999 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2000 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2001 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2002 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2003 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2004 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2005 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2006 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2008 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2009 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2010 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2011 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2012 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2013 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2014 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2015 | { } |
| 2016 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2017 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2018 | /* |
| 2019 | * Uniwill pin configuration: |
| 2020 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2021 | * line = 0x1a |
| 2022 | */ |
| 2023 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2024 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2025 | |
| 2026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2027 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2029 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2030 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2031 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2032 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2033 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2035 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2036 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2037 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2038 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2039 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2040 | |
| 2041 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2043 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2045 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2046 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2047 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2048 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2049 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2050 | |
| 2051 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2052 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2053 | |
| 2054 | { } |
| 2055 | }; |
| 2056 | |
| 2057 | /* |
| 2058 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2059 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2060 | */ |
| 2061 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2062 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2063 | |
| 2064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2069 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2074 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2076 | |
| 2077 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2079 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2080 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2081 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2082 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2083 | |
| 2084 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2085 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2086 | |
| 2087 | { } |
| 2088 | }; |
| 2089 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2090 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2091 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2092 | { } |
| 2093 | }; |
| 2094 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2095 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2096 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2097 | { |
| 2098 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2099 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2100 | |
| 2101 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2102 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2103 | bits = present ? HDA_AMP_MUTE : 0; |
| 2104 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 2105 | HDA_AMP_MUTE, bits); |
| 2106 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 2107 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2108 | } |
| 2109 | |
| 2110 | /* auto-toggle front mic */ |
| 2111 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2112 | { |
| 2113 | unsigned int present; |
| 2114 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2115 | |
| 2116 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2117 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2118 | bits = present ? HDA_AMP_MUTE : 0; |
| 2119 | 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] | 2120 | } |
| 2121 | |
| 2122 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 2123 | { |
| 2124 | alc880_uniwill_hp_automute(codec); |
| 2125 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2126 | } |
| 2127 | |
| 2128 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2129 | unsigned int res) |
| 2130 | { |
| 2131 | /* Looks like the unsol event is incompatible with the standard |
| 2132 | * definition. 4bit tag is placed at 28 bit! |
| 2133 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2134 | switch (res >> 28) { |
| 2135 | case ALC880_HP_EVENT: |
| 2136 | alc880_uniwill_hp_automute(codec); |
| 2137 | break; |
| 2138 | case ALC880_MIC_EVENT: |
| 2139 | alc880_uniwill_mic_automute(codec); |
| 2140 | break; |
| 2141 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2142 | } |
| 2143 | |
| 2144 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 2145 | { |
| 2146 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2147 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2148 | |
| 2149 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2150 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2151 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 2152 | 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] | 2153 | } |
| 2154 | |
| 2155 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2156 | { |
| 2157 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2158 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2159 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2160 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2161 | present &= HDA_AMP_VOLMASK; |
| 2162 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2163 | HDA_AMP_VOLMASK, present); |
| 2164 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2165 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2166 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2167 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2168 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2169 | unsigned int res) |
| 2170 | { |
| 2171 | /* Looks like the unsol event is incompatible with the standard |
| 2172 | * definition. 4bit tag is placed at 28 bit! |
| 2173 | */ |
| 2174 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2175 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2176 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2177 | alc880_uniwill_p53_dcvol_automute(codec); |
| 2178 | } |
| 2179 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2180 | /* |
| 2181 | * F1734 pin configuration: |
| 2182 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2183 | */ |
| 2184 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2185 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2186 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2187 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2188 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2189 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2190 | |
| 2191 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2192 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2194 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2195 | |
| 2196 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2197 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2198 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2199 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2200 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2201 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2202 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2203 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2204 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2205 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2206 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2207 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2208 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2209 | { } |
| 2210 | }; |
| 2211 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2212 | /* |
| 2213 | * ASUS pin configuration: |
| 2214 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2215 | */ |
| 2216 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2217 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2218 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2219 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2220 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2221 | |
| 2222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2223 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2225 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2228 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2229 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2230 | |
| 2231 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2232 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2233 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2234 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2235 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2237 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2238 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2239 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2240 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2241 | { } |
| 2242 | }; |
| 2243 | |
| 2244 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2245 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2246 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2247 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2248 | /* Clevo m520g init */ |
| 2249 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2250 | /* headphone output */ |
| 2251 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2252 | /* line-out */ |
| 2253 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2254 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2255 | /* Line-in */ |
| 2256 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2257 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2258 | /* CD */ |
| 2259 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2260 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2261 | /* Mic1 (rear panel) */ |
| 2262 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2263 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2264 | /* Mic2 (front panel) */ |
| 2265 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2266 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2267 | /* headphone */ |
| 2268 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2269 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2270 | /* change to EAPD mode */ |
| 2271 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2272 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2273 | |
| 2274 | { } |
| 2275 | }; |
| 2276 | |
| 2277 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2278 | /* change to EAPD mode */ |
| 2279 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2280 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2281 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2282 | /* Headphone output */ |
| 2283 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2284 | /* Front output*/ |
| 2285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2286 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2287 | |
| 2288 | /* Line In pin widget for input */ |
| 2289 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2290 | /* CD pin widget for input */ |
| 2291 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2292 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2293 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2294 | |
| 2295 | /* change to EAPD mode */ |
| 2296 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2297 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2298 | |
| 2299 | { } |
| 2300 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2301 | |
| 2302 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2303 | * LG m1 express dual |
| 2304 | * |
| 2305 | * Pin assignment: |
| 2306 | * Rear Line-In/Out (blue): 0x14 |
| 2307 | * Build-in Mic-In: 0x15 |
| 2308 | * Speaker-out: 0x17 |
| 2309 | * HP-Out (green): 0x1b |
| 2310 | * Mic-In/Out (red): 0x19 |
| 2311 | * SPDIF-Out: 0x1e |
| 2312 | */ |
| 2313 | |
| 2314 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2315 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2316 | 0x05, 0x02, 0x03 |
| 2317 | }; |
| 2318 | |
| 2319 | /* seems analog CD is not working */ |
| 2320 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2321 | .num_items = 3, |
| 2322 | .items = { |
| 2323 | { "Mic", 0x1 }, |
| 2324 | { "Line", 0x5 }, |
| 2325 | { "Internal Mic", 0x6 }, |
| 2326 | }, |
| 2327 | }; |
| 2328 | |
| 2329 | /* 2,4,6 channel modes */ |
| 2330 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2331 | /* set line-in and mic-in to input */ |
| 2332 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2333 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2334 | { } |
| 2335 | }; |
| 2336 | |
| 2337 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2338 | /* set line-in to out and mic-in to input */ |
| 2339 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2340 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2341 | { } |
| 2342 | }; |
| 2343 | |
| 2344 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2345 | /* set line-in and mic-in to output */ |
| 2346 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2347 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2348 | { } |
| 2349 | }; |
| 2350 | |
| 2351 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2352 | { 2, alc880_lg_ch2_init }, |
| 2353 | { 4, alc880_lg_ch4_init }, |
| 2354 | { 6, alc880_lg_ch6_init }, |
| 2355 | }; |
| 2356 | |
| 2357 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2358 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2359 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2360 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2361 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2362 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2363 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2364 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2365 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2368 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2369 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2370 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2371 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2372 | { |
| 2373 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2374 | .name = "Channel Mode", |
| 2375 | .info = alc_ch_mode_info, |
| 2376 | .get = alc_ch_mode_get, |
| 2377 | .put = alc_ch_mode_put, |
| 2378 | }, |
| 2379 | { } /* end */ |
| 2380 | }; |
| 2381 | |
| 2382 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2383 | /* set capture source to mic-in */ |
| 2384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2385 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2386 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2387 | /* mute all amp mixer inputs */ |
| 2388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2391 | /* line-in to input */ |
| 2392 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2393 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2394 | /* built-in mic */ |
| 2395 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2396 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2397 | /* speaker-out */ |
| 2398 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2399 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2400 | /* mic-in to input */ |
| 2401 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2402 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2403 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2404 | /* HP-out */ |
| 2405 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2406 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2407 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2408 | /* jack sense */ |
| 2409 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2410 | { } |
| 2411 | }; |
| 2412 | |
| 2413 | /* toggle speaker-output according to the hp-jack state */ |
| 2414 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2415 | { |
| 2416 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2417 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2418 | |
| 2419 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2420 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2421 | bits = present ? HDA_AMP_MUTE : 0; |
| 2422 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2423 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2424 | } |
| 2425 | |
| 2426 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2427 | { |
| 2428 | /* Looks like the unsol event is incompatible with the standard |
| 2429 | * definition. 4bit tag is placed at 28 bit! |
| 2430 | */ |
| 2431 | if ((res >> 28) == 0x01) |
| 2432 | alc880_lg_automute(codec); |
| 2433 | } |
| 2434 | |
| 2435 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2436 | * LG LW20 |
| 2437 | * |
| 2438 | * Pin assignment: |
| 2439 | * Speaker-out: 0x14 |
| 2440 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2441 | * Built-in Mic-In: 0x19 |
| 2442 | * Line-In: 0x1b |
| 2443 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2444 | * SPDIF-Out: 0x1e |
| 2445 | */ |
| 2446 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2447 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2448 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2449 | .items = { |
| 2450 | { "Mic", 0x0 }, |
| 2451 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2452 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2453 | }, |
| 2454 | }; |
| 2455 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2456 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2457 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2458 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2459 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2460 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2461 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2462 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2463 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2464 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2465 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2466 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2467 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2468 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2469 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2470 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2471 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2472 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2473 | { |
| 2474 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2475 | .name = "Channel Mode", |
| 2476 | .info = alc_ch_mode_info, |
| 2477 | .get = alc_ch_mode_get, |
| 2478 | .put = alc_ch_mode_put, |
| 2479 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2480 | { } /* end */ |
| 2481 | }; |
| 2482 | |
| 2483 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2484 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2485 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2486 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2487 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2488 | /* set capture source to mic-in */ |
| 2489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2491 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2492 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2493 | /* speaker-out */ |
| 2494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2495 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2496 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2497 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2498 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2499 | /* mic-in to input */ |
| 2500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2502 | /* built-in mic */ |
| 2503 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2504 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2505 | /* jack sense */ |
| 2506 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2507 | { } |
| 2508 | }; |
| 2509 | |
| 2510 | /* toggle speaker-output according to the hp-jack state */ |
| 2511 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2512 | { |
| 2513 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2514 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2515 | |
| 2516 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2517 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2518 | bits = present ? HDA_AMP_MUTE : 0; |
| 2519 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2520 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2521 | } |
| 2522 | |
| 2523 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2524 | { |
| 2525 | /* Looks like the unsol event is incompatible with the standard |
| 2526 | * definition. 4bit tag is placed at 28 bit! |
| 2527 | */ |
| 2528 | if ((res >> 28) == 0x01) |
| 2529 | alc880_lg_lw_automute(codec); |
| 2530 | } |
| 2531 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2532 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2533 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2534 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2535 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2536 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2537 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2538 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2539 | { } /* end */ |
| 2540 | }; |
| 2541 | |
| 2542 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2543 | .num_items = 2, |
| 2544 | .items = { |
| 2545 | { "Mic", 0x0 }, |
| 2546 | { "Internal Mic", 0x1 }, |
| 2547 | }, |
| 2548 | }; |
| 2549 | |
| 2550 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2551 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2552 | |
| 2553 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2554 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2555 | |
| 2556 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2557 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2558 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2559 | /* Mic2 (as headphone out) for HP output */ |
| 2560 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2561 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2562 | /* Internal Speaker */ |
| 2563 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2564 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2565 | |
| 2566 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2567 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2568 | |
| 2569 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2570 | { } |
| 2571 | }; |
| 2572 | |
| 2573 | /* toggle speaker-output according to the hp-jack state */ |
| 2574 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2575 | { |
| 2576 | unsigned int present; |
| 2577 | unsigned char bits; |
| 2578 | |
| 2579 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2580 | AC_VERB_GET_PIN_SENSE, 0) |
| 2581 | & AC_PINSENSE_PRESENCE; |
| 2582 | bits = present ? HDA_AMP_MUTE : 0; |
| 2583 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2584 | HDA_AMP_MUTE, bits); |
| 2585 | if (present) |
| 2586 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2587 | else |
| 2588 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2589 | } |
| 2590 | |
| 2591 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2592 | unsigned int res) |
| 2593 | { |
| 2594 | /* Looks like the unsol event is incompatible with the standard |
| 2595 | * definition. 4bit tag is placed at 28 bit! |
| 2596 | */ |
| 2597 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2598 | alc880_medion_rim_automute(codec); |
| 2599 | } |
| 2600 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2601 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2602 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2603 | { 0x0b, HDA_INPUT, 0 }, |
| 2604 | { 0x0b, HDA_INPUT, 1 }, |
| 2605 | { 0x0b, HDA_INPUT, 2 }, |
| 2606 | { 0x0b, HDA_INPUT, 3 }, |
| 2607 | { 0x0b, HDA_INPUT, 4 }, |
| 2608 | { } /* end */ |
| 2609 | }; |
| 2610 | |
| 2611 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2612 | { 0x0b, HDA_INPUT, 1 }, |
| 2613 | { 0x0b, HDA_INPUT, 6 }, |
| 2614 | { 0x0b, HDA_INPUT, 7 }, |
| 2615 | { } /* end */ |
| 2616 | }; |
| 2617 | #endif |
| 2618 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2619 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2620 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2621 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2623 | static int alc_init(struct hda_codec *codec) |
| 2624 | { |
| 2625 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2626 | unsigned int i; |
| 2627 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2628 | alc_fix_pll(codec); |
Takashi Iwai | 1082c74 | 2008-08-22 15:24:22 +0200 | [diff] [blame] | 2629 | if (codec->vendor_id == 0x10ec0888) |
| 2630 | alc888_coef_init(codec); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2631 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2633 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2634 | |
| 2635 | if (spec->init_hook) |
| 2636 | spec->init_hook(codec); |
| 2637 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2638 | return 0; |
| 2639 | } |
| 2640 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2641 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2642 | { |
| 2643 | struct alc_spec *spec = codec->spec; |
| 2644 | |
| 2645 | if (spec->unsol_event) |
| 2646 | spec->unsol_event(codec, res); |
| 2647 | } |
| 2648 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2649 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2650 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2651 | { |
| 2652 | struct alc_spec *spec = codec->spec; |
| 2653 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2654 | } |
| 2655 | #endif |
| 2656 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2657 | /* |
| 2658 | * Analog playback callbacks |
| 2659 | */ |
| 2660 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2661 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2662 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2663 | { |
| 2664 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2665 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2666 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2667 | } |
| 2668 | |
| 2669 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2670 | struct hda_codec *codec, |
| 2671 | unsigned int stream_tag, |
| 2672 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2673 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2674 | { |
| 2675 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2676 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2677 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2678 | } |
| 2679 | |
| 2680 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2681 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2682 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2683 | { |
| 2684 | struct alc_spec *spec = codec->spec; |
| 2685 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2686 | } |
| 2687 | |
| 2688 | /* |
| 2689 | * Digital out |
| 2690 | */ |
| 2691 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2692 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2693 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2694 | { |
| 2695 | struct alc_spec *spec = codec->spec; |
| 2696 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2697 | } |
| 2698 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2699 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2700 | struct hda_codec *codec, |
| 2701 | unsigned int stream_tag, |
| 2702 | unsigned int format, |
| 2703 | struct snd_pcm_substream *substream) |
| 2704 | { |
| 2705 | struct alc_spec *spec = codec->spec; |
| 2706 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2707 | stream_tag, format, substream); |
| 2708 | } |
| 2709 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2710 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2711 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2712 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2713 | { |
| 2714 | struct alc_spec *spec = codec->spec; |
| 2715 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2716 | } |
| 2717 | |
| 2718 | /* |
| 2719 | * Analog capture |
| 2720 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2721 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2722 | struct hda_codec *codec, |
| 2723 | unsigned int stream_tag, |
| 2724 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2725 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2726 | { |
| 2727 | struct alc_spec *spec = codec->spec; |
| 2728 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2729 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2730 | stream_tag, 0, format); |
| 2731 | return 0; |
| 2732 | } |
| 2733 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2734 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2735 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2736 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2737 | { |
| 2738 | struct alc_spec *spec = codec->spec; |
| 2739 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2740 | snd_hda_codec_cleanup_stream(codec, |
| 2741 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2742 | return 0; |
| 2743 | } |
| 2744 | |
| 2745 | |
| 2746 | /* |
| 2747 | */ |
| 2748 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2749 | .substreams = 1, |
| 2750 | .channels_min = 2, |
| 2751 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2752 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2753 | .ops = { |
| 2754 | .open = alc880_playback_pcm_open, |
| 2755 | .prepare = alc880_playback_pcm_prepare, |
| 2756 | .cleanup = alc880_playback_pcm_cleanup |
| 2757 | }, |
| 2758 | }; |
| 2759 | |
| 2760 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2761 | .substreams = 1, |
| 2762 | .channels_min = 2, |
| 2763 | .channels_max = 2, |
| 2764 | /* NID is set in alc_build_pcms */ |
| 2765 | }; |
| 2766 | |
| 2767 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2768 | .substreams = 1, |
| 2769 | .channels_min = 2, |
| 2770 | .channels_max = 2, |
| 2771 | /* NID is set in alc_build_pcms */ |
| 2772 | }; |
| 2773 | |
| 2774 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2775 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2776 | .channels_min = 2, |
| 2777 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2778 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2779 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2780 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2781 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2782 | }, |
| 2783 | }; |
| 2784 | |
| 2785 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2786 | .substreams = 1, |
| 2787 | .channels_min = 2, |
| 2788 | .channels_max = 2, |
| 2789 | /* NID is set in alc_build_pcms */ |
| 2790 | .ops = { |
| 2791 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2792 | .close = alc880_dig_playback_pcm_close, |
| 2793 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2794 | }, |
| 2795 | }; |
| 2796 | |
| 2797 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2798 | .substreams = 1, |
| 2799 | .channels_min = 2, |
| 2800 | .channels_max = 2, |
| 2801 | /* NID is set in alc_build_pcms */ |
| 2802 | }; |
| 2803 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2804 | /* 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] | 2805 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2806 | .substreams = 0, |
| 2807 | .channels_min = 0, |
| 2808 | .channels_max = 0, |
| 2809 | }; |
| 2810 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2811 | static int alc_build_pcms(struct hda_codec *codec) |
| 2812 | { |
| 2813 | struct alc_spec *spec = codec->spec; |
| 2814 | struct hda_pcm *info = spec->pcm_rec; |
| 2815 | int i; |
| 2816 | |
| 2817 | codec->num_pcms = 1; |
| 2818 | codec->pcm_info = info; |
| 2819 | |
| 2820 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2821 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2822 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 2823 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2824 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2825 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2826 | } |
| 2827 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 2828 | if (snd_BUG_ON(!spec->adc_nids)) |
| 2829 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2830 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2831 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2832 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2833 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2834 | if (spec->channel_mode) { |
| 2835 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2836 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2837 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2838 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2839 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2840 | } |
| 2841 | } |
| 2842 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2843 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2844 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2845 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2846 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2847 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2848 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2849 | if (spec->multiout.dig_out_nid && |
| 2850 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2851 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2852 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2853 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2854 | if (spec->dig_in_nid && |
| 2855 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2856 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2857 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2858 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 2859 | /* FIXME: do we need this for all Realtek codec models? */ |
| 2860 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2861 | } |
| 2862 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2863 | /* If the use of more than one ADC is requested for the current |
| 2864 | * model, configure a second analog capture-only PCM. |
| 2865 | */ |
| 2866 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2867 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2868 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2869 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2870 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2871 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2872 | if (spec->alt_dac_nid) { |
| 2873 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2874 | *spec->stream_analog_alt_playback; |
| 2875 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2876 | spec->alt_dac_nid; |
| 2877 | } else { |
| 2878 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2879 | alc_pcm_null_stream; |
| 2880 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2881 | } |
| 2882 | if (spec->num_adc_nids > 1) { |
| 2883 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2884 | *spec->stream_analog_alt_capture; |
| 2885 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2886 | spec->adc_nids[1]; |
| 2887 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2888 | spec->num_adc_nids - 1; |
| 2889 | } else { |
| 2890 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2891 | alc_pcm_null_stream; |
| 2892 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2893 | } |
| 2894 | } |
| 2895 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2896 | return 0; |
| 2897 | } |
| 2898 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2899 | static void alc_free_kctls(struct hda_codec *codec) |
| 2900 | { |
| 2901 | struct alc_spec *spec = codec->spec; |
| 2902 | |
| 2903 | if (spec->kctls.list) { |
| 2904 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 2905 | int i; |
| 2906 | for (i = 0; i < spec->kctls.used; i++) |
| 2907 | kfree(kctl[i].name); |
| 2908 | } |
| 2909 | snd_array_free(&spec->kctls); |
| 2910 | } |
| 2911 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2912 | static void alc_free(struct hda_codec *codec) |
| 2913 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2914 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2915 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2916 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2917 | return; |
| 2918 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2919 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2920 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2921 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2922 | } |
| 2923 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 2924 | #ifdef SND_HDA_NEEDS_RESUME |
| 2925 | static void store_pin_configs(struct hda_codec *codec) |
| 2926 | { |
| 2927 | struct alc_spec *spec = codec->spec; |
| 2928 | hda_nid_t nid, end_nid; |
| 2929 | |
| 2930 | end_nid = codec->start_nid + codec->num_nodes; |
| 2931 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 2932 | unsigned int wid_caps = get_wcaps(codec, nid); |
| 2933 | unsigned int wid_type = |
| 2934 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 2935 | if (wid_type != AC_WID_PIN) |
| 2936 | continue; |
| 2937 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) |
| 2938 | break; |
| 2939 | spec->pin_nids[spec->num_pins] = nid; |
| 2940 | spec->pin_cfgs[spec->num_pins] = |
| 2941 | snd_hda_codec_read(codec, nid, 0, |
| 2942 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 2943 | spec->num_pins++; |
| 2944 | } |
| 2945 | } |
| 2946 | |
| 2947 | static void resume_pin_configs(struct hda_codec *codec) |
| 2948 | { |
| 2949 | struct alc_spec *spec = codec->spec; |
| 2950 | int i; |
| 2951 | |
| 2952 | for (i = 0; i < spec->num_pins; i++) { |
| 2953 | hda_nid_t pin_nid = spec->pin_nids[i]; |
| 2954 | unsigned int pin_config = spec->pin_cfgs[i]; |
| 2955 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2956 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 2957 | pin_config & 0x000000ff); |
| 2958 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2959 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 2960 | (pin_config & 0x0000ff00) >> 8); |
| 2961 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2962 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 2963 | (pin_config & 0x00ff0000) >> 16); |
| 2964 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2965 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 2966 | pin_config >> 24); |
| 2967 | } |
| 2968 | } |
| 2969 | |
| 2970 | static int alc_resume(struct hda_codec *codec) |
| 2971 | { |
| 2972 | resume_pin_configs(codec); |
| 2973 | codec->patch_ops.init(codec); |
| 2974 | snd_hda_codec_resume_amp(codec); |
| 2975 | snd_hda_codec_resume_cache(codec); |
| 2976 | return 0; |
| 2977 | } |
| 2978 | #else |
| 2979 | #define store_pin_configs(codec) |
| 2980 | #endif |
| 2981 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2982 | /* |
| 2983 | */ |
| 2984 | static struct hda_codec_ops alc_patch_ops = { |
| 2985 | .build_controls = alc_build_controls, |
| 2986 | .build_pcms = alc_build_pcms, |
| 2987 | .init = alc_init, |
| 2988 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2989 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 2990 | #ifdef SND_HDA_NEEDS_RESUME |
| 2991 | .resume = alc_resume, |
| 2992 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2993 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2994 | .check_power_status = alc_check_power_status, |
| 2995 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2996 | }; |
| 2997 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2998 | |
| 2999 | /* |
| 3000 | * Test configuration for debugging |
| 3001 | * |
| 3002 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3003 | * enum controls. |
| 3004 | */ |
| 3005 | #ifdef CONFIG_SND_DEBUG |
| 3006 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3007 | 0x02, 0x03, 0x04, 0x05 |
| 3008 | }; |
| 3009 | |
| 3010 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3011 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3012 | .items = { |
| 3013 | { "In-1", 0x0 }, |
| 3014 | { "In-2", 0x1 }, |
| 3015 | { "In-3", 0x2 }, |
| 3016 | { "In-4", 0x3 }, |
| 3017 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3018 | { "Front", 0x5 }, |
| 3019 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3020 | }, |
| 3021 | }; |
| 3022 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3023 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3024 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3025 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3026 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3027 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3028 | }; |
| 3029 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3030 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3031 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3032 | { |
| 3033 | static char *texts[] = { |
| 3034 | "N/A", "Line Out", "HP Out", |
| 3035 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3036 | }; |
| 3037 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3038 | uinfo->count = 1; |
| 3039 | uinfo->value.enumerated.items = 8; |
| 3040 | if (uinfo->value.enumerated.item >= 8) |
| 3041 | uinfo->value.enumerated.item = 7; |
| 3042 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3043 | return 0; |
| 3044 | } |
| 3045 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3046 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3047 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3048 | { |
| 3049 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3050 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3051 | unsigned int pin_ctl, item = 0; |
| 3052 | |
| 3053 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3054 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3055 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3056 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3057 | item = 2; |
| 3058 | else |
| 3059 | item = 1; |
| 3060 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3061 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3062 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3063 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3064 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3065 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3066 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3067 | } |
| 3068 | } |
| 3069 | ucontrol->value.enumerated.item[0] = item; |
| 3070 | return 0; |
| 3071 | } |
| 3072 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3073 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3074 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3075 | { |
| 3076 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3077 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3078 | static unsigned int ctls[] = { |
| 3079 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3080 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3081 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3082 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3083 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3084 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3085 | }; |
| 3086 | unsigned int old_ctl, new_ctl; |
| 3087 | |
| 3088 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3089 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3090 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3091 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3092 | int val; |
| 3093 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3094 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3095 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3096 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3097 | HDA_AMP_MUTE : 0; |
| 3098 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3099 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3100 | return 1; |
| 3101 | } |
| 3102 | return 0; |
| 3103 | } |
| 3104 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3105 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3106 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3107 | { |
| 3108 | static char *texts[] = { |
| 3109 | "Front", "Surround", "CLFE", "Side" |
| 3110 | }; |
| 3111 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3112 | uinfo->count = 1; |
| 3113 | uinfo->value.enumerated.items = 4; |
| 3114 | if (uinfo->value.enumerated.item >= 4) |
| 3115 | uinfo->value.enumerated.item = 3; |
| 3116 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3117 | return 0; |
| 3118 | } |
| 3119 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3120 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3121 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3122 | { |
| 3123 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3124 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3125 | unsigned int sel; |
| 3126 | |
| 3127 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3128 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3129 | return 0; |
| 3130 | } |
| 3131 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3132 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3133 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3134 | { |
| 3135 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3136 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3137 | unsigned int sel; |
| 3138 | |
| 3139 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3140 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3141 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3142 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3143 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3144 | return 1; |
| 3145 | } |
| 3146 | return 0; |
| 3147 | } |
| 3148 | |
| 3149 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3150 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3151 | .name = xname, \ |
| 3152 | .info = alc_test_pin_ctl_info, \ |
| 3153 | .get = alc_test_pin_ctl_get, \ |
| 3154 | .put = alc_test_pin_ctl_put, \ |
| 3155 | .private_value = nid \ |
| 3156 | } |
| 3157 | |
| 3158 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3159 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3160 | .name = xname, \ |
| 3161 | .info = alc_test_pin_src_info, \ |
| 3162 | .get = alc_test_pin_src_get, \ |
| 3163 | .put = alc_test_pin_src_put, \ |
| 3164 | .private_value = nid \ |
| 3165 | } |
| 3166 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3167 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3168 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3169 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3170 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3171 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3172 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3173 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3174 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3175 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3176 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3177 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3178 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3179 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3180 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3181 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3182 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3183 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3184 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3185 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3186 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3187 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3188 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3189 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3190 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3191 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3192 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3193 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3194 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3195 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3198 | { |
| 3199 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3200 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3201 | .info = alc_ch_mode_info, |
| 3202 | .get = alc_ch_mode_get, |
| 3203 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3204 | }, |
| 3205 | { } /* end */ |
| 3206 | }; |
| 3207 | |
| 3208 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3209 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3210 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3211 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3212 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3213 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3214 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3216 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3217 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3218 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3221 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3222 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3223 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3224 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3225 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3227 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3228 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3229 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3230 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3231 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3232 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3233 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3234 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3235 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3236 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3237 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3238 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3239 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3240 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3241 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3242 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3243 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3244 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3245 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3246 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3247 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3248 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3251 | /* Analog input/passthru */ |
| 3252 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3253 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3254 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3255 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3256 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3257 | { } |
| 3258 | }; |
| 3259 | #endif |
| 3260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3261 | /* |
| 3262 | */ |
| 3263 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3264 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3265 | [ALC880_3ST] = "3stack", |
| 3266 | [ALC880_TCL_S700] = "tcl", |
| 3267 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3268 | [ALC880_CLEVO] = "clevo", |
| 3269 | [ALC880_5ST] = "5stack", |
| 3270 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3271 | [ALC880_W810] = "w810", |
| 3272 | [ALC880_Z71V] = "z71v", |
| 3273 | [ALC880_6ST] = "6stack", |
| 3274 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3275 | [ALC880_ASUS] = "asus", |
| 3276 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3277 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3278 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3279 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3280 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3281 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3282 | [ALC880_F1734] = "F1734", |
| 3283 | [ALC880_LG] = "lg", |
| 3284 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3285 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3286 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3287 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3288 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3289 | [ALC880_AUTO] = "auto", |
| 3290 | }; |
| 3291 | |
| 3292 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3293 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3294 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3295 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3296 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3297 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3298 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3299 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3300 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3301 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3302 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3303 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3304 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3305 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3306 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3307 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3308 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3309 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3310 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3311 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3312 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3313 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3314 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3315 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3316 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3317 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3318 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3319 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3320 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3321 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3322 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3323 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3324 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3325 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3326 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3327 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3328 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3329 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3330 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3331 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3332 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3333 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3334 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3335 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3336 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3337 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3338 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3339 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3340 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3341 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3342 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3343 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3344 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3345 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3346 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3347 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3348 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3349 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3350 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3351 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3352 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3353 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3354 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3355 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3356 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3357 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3358 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3359 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3360 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3361 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3362 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3363 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3364 | {} |
| 3365 | }; |
| 3366 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3367 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3368 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3369 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3370 | static struct alc_config_preset alc880_presets[] = { |
| 3371 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3372 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3373 | .init_verbs = { alc880_volume_init_verbs, |
| 3374 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3375 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3376 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3377 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3378 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3379 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3380 | .input_mux = &alc880_capture_source, |
| 3381 | }, |
| 3382 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3383 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3384 | .init_verbs = { alc880_volume_init_verbs, |
| 3385 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3386 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3387 | .dac_nids = alc880_dac_nids, |
| 3388 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3389 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3390 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3391 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3392 | .input_mux = &alc880_capture_source, |
| 3393 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3394 | [ALC880_TCL_S700] = { |
| 3395 | .mixers = { alc880_tcl_s700_mixer }, |
| 3396 | .init_verbs = { alc880_volume_init_verbs, |
| 3397 | alc880_pin_tcl_S700_init_verbs, |
| 3398 | alc880_gpio2_init_verbs }, |
| 3399 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3400 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3401 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3402 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3403 | .hp_nid = 0x03, |
| 3404 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3405 | .channel_mode = alc880_2_jack_modes, |
| 3406 | .input_mux = &alc880_capture_source, |
| 3407 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3408 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3409 | .mixers = { alc880_three_stack_mixer, |
| 3410 | alc880_five_stack_mixer}, |
| 3411 | .init_verbs = { alc880_volume_init_verbs, |
| 3412 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3413 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3414 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3415 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3416 | .channel_mode = alc880_fivestack_modes, |
| 3417 | .input_mux = &alc880_capture_source, |
| 3418 | }, |
| 3419 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3420 | .mixers = { alc880_three_stack_mixer, |
| 3421 | alc880_five_stack_mixer }, |
| 3422 | .init_verbs = { alc880_volume_init_verbs, |
| 3423 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3424 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3425 | .dac_nids = alc880_dac_nids, |
| 3426 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3427 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3428 | .channel_mode = alc880_fivestack_modes, |
| 3429 | .input_mux = &alc880_capture_source, |
| 3430 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3431 | [ALC880_6ST] = { |
| 3432 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3433 | .init_verbs = { alc880_volume_init_verbs, |
| 3434 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3435 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3436 | .dac_nids = alc880_6st_dac_nids, |
| 3437 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3438 | .channel_mode = alc880_sixstack_modes, |
| 3439 | .input_mux = &alc880_6stack_capture_source, |
| 3440 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3441 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3442 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3443 | .init_verbs = { alc880_volume_init_verbs, |
| 3444 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3445 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3446 | .dac_nids = alc880_6st_dac_nids, |
| 3447 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3448 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3449 | .channel_mode = alc880_sixstack_modes, |
| 3450 | .input_mux = &alc880_6stack_capture_source, |
| 3451 | }, |
| 3452 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3453 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3454 | .init_verbs = { alc880_volume_init_verbs, |
| 3455 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3456 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3457 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3458 | .dac_nids = alc880_w810_dac_nids, |
| 3459 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3460 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3461 | .channel_mode = alc880_w810_modes, |
| 3462 | .input_mux = &alc880_capture_source, |
| 3463 | }, |
| 3464 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3465 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3466 | .init_verbs = { alc880_volume_init_verbs, |
| 3467 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3468 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3469 | .dac_nids = alc880_z71v_dac_nids, |
| 3470 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3471 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3472 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3473 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3474 | .input_mux = &alc880_capture_source, |
| 3475 | }, |
| 3476 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3477 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3478 | .init_verbs = { alc880_volume_init_verbs, |
| 3479 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3480 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3481 | .dac_nids = alc880_f1734_dac_nids, |
| 3482 | .hp_nid = 0x02, |
| 3483 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3484 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3485 | .input_mux = &alc880_f1734_capture_source, |
| 3486 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3487 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3488 | }, |
| 3489 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3490 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3491 | .init_verbs = { alc880_volume_init_verbs, |
| 3492 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3493 | alc880_gpio1_init_verbs }, |
| 3494 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3495 | .dac_nids = alc880_asus_dac_nids, |
| 3496 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3497 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3498 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3499 | .input_mux = &alc880_capture_source, |
| 3500 | }, |
| 3501 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3502 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3503 | .init_verbs = { alc880_volume_init_verbs, |
| 3504 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3505 | alc880_gpio1_init_verbs }, |
| 3506 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3507 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3508 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3509 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3510 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3511 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3512 | .input_mux = &alc880_capture_source, |
| 3513 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3514 | [ALC880_ASUS_DIG2] = { |
| 3515 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3516 | .init_verbs = { alc880_volume_init_verbs, |
| 3517 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3518 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3519 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3520 | .dac_nids = alc880_asus_dac_nids, |
| 3521 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3522 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3523 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3524 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3525 | .input_mux = &alc880_capture_source, |
| 3526 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3527 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3528 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3529 | .init_verbs = { alc880_volume_init_verbs, |
| 3530 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3531 | alc880_gpio1_init_verbs }, |
| 3532 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3533 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3534 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3535 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3536 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3537 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3538 | .input_mux = &alc880_capture_source, |
| 3539 | }, |
| 3540 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3541 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3542 | .init_verbs = { alc880_volume_init_verbs, |
| 3543 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3544 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3545 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3546 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3547 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3548 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3549 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3550 | .input_mux = &alc880_capture_source, |
| 3551 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3552 | [ALC880_UNIWILL] = { |
| 3553 | .mixers = { alc880_uniwill_mixer }, |
| 3554 | .init_verbs = { alc880_volume_init_verbs, |
| 3555 | alc880_uniwill_init_verbs }, |
| 3556 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3557 | .dac_nids = alc880_asus_dac_nids, |
| 3558 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3559 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3560 | .channel_mode = alc880_threestack_modes, |
| 3561 | .need_dac_fix = 1, |
| 3562 | .input_mux = &alc880_capture_source, |
| 3563 | .unsol_event = alc880_uniwill_unsol_event, |
| 3564 | .init_hook = alc880_uniwill_automute, |
| 3565 | }, |
| 3566 | [ALC880_UNIWILL_P53] = { |
| 3567 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3568 | .init_verbs = { alc880_volume_init_verbs, |
| 3569 | alc880_uniwill_p53_init_verbs }, |
| 3570 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3571 | .dac_nids = alc880_asus_dac_nids, |
| 3572 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3573 | .channel_mode = alc880_threestack_modes, |
| 3574 | .input_mux = &alc880_capture_source, |
| 3575 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3576 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3577 | }, |
| 3578 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3579 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3580 | alc880_pcbeep_mixer, }, |
| 3581 | .init_verbs = { alc880_volume_init_verbs, |
| 3582 | alc880_uniwill_p53_init_verbs, |
| 3583 | alc880_beep_init_verbs }, |
| 3584 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3585 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3586 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3587 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3588 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3589 | .input_mux = &alc880_capture_source, |
| 3590 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3591 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3592 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3593 | [ALC880_CLEVO] = { |
| 3594 | .mixers = { alc880_three_stack_mixer }, |
| 3595 | .init_verbs = { alc880_volume_init_verbs, |
| 3596 | alc880_pin_clevo_init_verbs }, |
| 3597 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3598 | .dac_nids = alc880_dac_nids, |
| 3599 | .hp_nid = 0x03, |
| 3600 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3601 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3602 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3603 | .input_mux = &alc880_capture_source, |
| 3604 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3605 | [ALC880_LG] = { |
| 3606 | .mixers = { alc880_lg_mixer }, |
| 3607 | .init_verbs = { alc880_volume_init_verbs, |
| 3608 | alc880_lg_init_verbs }, |
| 3609 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3610 | .dac_nids = alc880_lg_dac_nids, |
| 3611 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3612 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3613 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3614 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3615 | .input_mux = &alc880_lg_capture_source, |
| 3616 | .unsol_event = alc880_lg_unsol_event, |
| 3617 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3618 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3619 | .loopbacks = alc880_lg_loopbacks, |
| 3620 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3621 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3622 | [ALC880_LG_LW] = { |
| 3623 | .mixers = { alc880_lg_lw_mixer }, |
| 3624 | .init_verbs = { alc880_volume_init_verbs, |
| 3625 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3626 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3627 | .dac_nids = alc880_dac_nids, |
| 3628 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3629 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3630 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3631 | .input_mux = &alc880_lg_lw_capture_source, |
| 3632 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3633 | .init_hook = alc880_lg_lw_automute, |
| 3634 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3635 | [ALC880_MEDION_RIM] = { |
| 3636 | .mixers = { alc880_medion_rim_mixer }, |
| 3637 | .init_verbs = { alc880_volume_init_verbs, |
| 3638 | alc880_medion_rim_init_verbs, |
| 3639 | alc_gpio2_init_verbs }, |
| 3640 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3641 | .dac_nids = alc880_dac_nids, |
| 3642 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3643 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3644 | .channel_mode = alc880_2_jack_modes, |
| 3645 | .input_mux = &alc880_medion_rim_capture_source, |
| 3646 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3647 | .init_hook = alc880_medion_rim_automute, |
| 3648 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3649 | #ifdef CONFIG_SND_DEBUG |
| 3650 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3651 | .mixers = { alc880_test_mixer }, |
| 3652 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3653 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3654 | .dac_nids = alc880_test_dac_nids, |
| 3655 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3656 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3657 | .channel_mode = alc880_test_modes, |
| 3658 | .input_mux = &alc880_test_capture_source, |
| 3659 | }, |
| 3660 | #endif |
| 3661 | }; |
| 3662 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3663 | /* |
| 3664 | * Automatic parse of I/O pins from the BIOS configuration |
| 3665 | */ |
| 3666 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3667 | enum { |
| 3668 | ALC_CTL_WIDGET_VOL, |
| 3669 | ALC_CTL_WIDGET_MUTE, |
| 3670 | ALC_CTL_BIND_MUTE, |
| 3671 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3672 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3673 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3674 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3675 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3676 | }; |
| 3677 | |
| 3678 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3679 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3680 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3681 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3682 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3683 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3684 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 3685 | knew = snd_array_new(&spec->kctls); |
| 3686 | if (!knew) |
| 3687 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3688 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3689 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3690 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | return -ENOMEM; |
| 3692 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3693 | return 0; |
| 3694 | } |
| 3695 | |
| 3696 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3697 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3698 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3699 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3700 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3701 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3702 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3703 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3704 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3705 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3706 | #define ALC880_PIN_CD_NID 0x1c |
| 3707 | |
| 3708 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3709 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3710 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3711 | { |
| 3712 | hda_nid_t nid; |
| 3713 | int assigned[4]; |
| 3714 | int i, j; |
| 3715 | |
| 3716 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3717 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3718 | |
| 3719 | /* check the pins hardwired to audio widget */ |
| 3720 | for (i = 0; i < cfg->line_outs; i++) { |
| 3721 | nid = cfg->line_out_pins[i]; |
| 3722 | if (alc880_is_fixed_pin(nid)) { |
| 3723 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3724 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3725 | assigned[idx] = 1; |
| 3726 | } |
| 3727 | } |
| 3728 | /* left pins can be connect to any audio widget */ |
| 3729 | for (i = 0; i < cfg->line_outs; i++) { |
| 3730 | nid = cfg->line_out_pins[i]; |
| 3731 | if (alc880_is_fixed_pin(nid)) |
| 3732 | continue; |
| 3733 | /* search for an empty channel */ |
| 3734 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3735 | if (!assigned[j]) { |
| 3736 | spec->multiout.dac_nids[i] = |
| 3737 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3738 | assigned[j] = 1; |
| 3739 | break; |
| 3740 | } |
| 3741 | } |
| 3742 | } |
| 3743 | spec->multiout.num_dacs = cfg->line_outs; |
| 3744 | return 0; |
| 3745 | } |
| 3746 | |
| 3747 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3748 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3749 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3750 | { |
| 3751 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3752 | static const char *chname[4] = { |
| 3753 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3754 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3755 | hda_nid_t nid; |
| 3756 | int i, err; |
| 3757 | |
| 3758 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3759 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3760 | continue; |
| 3761 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3762 | if (i == 2) { |
| 3763 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3764 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3765 | "Center Playback Volume", |
| 3766 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3767 | HDA_OUTPUT)); |
| 3768 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3769 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3770 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3771 | "LFE Playback Volume", |
| 3772 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3773 | HDA_OUTPUT)); |
| 3774 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3775 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3776 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3777 | "Center Playback Switch", |
| 3778 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3779 | HDA_INPUT)); |
| 3780 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3781 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3782 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3783 | "LFE Playback Switch", |
| 3784 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3785 | HDA_INPUT)); |
| 3786 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3787 | return err; |
| 3788 | } else { |
| 3789 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3790 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3791 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3792 | HDA_OUTPUT)); |
| 3793 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3794 | return err; |
| 3795 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3796 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3797 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3798 | HDA_INPUT)); |
| 3799 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3800 | return err; |
| 3801 | } |
| 3802 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3803 | return 0; |
| 3804 | } |
| 3805 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3806 | /* add playback controls for speaker and HP outputs */ |
| 3807 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3808 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3809 | { |
| 3810 | hda_nid_t nid; |
| 3811 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3812 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3813 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3814 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3815 | return 0; |
| 3816 | |
| 3817 | if (alc880_is_fixed_pin(pin)) { |
| 3818 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3819 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3820 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3821 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3822 | else |
| 3823 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3824 | /* control HP volume/switch on the output mixer amp */ |
| 3825 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3826 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3827 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3828 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3829 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3830 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3831 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3832 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3833 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3834 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3835 | return err; |
| 3836 | } else if (alc880_is_multi_pin(pin)) { |
| 3837 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3838 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3839 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3840 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3841 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3842 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3843 | return err; |
| 3844 | } |
| 3845 | return 0; |
| 3846 | } |
| 3847 | |
| 3848 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3849 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3850 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3851 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3852 | { |
| 3853 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3854 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3855 | |
| 3856 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3857 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3858 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3859 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3860 | return err; |
| 3861 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3862 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3863 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3864 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3865 | return err; |
| 3866 | return 0; |
| 3867 | } |
| 3868 | |
| 3869 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3870 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3871 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3872 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3873 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3874 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3875 | |
| 3876 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3877 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3878 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3879 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3880 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3881 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3882 | if (err < 0) |
| 3883 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3884 | imux->items[imux->num_items].label = |
| 3885 | auto_pin_cfg_labels[i]; |
| 3886 | imux->items[imux->num_items].index = |
| 3887 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3888 | imux->num_items++; |
| 3889 | } |
| 3890 | } |
| 3891 | return 0; |
| 3892 | } |
| 3893 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3894 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3895 | unsigned int pin_type) |
| 3896 | { |
| 3897 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3898 | pin_type); |
| 3899 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3900 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3901 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3902 | } |
| 3903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3904 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3905 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3906 | int dac_idx) |
| 3907 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3908 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3909 | /* need the manual connection? */ |
| 3910 | if (alc880_is_multi_pin(nid)) { |
| 3911 | struct alc_spec *spec = codec->spec; |
| 3912 | int idx = alc880_multi_pin_idx(nid); |
| 3913 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3914 | AC_VERB_SET_CONNECT_SEL, |
| 3915 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3916 | } |
| 3917 | } |
| 3918 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3919 | static int get_pin_type(int line_out_type) |
| 3920 | { |
| 3921 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3922 | return PIN_HP; |
| 3923 | else |
| 3924 | return PIN_OUT; |
| 3925 | } |
| 3926 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3927 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3928 | { |
| 3929 | struct alc_spec *spec = codec->spec; |
| 3930 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3931 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3932 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3933 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3934 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3935 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3936 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3937 | } |
| 3938 | } |
| 3939 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3940 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3941 | { |
| 3942 | struct alc_spec *spec = codec->spec; |
| 3943 | hda_nid_t pin; |
| 3944 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3945 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3946 | if (pin) /* connect to front */ |
| 3947 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3948 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3949 | if (pin) /* connect to front */ |
| 3950 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3951 | } |
| 3952 | |
| 3953 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3954 | { |
| 3955 | struct alc_spec *spec = codec->spec; |
| 3956 | int i; |
| 3957 | |
| 3958 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3959 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3960 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3961 | snd_hda_codec_write(codec, nid, 0, |
| 3962 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3963 | i <= AUTO_PIN_FRONT_MIC ? |
| 3964 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3965 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3966 | snd_hda_codec_write(codec, nid, 0, |
| 3967 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3968 | AMP_OUT_MUTE); |
| 3969 | } |
| 3970 | } |
| 3971 | } |
| 3972 | |
| 3973 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3974 | /* return 1 if successful, 0 if the proper config is not found, |
| 3975 | * or a negative error code |
| 3976 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3977 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3978 | { |
| 3979 | struct alc_spec *spec = codec->spec; |
| 3980 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3981 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3982 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3983 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3984 | alc880_ignore); |
| 3985 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3986 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3987 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3988 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3989 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3990 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3991 | if (err < 0) |
| 3992 | return err; |
| 3993 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3994 | if (err < 0) |
| 3995 | return err; |
| 3996 | err = alc880_auto_create_extra_out(spec, |
| 3997 | spec->autocfg.speaker_pins[0], |
| 3998 | "Speaker"); |
| 3999 | if (err < 0) |
| 4000 | return err; |
| 4001 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4002 | "Headphone"); |
| 4003 | if (err < 0) |
| 4004 | return err; |
| 4005 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4006 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4007 | return err; |
| 4008 | |
| 4009 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4010 | |
| 4011 | if (spec->autocfg.dig_out_pin) |
| 4012 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 4013 | if (spec->autocfg.dig_in_pin) |
| 4014 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4015 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4016 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4017 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4018 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4019 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4020 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4021 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4022 | spec->input_mux = &spec->private_imux; |
| 4023 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4024 | store_pin_configs(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4025 | return 1; |
| 4026 | } |
| 4027 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4028 | /* additional initialization for auto-configuration model */ |
| 4029 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4030 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4031 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4032 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4033 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4034 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4035 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4036 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4037 | } |
| 4038 | |
| 4039 | /* |
| 4040 | * OK, here we have finally the patch for ALC880 |
| 4041 | */ |
| 4042 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4043 | static void set_capture_mixer(struct alc_spec *spec) |
| 4044 | { |
| 4045 | static struct snd_kcontrol_new *caps[3] = { |
| 4046 | alc_capture_mixer1, |
| 4047 | alc_capture_mixer2, |
| 4048 | alc_capture_mixer3, |
| 4049 | }; |
| 4050 | if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3) |
| 4051 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; |
| 4052 | } |
| 4053 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4054 | static int patch_alc880(struct hda_codec *codec) |
| 4055 | { |
| 4056 | struct alc_spec *spec; |
| 4057 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4058 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4059 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4060 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4061 | if (spec == NULL) |
| 4062 | return -ENOMEM; |
| 4063 | |
| 4064 | codec->spec = spec; |
| 4065 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4066 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4067 | alc880_models, |
| 4068 | alc880_cfg_tbl); |
| 4069 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4070 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 4071 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4072 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4073 | } |
| 4074 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4075 | if (board_config == ALC880_AUTO) { |
| 4076 | /* automatic parse from the BIOS config */ |
| 4077 | err = alc880_parse_auto_config(codec); |
| 4078 | if (err < 0) { |
| 4079 | alc_free(codec); |
| 4080 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4081 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4082 | printk(KERN_INFO |
| 4083 | "hda_codec: Cannot set up configuration " |
| 4084 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4085 | board_config = ALC880_3ST; |
| 4086 | } |
| 4087 | } |
| 4088 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4089 | if (board_config != ALC880_AUTO) |
| 4090 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4091 | |
| 4092 | spec->stream_name_analog = "ALC880 Analog"; |
| 4093 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4094 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4095 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4096 | |
| 4097 | spec->stream_name_digital = "ALC880 Digital"; |
| 4098 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4099 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4100 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4101 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4102 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4103 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4104 | /* get type */ |
| 4105 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4106 | if (wcap != AC_WID_AUD_IN) { |
| 4107 | spec->adc_nids = alc880_adc_nids_alt; |
| 4108 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4109 | } else { |
| 4110 | spec->adc_nids = alc880_adc_nids; |
| 4111 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4112 | } |
| 4113 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4114 | set_capture_mixer(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4115 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4116 | spec->vmaster_nid = 0x0c; |
| 4117 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4118 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4119 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4120 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4121 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4122 | if (!spec->loopback.amplist) |
| 4123 | spec->loopback.amplist = alc880_loopbacks; |
| 4124 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4125 | |
| 4126 | return 0; |
| 4127 | } |
| 4128 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4130 | /* |
| 4131 | * ALC260 support |
| 4132 | */ |
| 4133 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4134 | static hda_nid_t alc260_dac_nids[1] = { |
| 4135 | /* front */ |
| 4136 | 0x02, |
| 4137 | }; |
| 4138 | |
| 4139 | static hda_nid_t alc260_adc_nids[1] = { |
| 4140 | /* ADC0 */ |
| 4141 | 0x04, |
| 4142 | }; |
| 4143 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4144 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4145 | /* ADC1 */ |
| 4146 | 0x05, |
| 4147 | }; |
| 4148 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4149 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4150 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4151 | */ |
| 4152 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4153 | /* ADC0, ADC1 */ |
| 4154 | 0x04, 0x05 |
| 4155 | }; |
| 4156 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4157 | #define ALC260_DIGOUT_NID 0x03 |
| 4158 | #define ALC260_DIGIN_NID 0x06 |
| 4159 | |
| 4160 | static struct hda_input_mux alc260_capture_source = { |
| 4161 | .num_items = 4, |
| 4162 | .items = { |
| 4163 | { "Mic", 0x0 }, |
| 4164 | { "Front Mic", 0x1 }, |
| 4165 | { "Line", 0x2 }, |
| 4166 | { "CD", 0x4 }, |
| 4167 | }, |
| 4168 | }; |
| 4169 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4170 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4171 | * headphone jack and the internal CD lines since these are the only pins at |
| 4172 | * which audio can appear. For flexibility, also allow the option of |
| 4173 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4174 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4175 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4176 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4177 | { |
| 4178 | .num_items = 3, |
| 4179 | .items = { |
| 4180 | { "Mic/Line", 0x0 }, |
| 4181 | { "CD", 0x4 }, |
| 4182 | { "Headphone", 0x2 }, |
| 4183 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4184 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4185 | { |
| 4186 | .num_items = 4, |
| 4187 | .items = { |
| 4188 | { "Mic/Line", 0x0 }, |
| 4189 | { "CD", 0x4 }, |
| 4190 | { "Headphone", 0x2 }, |
| 4191 | { "Mixer", 0x5 }, |
| 4192 | }, |
| 4193 | }, |
| 4194 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4195 | }; |
| 4196 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4197 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4198 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4199 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4200 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4201 | { |
| 4202 | .num_items = 4, |
| 4203 | .items = { |
| 4204 | { "Mic", 0x0 }, |
| 4205 | { "Line", 0x2 }, |
| 4206 | { "CD", 0x4 }, |
| 4207 | { "Headphone", 0x5 }, |
| 4208 | }, |
| 4209 | }, |
| 4210 | { |
| 4211 | .num_items = 5, |
| 4212 | .items = { |
| 4213 | { "Mic", 0x0 }, |
| 4214 | { "Line", 0x2 }, |
| 4215 | { "CD", 0x4 }, |
| 4216 | { "Headphone", 0x6 }, |
| 4217 | { "Mixer", 0x5 }, |
| 4218 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4219 | }, |
| 4220 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4221 | /* |
| 4222 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4223 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4224 | * element which allows changing the channel mode, so the verb list is |
| 4225 | * never used. |
| 4226 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4227 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4228 | { 2, NULL }, |
| 4229 | }; |
| 4230 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4231 | |
| 4232 | /* Mixer combinations |
| 4233 | * |
| 4234 | * basic: base_output + input + pc_beep + capture |
| 4235 | * HP: base_output + input + capture_alt |
| 4236 | * HP_3013: hp_3013 + input + capture |
| 4237 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4238 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4239 | */ |
| 4240 | |
| 4241 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4242 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4243 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4244 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4245 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4246 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4247 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4248 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4249 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4250 | |
| 4251 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4252 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4253 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4254 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4255 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4256 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4258 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4259 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4260 | { } /* end */ |
| 4261 | }; |
| 4262 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4263 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4264 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4265 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4266 | { } /* end */ |
| 4267 | }; |
| 4268 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4269 | /* update HP, line and mono out pins according to the master switch */ |
| 4270 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4271 | hda_nid_t hp, hda_nid_t line, |
| 4272 | hda_nid_t mono) |
| 4273 | { |
| 4274 | struct alc_spec *spec = codec->spec; |
| 4275 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4276 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4277 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4278 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4279 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4280 | val); |
| 4281 | /* mono (speaker) depending on the HP jack sense */ |
| 4282 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4283 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4284 | val); |
| 4285 | } |
| 4286 | |
| 4287 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4288 | struct snd_ctl_elem_value *ucontrol) |
| 4289 | { |
| 4290 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4291 | struct alc_spec *spec = codec->spec; |
| 4292 | *ucontrol->value.integer.value = spec->master_sw; |
| 4293 | return 0; |
| 4294 | } |
| 4295 | |
| 4296 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4297 | struct snd_ctl_elem_value *ucontrol) |
| 4298 | { |
| 4299 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4300 | struct alc_spec *spec = codec->spec; |
| 4301 | int val = !!*ucontrol->value.integer.value; |
| 4302 | hda_nid_t hp, line, mono; |
| 4303 | |
| 4304 | if (val == spec->master_sw) |
| 4305 | return 0; |
| 4306 | spec->master_sw = val; |
| 4307 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4308 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4309 | mono = kcontrol->private_value & 0xff; |
| 4310 | alc260_hp_master_update(codec, hp, line, mono); |
| 4311 | return 1; |
| 4312 | } |
| 4313 | |
| 4314 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4315 | { |
| 4316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4317 | .name = "Master Playback Switch", |
| 4318 | .info = snd_ctl_boolean_mono_info, |
| 4319 | .get = alc260_hp_master_sw_get, |
| 4320 | .put = alc260_hp_master_sw_put, |
| 4321 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4322 | }, |
| 4323 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4324 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4325 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4326 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4327 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4328 | HDA_OUTPUT), |
| 4329 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4330 | { } /* end */ |
| 4331 | }; |
| 4332 | |
| 4333 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4334 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4335 | {}, |
| 4336 | }; |
| 4337 | |
| 4338 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4339 | { |
| 4340 | struct alc_spec *spec = codec->spec; |
| 4341 | unsigned int present; |
| 4342 | |
| 4343 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4344 | AC_VERB_GET_PIN_SENSE, 0); |
| 4345 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4346 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4347 | } |
| 4348 | |
| 4349 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4350 | { |
| 4351 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4352 | alc260_hp_automute(codec); |
| 4353 | } |
| 4354 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4355 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4356 | { |
| 4357 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4358 | .name = "Master Playback Switch", |
| 4359 | .info = snd_ctl_boolean_mono_info, |
| 4360 | .get = alc260_hp_master_sw_get, |
| 4361 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4362 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4363 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4364 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4365 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4366 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4367 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4368 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4369 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4370 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4371 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4372 | { } /* end */ |
| 4373 | }; |
| 4374 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4375 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4376 | .ops = &snd_hda_bind_vol, |
| 4377 | .values = { |
| 4378 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4379 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4380 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4381 | 0 |
| 4382 | }, |
| 4383 | }; |
| 4384 | |
| 4385 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4386 | .ops = &snd_hda_bind_sw, |
| 4387 | .values = { |
| 4388 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4389 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4390 | 0 |
| 4391 | }, |
| 4392 | }; |
| 4393 | |
| 4394 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4395 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4396 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4397 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4398 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4399 | { } /* end */ |
| 4400 | }; |
| 4401 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4402 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4403 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4404 | {}, |
| 4405 | }; |
| 4406 | |
| 4407 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4408 | { |
| 4409 | struct alc_spec *spec = codec->spec; |
| 4410 | unsigned int present; |
| 4411 | |
| 4412 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4413 | AC_VERB_GET_PIN_SENSE, 0); |
| 4414 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4415 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4416 | } |
| 4417 | |
| 4418 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4419 | unsigned int res) |
| 4420 | { |
| 4421 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4422 | alc260_hp_3013_automute(codec); |
| 4423 | } |
| 4424 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4425 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4426 | { |
| 4427 | unsigned int present, bits; |
| 4428 | |
| 4429 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4430 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4431 | |
| 4432 | bits = present ? 0 : PIN_OUT; |
| 4433 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4434 | bits); |
| 4435 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4436 | bits); |
| 4437 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4438 | bits); |
| 4439 | } |
| 4440 | |
| 4441 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4442 | unsigned int res) |
| 4443 | { |
| 4444 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4445 | alc260_hp_3012_automute(codec); |
| 4446 | } |
| 4447 | |
| 4448 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4449 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4450 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4451 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4452 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4453 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4454 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4456 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4457 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4458 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4459 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4460 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4461 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4462 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4463 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4464 | { } /* end */ |
| 4465 | }; |
| 4466 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4467 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4468 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4469 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4470 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4471 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4472 | * revisions available in early 2006. Therefore for now allow the |
| 4473 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4474 | * that the lack of mic bias for this NID is intentional we could change the |
| 4475 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4476 | * |
| 4477 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4478 | * don't appear to make the mic bias available from the "line" jack, even |
| 4479 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4480 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4481 | * and the output jack. If this turns out to be the case for all such |
| 4482 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4483 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4484 | * |
| 4485 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4486 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4487 | * controls for such models. On models without a "mono speaker" the control |
| 4488 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4489 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4490 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4491 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4492 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4493 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4494 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4495 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4496 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4497 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4498 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4499 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4502 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4504 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4505 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4506 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4507 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4508 | { } /* end */ |
| 4509 | }; |
| 4510 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4511 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4512 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4513 | */ |
| 4514 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4515 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4516 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4517 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4518 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4519 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4520 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4521 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4522 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4523 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4524 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4525 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4526 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4527 | { } /* end */ |
| 4528 | }; |
| 4529 | |
| 4530 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4531 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4532 | */ |
| 4533 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4534 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4535 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4536 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4537 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4538 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4539 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4540 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4541 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4542 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4543 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4544 | { } /* end */ |
| 4545 | }; |
| 4546 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4547 | /* |
| 4548 | * initialization verbs |
| 4549 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4550 | static struct hda_verb alc260_init_verbs[] = { |
| 4551 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4552 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4553 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4554 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4555 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4556 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4557 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4558 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4559 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4560 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4561 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4562 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4563 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4564 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4565 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4566 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4567 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4568 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4569 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4570 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4571 | /* set connection select to line in (default select for this ADC) */ |
| 4572 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4573 | /* mute capture amp left and right */ |
| 4574 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4575 | /* set connection select to line in (default select for this ADC) */ |
| 4576 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4577 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4578 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4579 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4580 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4581 | /* set vol=0 HP mixer amp left and right */ |
| 4582 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4583 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4584 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4585 | /* set vol=0 Mono mixer amp left and right */ |
| 4586 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4587 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4588 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4589 | /* unmute LINE-2 out pin */ |
| 4590 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4591 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4592 | * Line In 2 = 0x03 |
| 4593 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4594 | /* mute analog inputs */ |
| 4595 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4600 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4601 | /* mute Front out path */ |
| 4602 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4603 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4604 | /* mute Headphone out path */ |
| 4605 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4606 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4607 | /* mute Mono out path */ |
| 4608 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4609 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4610 | { } |
| 4611 | }; |
| 4612 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4613 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4614 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4615 | /* Headphone and output */ |
| 4616 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4617 | /* mono output */ |
| 4618 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4619 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4620 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4621 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4622 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4623 | /* Line In pin widget for input */ |
| 4624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4625 | /* Line-2 pin widget for output */ |
| 4626 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4627 | /* CD pin widget for input */ |
| 4628 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4629 | /* unmute amp left and right */ |
| 4630 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4631 | /* set connection select to line in (default select for this ADC) */ |
| 4632 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4633 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4634 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4635 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4637 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4638 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4639 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4640 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4641 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4642 | * Line In 2 = 0x03 |
| 4643 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4644 | /* mute analog inputs */ |
| 4645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4650 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4651 | /* Unmute Front out path */ |
| 4652 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4653 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4654 | /* Unmute Headphone out path */ |
| 4655 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4656 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4657 | /* Unmute Mono out path */ |
| 4658 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4659 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4660 | { } |
| 4661 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4662 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4663 | |
| 4664 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4665 | /* Line out and output */ |
| 4666 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4667 | /* mono output */ |
| 4668 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4669 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4670 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4671 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4672 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4673 | /* Line In pin widget for input */ |
| 4674 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4675 | /* Headphone pin widget for output */ |
| 4676 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4677 | /* CD pin widget for input */ |
| 4678 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4679 | /* unmute amp left and right */ |
| 4680 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4681 | /* set connection select to line in (default select for this ADC) */ |
| 4682 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4683 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4684 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4685 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4687 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4688 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4689 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4690 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4691 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4692 | * Line In 2 = 0x03 |
| 4693 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4694 | /* mute analog inputs */ |
| 4695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4700 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4701 | /* Unmute Front out path */ |
| 4702 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4703 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4704 | /* Unmute Headphone out path */ |
| 4705 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4706 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4707 | /* Unmute Mono out path */ |
| 4708 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4709 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4710 | { } |
| 4711 | }; |
| 4712 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4713 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4714 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4715 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4716 | */ |
| 4717 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4718 | /* Disable all GPIOs */ |
| 4719 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4720 | /* Internal speaker is connected to headphone pin */ |
| 4721 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4722 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4724 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4725 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4726 | /* Ensure all other unused pins are disabled and muted. */ |
| 4727 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4728 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4729 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4730 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4731 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4732 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4733 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4734 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4735 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4736 | /* Disable digital (SPDIF) pins */ |
| 4737 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4738 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4739 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4740 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4741 | * when acting as an output. |
| 4742 | */ |
| 4743 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4744 | |
| 4745 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4746 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4749 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4751 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4752 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4753 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4754 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4755 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4756 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4757 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4758 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4759 | * If the pin mode is changed by the user the pin mode control will |
| 4760 | * take care of enabling the pin's input/output buffers as needed. |
| 4761 | * Therefore there's no need to enable the input buffer at this |
| 4762 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4763 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4764 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4765 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4766 | * mixer ctrl) |
| 4767 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4768 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4769 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4770 | /* Mute capture amp left and right */ |
| 4771 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4772 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4773 | * in (on mic1 pin) |
| 4774 | */ |
| 4775 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4776 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4777 | /* Do the same for the second ADC: mute capture input amp and |
| 4778 | * set ADC connection to line in (on mic1 pin) |
| 4779 | */ |
| 4780 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4781 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4782 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4783 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4784 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4785 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4786 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4788 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4791 | {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] | 4792 | |
| 4793 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4794 | }; |
| 4795 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4796 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4797 | * similar laptops (adapted from Fujitsu init verbs). |
| 4798 | */ |
| 4799 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4800 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4801 | * the headphone jack. Turn this on and rely on the standard mute |
| 4802 | * methods whenever the user wants to turn these outputs off. |
| 4803 | */ |
| 4804 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4805 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4806 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4807 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4808 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4809 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4810 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4811 | /* Line In jack is connected to Line1 pin */ |
| 4812 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4813 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4814 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4815 | /* Ensure all other unused pins are disabled and muted. */ |
| 4816 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4817 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4818 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4819 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4822 | /* Disable digital (SPDIF) pins */ |
| 4823 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4824 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4825 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4826 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4827 | * bus when acting as outputs. |
| 4828 | */ |
| 4829 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4830 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4831 | |
| 4832 | /* Start with output sum widgets muted and their output gains at min */ |
| 4833 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4835 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4836 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4837 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4838 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4839 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4840 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4841 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4842 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4843 | /* Unmute Line-out pin widget amp left and right |
| 4844 | * (no equiv mixer ctrl) |
| 4845 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4846 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4847 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4848 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4849 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4850 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4851 | * will take care of enabling the pin's input/output buffers as needed. |
| 4852 | * Therefore there's no need to enable the input buffer at this |
| 4853 | * stage. |
| 4854 | */ |
| 4855 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4856 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4857 | |
| 4858 | /* Mute capture amp left and right */ |
| 4859 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4860 | /* Set ADC connection select to match default mixer setting - mic |
| 4861 | * (on mic1 pin) |
| 4862 | */ |
| 4863 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4864 | |
| 4865 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4866 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4867 | */ |
| 4868 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4869 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4870 | |
| 4871 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4872 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4873 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4874 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4875 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4876 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4877 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4878 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4880 | |
| 4881 | { } |
| 4882 | }; |
| 4883 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4884 | static struct hda_verb alc260_will_verbs[] = { |
| 4885 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4886 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4887 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4888 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4889 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4890 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4891 | {} |
| 4892 | }; |
| 4893 | |
| 4894 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4895 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4896 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4897 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4898 | |
| 4899 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4900 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4901 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4902 | |
| 4903 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4904 | {} |
| 4905 | }; |
| 4906 | |
| 4907 | /* toggle speaker-output according to the hp-jack state */ |
| 4908 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4909 | { |
| 4910 | unsigned int present; |
| 4911 | |
| 4912 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4913 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4914 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4915 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4916 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4917 | AC_VERB_SET_GPIO_DATA, 1); |
| 4918 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4919 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4920 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4921 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4922 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4923 | AC_VERB_SET_GPIO_DATA, 0); |
| 4924 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4925 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4926 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4927 | } |
| 4928 | } |
| 4929 | |
| 4930 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4931 | unsigned int res) |
| 4932 | { |
| 4933 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4934 | alc260_replacer_672v_automute(codec); |
| 4935 | } |
| 4936 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4937 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 4938 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 4940 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4941 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4942 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4943 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4944 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4945 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4946 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4947 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4948 | {} |
| 4949 | }; |
| 4950 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4951 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4952 | * configuration. |
| 4953 | */ |
| 4954 | #ifdef CONFIG_SND_DEBUG |
| 4955 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4956 | 0x02, |
| 4957 | }; |
| 4958 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4959 | 0x04, 0x05, |
| 4960 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4961 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4962 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4963 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4964 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4965 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4966 | { |
| 4967 | .num_items = 7, |
| 4968 | .items = { |
| 4969 | { "MIC1 pin", 0x0 }, |
| 4970 | { "MIC2 pin", 0x1 }, |
| 4971 | { "LINE1 pin", 0x2 }, |
| 4972 | { "LINE2 pin", 0x3 }, |
| 4973 | { "CD pin", 0x4 }, |
| 4974 | { "LINE-OUT pin", 0x5 }, |
| 4975 | { "HP-OUT pin", 0x6 }, |
| 4976 | }, |
| 4977 | }, |
| 4978 | { |
| 4979 | .num_items = 8, |
| 4980 | .items = { |
| 4981 | { "MIC1 pin", 0x0 }, |
| 4982 | { "MIC2 pin", 0x1 }, |
| 4983 | { "LINE1 pin", 0x2 }, |
| 4984 | { "LINE2 pin", 0x3 }, |
| 4985 | { "CD pin", 0x4 }, |
| 4986 | { "Mixer", 0x5 }, |
| 4987 | { "LINE-OUT pin", 0x6 }, |
| 4988 | { "HP-OUT pin", 0x7 }, |
| 4989 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4990 | }, |
| 4991 | }; |
| 4992 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4993 | /* Output driver widgets */ |
| 4994 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4995 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4996 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4997 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4998 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4999 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5000 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5001 | /* Modes for retasking pin widgets |
| 5002 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5003 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5004 | * mention this restriction. At this stage it's not clear whether |
| 5005 | * this behaviour is intentional or is a hardware bug in chip |
| 5006 | * revisions available at least up until early 2006. Therefore for |
| 5007 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5008 | * choices, but if it turns out that the lack of mic bias for these |
| 5009 | * NIDs is intentional we could change their modes from |
| 5010 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5011 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5012 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5013 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5014 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5015 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5016 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5017 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5018 | |
| 5019 | /* Loopback mixer controls */ |
| 5020 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5021 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5022 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5023 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5024 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5025 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5026 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5027 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5028 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5029 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5030 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 5031 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 5032 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5033 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5034 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5035 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5036 | |
| 5037 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5038 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5039 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5040 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5041 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5042 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5043 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5044 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5045 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5046 | */ |
| 5047 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5048 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5049 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5050 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5051 | * this output to turn on an external amplifier. |
| 5052 | */ |
| 5053 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5054 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5055 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5056 | { } /* end */ |
| 5057 | }; |
| 5058 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5059 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5060 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5061 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5062 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5063 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5064 | /* Enable retasking pins as output, initially without power amp */ |
| 5065 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5066 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5067 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5069 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5070 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5071 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5072 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5073 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5074 | * payload also sets the generation to 0, output to be in "consumer" |
| 5075 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5076 | * control. |
| 5077 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5078 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5079 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5080 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5081 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5082 | * OUT1 sum bus when acting as an output. |
| 5083 | */ |
| 5084 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5085 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5086 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5087 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5088 | |
| 5089 | /* Start with output sum widgets muted and their output gains at min */ |
| 5090 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5091 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5092 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5093 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5095 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5097 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5098 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5099 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5100 | /* Unmute retasking pin widget output buffers since the default |
| 5101 | * state appears to be output. As the pin mode is changed by the |
| 5102 | * user the pin mode control will take care of enabling the pin's |
| 5103 | * input/output buffers as needed. |
| 5104 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5105 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5106 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5107 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5108 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5109 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5110 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5111 | /* Also unmute the mono-out pin widget */ |
| 5112 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5113 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5114 | /* Mute capture amp left and right */ |
| 5115 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5116 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5117 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5118 | */ |
| 5119 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5120 | |
| 5121 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5122 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5123 | */ |
| 5124 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5125 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5126 | |
| 5127 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5134 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5135 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5136 | |
| 5137 | { } |
| 5138 | }; |
| 5139 | #endif |
| 5140 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5141 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5142 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5143 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5144 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5145 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5146 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5147 | /* |
| 5148 | * for BIOS auto-configuration |
| 5149 | */ |
| 5150 | |
| 5151 | 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] | 5152 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5153 | { |
| 5154 | hda_nid_t nid_vol; |
| 5155 | unsigned long vol_val, sw_val; |
| 5156 | char name[32]; |
| 5157 | int err; |
| 5158 | |
| 5159 | if (nid >= 0x0f && nid < 0x11) { |
| 5160 | nid_vol = nid - 0x7; |
| 5161 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5162 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5163 | } else if (nid == 0x11) { |
| 5164 | nid_vol = nid - 0x7; |
| 5165 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5166 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5167 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5168 | nid_vol = 0x08; |
| 5169 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5170 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5171 | } else |
| 5172 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5173 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5174 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5175 | /* first control for the volume widget */ |
| 5176 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5177 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5178 | if (err < 0) |
| 5179 | return err; |
| 5180 | *vol_bits |= (1 << nid_vol); |
| 5181 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5182 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5183 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5184 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5185 | return err; |
| 5186 | return 1; |
| 5187 | } |
| 5188 | |
| 5189 | /* add playback controls from the parsed DAC table */ |
| 5190 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5191 | const struct auto_pin_cfg *cfg) |
| 5192 | { |
| 5193 | hda_nid_t nid; |
| 5194 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5195 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5196 | |
| 5197 | spec->multiout.num_dacs = 1; |
| 5198 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5199 | spec->multiout.dac_nids[0] = 0x02; |
| 5200 | |
| 5201 | nid = cfg->line_out_pins[0]; |
| 5202 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5203 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5204 | if (err < 0) |
| 5205 | return err; |
| 5206 | } |
| 5207 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5208 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5209 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5210 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5211 | if (err < 0) |
| 5212 | return err; |
| 5213 | } |
| 5214 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5215 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5216 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5217 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5218 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5219 | if (err < 0) |
| 5220 | return err; |
| 5221 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5222 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5223 | } |
| 5224 | |
| 5225 | /* create playback/capture controls for input pins */ |
| 5226 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5227 | const struct auto_pin_cfg *cfg) |
| 5228 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5229 | struct hda_input_mux *imux = &spec->private_imux; |
| 5230 | int i, err, idx; |
| 5231 | |
| 5232 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5233 | if (cfg->input_pins[i] >= 0x12) { |
| 5234 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5235 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5236 | auto_pin_cfg_labels[i], idx, |
| 5237 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5238 | if (err < 0) |
| 5239 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5240 | imux->items[imux->num_items].label = |
| 5241 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5242 | imux->items[imux->num_items].index = idx; |
| 5243 | imux->num_items++; |
| 5244 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5245 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5246 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5247 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5248 | auto_pin_cfg_labels[i], idx, |
| 5249 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5250 | if (err < 0) |
| 5251 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5252 | imux->items[imux->num_items].label = |
| 5253 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5254 | imux->items[imux->num_items].index = idx; |
| 5255 | imux->num_items++; |
| 5256 | } |
| 5257 | } |
| 5258 | return 0; |
| 5259 | } |
| 5260 | |
| 5261 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5262 | hda_nid_t nid, int pin_type, |
| 5263 | int sel_idx) |
| 5264 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5265 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5266 | /* need the manual connection? */ |
| 5267 | if (nid >= 0x12) { |
| 5268 | int idx = nid - 0x12; |
| 5269 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5270 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5271 | } |
| 5272 | } |
| 5273 | |
| 5274 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5275 | { |
| 5276 | struct alc_spec *spec = codec->spec; |
| 5277 | hda_nid_t nid; |
| 5278 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5279 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5280 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5281 | if (nid) { |
| 5282 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5283 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5284 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5285 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5286 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5287 | if (nid) |
| 5288 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5289 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5290 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5291 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5292 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5293 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5294 | |
| 5295 | #define ALC260_PIN_CD_NID 0x16 |
| 5296 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5297 | { |
| 5298 | struct alc_spec *spec = codec->spec; |
| 5299 | int i; |
| 5300 | |
| 5301 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5302 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5303 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5304 | snd_hda_codec_write(codec, nid, 0, |
| 5305 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5306 | i <= AUTO_PIN_FRONT_MIC ? |
| 5307 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5308 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5309 | snd_hda_codec_write(codec, nid, 0, |
| 5310 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5311 | AMP_OUT_MUTE); |
| 5312 | } |
| 5313 | } |
| 5314 | } |
| 5315 | |
| 5316 | /* |
| 5317 | * generic initialization of ADC, input mixers and output mixers |
| 5318 | */ |
| 5319 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5320 | /* |
| 5321 | * Unmute ADC0-1 and set the default input to mic-in |
| 5322 | */ |
| 5323 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5324 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5325 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5326 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5327 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5328 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5329 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5330 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5331 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5332 | */ |
| 5333 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5334 | /* mute analog inputs */ |
| 5335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5338 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5340 | |
| 5341 | /* |
| 5342 | * Set up output mixers (0x08 - 0x0a) |
| 5343 | */ |
| 5344 | /* set vol=0 to output mixers */ |
| 5345 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5346 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5347 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5348 | /* set up input amps for analog loopback */ |
| 5349 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5350 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5351 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5352 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5353 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5354 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5355 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5356 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5357 | { } |
| 5358 | }; |
| 5359 | |
| 5360 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5361 | { |
| 5362 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5363 | int err; |
| 5364 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5365 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5366 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5367 | alc260_ignore); |
| 5368 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5369 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5370 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5371 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5372 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5373 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5374 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5375 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5376 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5377 | return err; |
| 5378 | |
| 5379 | spec->multiout.max_channels = 2; |
| 5380 | |
| 5381 | if (spec->autocfg.dig_out_pin) |
| 5382 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5383 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5384 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5385 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5386 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5387 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5388 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5389 | spec->input_mux = &spec->private_imux; |
| 5390 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 5391 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5392 | return 1; |
| 5393 | } |
| 5394 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5395 | /* additional initialization for auto-configuration model */ |
| 5396 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5397 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5398 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5399 | alc260_auto_init_multi_out(codec); |
| 5400 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5401 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5402 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5403 | } |
| 5404 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5405 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5406 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5407 | { 0x07, HDA_INPUT, 0 }, |
| 5408 | { 0x07, HDA_INPUT, 1 }, |
| 5409 | { 0x07, HDA_INPUT, 2 }, |
| 5410 | { 0x07, HDA_INPUT, 3 }, |
| 5411 | { 0x07, HDA_INPUT, 4 }, |
| 5412 | { } /* end */ |
| 5413 | }; |
| 5414 | #endif |
| 5415 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5416 | /* |
| 5417 | * ALC260 configurations |
| 5418 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5419 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5420 | [ALC260_BASIC] = "basic", |
| 5421 | [ALC260_HP] = "hp", |
| 5422 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 5423 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5424 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5425 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5426 | [ALC260_WILL] = "will", |
| 5427 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5428 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5429 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5430 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5431 | [ALC260_AUTO] = "auto", |
| 5432 | }; |
| 5433 | |
| 5434 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5435 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5436 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5437 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5438 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5439 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 5440 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5441 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5442 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5443 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5444 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5445 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5446 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5447 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5448 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5449 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5450 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5451 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5452 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5453 | {} |
| 5454 | }; |
| 5455 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5456 | static struct alc_config_preset alc260_presets[] = { |
| 5457 | [ALC260_BASIC] = { |
| 5458 | .mixers = { alc260_base_output_mixer, |
| 5459 | alc260_input_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5460 | alc260_pc_beep_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5461 | .init_verbs = { alc260_init_verbs }, |
| 5462 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5463 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5464 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5465 | .adc_nids = alc260_adc_nids, |
| 5466 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5467 | .channel_mode = alc260_modes, |
| 5468 | .input_mux = &alc260_capture_source, |
| 5469 | }, |
| 5470 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5471 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5472 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5473 | .init_verbs = { alc260_init_verbs, |
| 5474 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5475 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5476 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5477 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5478 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5479 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5480 | .channel_mode = alc260_modes, |
| 5481 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5482 | .unsol_event = alc260_hp_unsol_event, |
| 5483 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5484 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5485 | [ALC260_HP_DC7600] = { |
| 5486 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5487 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5488 | .init_verbs = { alc260_init_verbs, |
| 5489 | alc260_hp_dc7600_verbs }, |
| 5490 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5491 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5492 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5493 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5494 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5495 | .channel_mode = alc260_modes, |
| 5496 | .input_mux = &alc260_capture_source, |
| 5497 | .unsol_event = alc260_hp_3012_unsol_event, |
| 5498 | .init_hook = alc260_hp_3012_automute, |
| 5499 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5500 | [ALC260_HP_3013] = { |
| 5501 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5502 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5503 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5504 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5505 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5506 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5507 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 5508 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5509 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5510 | .channel_mode = alc260_modes, |
| 5511 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5512 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5513 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5514 | }, |
| 5515 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5516 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5517 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5518 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5519 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5520 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5521 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5522 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5523 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5524 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5525 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5526 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5527 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5528 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5529 | .init_verbs = { alc260_acer_init_verbs }, |
| 5530 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5531 | .dac_nids = alc260_dac_nids, |
| 5532 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5533 | .adc_nids = alc260_dual_adc_nids, |
| 5534 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5535 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5536 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5537 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5538 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5539 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5540 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5541 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5542 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5543 | .dac_nids = alc260_dac_nids, |
| 5544 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5545 | .adc_nids = alc260_adc_nids, |
| 5546 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5547 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5548 | .channel_mode = alc260_modes, |
| 5549 | .input_mux = &alc260_capture_source, |
| 5550 | }, |
| 5551 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5552 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5553 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5554 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5555 | .dac_nids = alc260_dac_nids, |
| 5556 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5557 | .adc_nids = alc260_adc_nids, |
| 5558 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5559 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5560 | .channel_mode = alc260_modes, |
| 5561 | .input_mux = &alc260_capture_source, |
| 5562 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5563 | .init_hook = alc260_replacer_672v_automute, |
| 5564 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5565 | #ifdef CONFIG_SND_DEBUG |
| 5566 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5567 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5568 | .init_verbs = { alc260_test_init_verbs }, |
| 5569 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5570 | .dac_nids = alc260_test_dac_nids, |
| 5571 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5572 | .adc_nids = alc260_test_adc_nids, |
| 5573 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5574 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5575 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5576 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5577 | }, |
| 5578 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5579 | }; |
| 5580 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5581 | static int patch_alc260(struct hda_codec *codec) |
| 5582 | { |
| 5583 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5584 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5585 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5586 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5587 | if (spec == NULL) |
| 5588 | return -ENOMEM; |
| 5589 | |
| 5590 | codec->spec = spec; |
| 5591 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5592 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5593 | alc260_models, |
| 5594 | alc260_cfg_tbl); |
| 5595 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5596 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5597 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5598 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5599 | } |
| 5600 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5601 | if (board_config == ALC260_AUTO) { |
| 5602 | /* automatic parse from the BIOS config */ |
| 5603 | err = alc260_parse_auto_config(codec); |
| 5604 | if (err < 0) { |
| 5605 | alc_free(codec); |
| 5606 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5607 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5608 | printk(KERN_INFO |
| 5609 | "hda_codec: Cannot set up configuration " |
| 5610 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5611 | board_config = ALC260_BASIC; |
| 5612 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5613 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5614 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5615 | if (board_config != ALC260_AUTO) |
| 5616 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5617 | |
| 5618 | spec->stream_name_analog = "ALC260 Analog"; |
| 5619 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5620 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5621 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5622 | spec->stream_name_digital = "ALC260 Digital"; |
| 5623 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5624 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5625 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 5626 | if (!spec->adc_nids && spec->input_mux) { |
| 5627 | /* check whether NID 0x04 is valid */ |
| 5628 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 5629 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 5630 | /* get type */ |
| 5631 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 5632 | spec->adc_nids = alc260_adc_nids_alt; |
| 5633 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5634 | } else { |
| 5635 | spec->adc_nids = alc260_adc_nids; |
| 5636 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5637 | } |
| 5638 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5639 | set_capture_mixer(spec); |
| 5640 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5641 | spec->vmaster_nid = 0x08; |
| 5642 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5643 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5644 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5645 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5646 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5647 | if (!spec->loopback.amplist) |
| 5648 | spec->loopback.amplist = alc260_loopbacks; |
| 5649 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5650 | |
| 5651 | return 0; |
| 5652 | } |
| 5653 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5654 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5655 | /* |
| 5656 | * ALC882 support |
| 5657 | * |
| 5658 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5659 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5660 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5661 | * 6-channel independent captures. |
| 5662 | * |
| 5663 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5664 | * driver yet). |
| 5665 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5666 | #define ALC882_DIGOUT_NID 0x06 |
| 5667 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5668 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5669 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5670 | { 8, NULL } |
| 5671 | }; |
| 5672 | |
| 5673 | static hda_nid_t alc882_dac_nids[4] = { |
| 5674 | /* front, rear, clfe, rear_surr */ |
| 5675 | 0x02, 0x03, 0x04, 0x05 |
| 5676 | }; |
| 5677 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5678 | /* identical with ALC880 */ |
| 5679 | #define alc882_adc_nids alc880_adc_nids |
| 5680 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5681 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5682 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5683 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5684 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5685 | /* input MUX */ |
| 5686 | /* FIXME: should be a matrix-type input source selection */ |
| 5687 | |
| 5688 | static struct hda_input_mux alc882_capture_source = { |
| 5689 | .num_items = 4, |
| 5690 | .items = { |
| 5691 | { "Mic", 0x0 }, |
| 5692 | { "Front Mic", 0x1 }, |
| 5693 | { "Line", 0x2 }, |
| 5694 | { "CD", 0x4 }, |
| 5695 | }, |
| 5696 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5697 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5698 | * 2ch mode |
| 5699 | */ |
| 5700 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5701 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5702 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5703 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5704 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5705 | { } /* end */ |
| 5706 | }; |
| 5707 | |
| 5708 | /* |
| 5709 | * 6ch mode |
| 5710 | */ |
| 5711 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5712 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5713 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5714 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5715 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5716 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5717 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5718 | { } /* end */ |
| 5719 | }; |
| 5720 | |
| 5721 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5722 | { 2, alc882_3ST_ch2_init }, |
| 5723 | { 6, alc882_3ST_ch6_init }, |
| 5724 | }; |
| 5725 | |
| 5726 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5727 | * 6ch mode |
| 5728 | */ |
| 5729 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5730 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5731 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5732 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5733 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5734 | { } /* end */ |
| 5735 | }; |
| 5736 | |
| 5737 | /* |
| 5738 | * 8ch mode |
| 5739 | */ |
| 5740 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5741 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5742 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5743 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5744 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5745 | { } /* end */ |
| 5746 | }; |
| 5747 | |
| 5748 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5749 | { 6, alc882_sixstack_ch6_init }, |
| 5750 | { 8, alc882_sixstack_ch8_init }, |
| 5751 | }; |
| 5752 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5753 | /* |
| 5754 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5755 | */ |
| 5756 | |
| 5757 | /* |
| 5758 | * 2ch mode |
| 5759 | */ |
| 5760 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5761 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5762 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5763 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5764 | { } /* end */ |
| 5765 | }; |
| 5766 | |
| 5767 | /* |
| 5768 | * 6ch mode |
| 5769 | */ |
| 5770 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5771 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5772 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5773 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5774 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5775 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5776 | { } /* end */ |
| 5777 | }; |
| 5778 | |
| 5779 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5780 | { 2, alc885_mbp_ch2_init }, |
| 5781 | { 6, alc885_mbp_ch6_init }, |
| 5782 | }; |
| 5783 | |
| 5784 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5785 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5786 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5787 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5788 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5789 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5790 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5791 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5792 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5793 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5794 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5795 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5796 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5797 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5798 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5799 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5800 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5801 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5803 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5805 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5807 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5808 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5809 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5810 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5811 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5812 | { } /* end */ |
| 5813 | }; |
| 5814 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5815 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5816 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5817 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5818 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5819 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5820 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5821 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5823 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5824 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5825 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5826 | { } /* end */ |
| 5827 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5828 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5829 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5830 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5831 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5832 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5833 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5834 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5836 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5838 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5839 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5840 | { } /* end */ |
| 5841 | }; |
| 5842 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5843 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5844 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5845 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5846 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5847 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5848 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5849 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5850 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5851 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5853 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5854 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5855 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5856 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5857 | { } /* end */ |
| 5858 | }; |
| 5859 | |
| 5860 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5861 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5862 | */ |
| 5863 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5864 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5865 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5867 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5869 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5872 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5873 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5874 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5876 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5877 | { } /* end */ |
| 5878 | }; |
| 5879 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5880 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5881 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5882 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5883 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5884 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5885 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5886 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5887 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5888 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5889 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5890 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5891 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5892 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5893 | { } /* end */ |
| 5894 | }; |
| 5895 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5896 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5897 | { |
| 5898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5899 | .name = "Channel Mode", |
| 5900 | .info = alc_ch_mode_info, |
| 5901 | .get = alc_ch_mode_get, |
| 5902 | .put = alc_ch_mode_put, |
| 5903 | }, |
| 5904 | { } /* end */ |
| 5905 | }; |
| 5906 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5907 | static struct hda_verb alc882_init_verbs[] = { |
| 5908 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5910 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5912 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5916 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5920 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5921 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5924 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5925 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5926 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5927 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5928 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5929 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5930 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5931 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5932 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5933 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5934 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5935 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5936 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5937 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5938 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5939 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5940 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5941 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5943 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5944 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5945 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5947 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5948 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5950 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5952 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5953 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5954 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5955 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5956 | |
| 5957 | /* FIXME: use matrix-type input source selection */ |
| 5958 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5959 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5960 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5961 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5962 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5963 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5964 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5966 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5968 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5969 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5970 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5974 | /* ADC1: mute amp left and right */ |
| 5975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5976 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5977 | /* ADC2: mute amp left and right */ |
| 5978 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5979 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5980 | /* ADC3: mute amp left and right */ |
| 5981 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5982 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5983 | |
| 5984 | { } |
| 5985 | }; |
| 5986 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5987 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5988 | /* change to EAPD mode */ |
| 5989 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5990 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5991 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5992 | }; |
| 5993 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5994 | /* Mac Pro test */ |
| 5995 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5997 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5999 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6000 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6001 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6002 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6003 | { } /* end */ |
| 6004 | }; |
| 6005 | |
| 6006 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6007 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6009 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6010 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6011 | /* Front Pin: output 0 (0x0c) */ |
| 6012 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6014 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6015 | /* Front Mic pin: input vref at 80% */ |
| 6016 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6017 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6018 | /* Speaker: output */ |
| 6019 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6020 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6021 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6022 | /* Headphone output (output 0 - 0x0c) */ |
| 6023 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6024 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6025 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6026 | |
| 6027 | /* FIXME: use matrix-type input source selection */ |
| 6028 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6029 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6030 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6031 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6033 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6034 | /* Input mixer2 */ |
| 6035 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6036 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6037 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6038 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6039 | /* Input mixer3 */ |
| 6040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6041 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6042 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6044 | /* ADC1: mute amp left and right */ |
| 6045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6046 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6047 | /* ADC2: mute amp left and right */ |
| 6048 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6049 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6050 | /* ADC3: mute amp left and right */ |
| 6051 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6052 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6053 | |
| 6054 | { } |
| 6055 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6056 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6057 | /* Macbook Pro rev3 */ |
| 6058 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 6059 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6063 | /* Rear mixer */ |
| 6064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6065 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6066 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6067 | /* Front Pin: output 0 (0x0c) */ |
| 6068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6070 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6071 | /* HP Pin: output 0 (0x0d) */ |
| 6072 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 6073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6075 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6076 | /* Mic (rear) pin: input vref at 80% */ |
| 6077 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6079 | /* Front Mic pin: input vref at 80% */ |
| 6080 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6081 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6082 | /* Line In pin: use output 1 when in LineOut mode */ |
| 6083 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6085 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6086 | |
| 6087 | /* FIXME: use matrix-type input source selection */ |
| 6088 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6089 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6090 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6091 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6094 | /* Input mixer2 */ |
| 6095 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6096 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6098 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6099 | /* Input mixer3 */ |
| 6100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6103 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6104 | /* ADC1: mute amp left and right */ |
| 6105 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6106 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6107 | /* ADC2: mute amp left and right */ |
| 6108 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6109 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6110 | /* ADC3: mute amp left and right */ |
| 6111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6112 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6113 | |
| 6114 | { } |
| 6115 | }; |
| 6116 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6117 | /* iMac 24 mixer. */ |
| 6118 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 6119 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6120 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 6121 | { } /* end */ |
| 6122 | }; |
| 6123 | |
| 6124 | /* iMac 24 init verbs. */ |
| 6125 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 6126 | /* Internal speakers: output 0 (0x0c) */ |
| 6127 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6128 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6129 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6130 | /* Internal speakers: output 0 (0x0c) */ |
| 6131 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6132 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6133 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6134 | /* Headphone: output 0 (0x0c) */ |
| 6135 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6136 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6137 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6138 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6139 | /* Front Mic: input vref at 80% */ |
| 6140 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6141 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6142 | { } |
| 6143 | }; |
| 6144 | |
| 6145 | /* Toggle speaker-output according to the hp-jack state */ |
| 6146 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 6147 | { |
| 6148 | unsigned int present; |
| 6149 | |
| 6150 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6151 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6152 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 6153 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6154 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 6155 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6156 | } |
| 6157 | |
| 6158 | /* Processes unsolicited events. */ |
| 6159 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 6160 | unsigned int res) |
| 6161 | { |
| 6162 | /* Headphone insertion or removal. */ |
| 6163 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6164 | alc885_imac24_automute(codec); |
| 6165 | } |
| 6166 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6167 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 6168 | { |
| 6169 | unsigned int present; |
| 6170 | |
| 6171 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6172 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6173 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6174 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6175 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 6176 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 6177 | |
| 6178 | } |
| 6179 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 6180 | unsigned int res) |
| 6181 | { |
| 6182 | /* Headphone insertion or removal. */ |
| 6183 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6184 | alc885_mbp3_automute(codec); |
| 6185 | } |
| 6186 | |
| 6187 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6188 | static struct hda_verb alc882_targa_verbs[] = { |
| 6189 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6190 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6191 | |
| 6192 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6193 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6194 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6195 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6196 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6197 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6198 | |
| 6199 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 6200 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 6201 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 6202 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 6203 | { } /* end */ |
| 6204 | }; |
| 6205 | |
| 6206 | /* toggle speaker-output according to the hp-jack state */ |
| 6207 | static void alc882_targa_automute(struct hda_codec *codec) |
| 6208 | { |
| 6209 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6210 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6211 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 6212 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6213 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 6214 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6215 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 6216 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6217 | } |
| 6218 | |
| 6219 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 6220 | { |
| 6221 | /* Looks like the unsol event is incompatible with the standard |
| 6222 | * definition. 4bit tag is placed at 26 bit! |
| 6223 | */ |
| 6224 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 6225 | alc882_targa_automute(codec); |
| 6226 | } |
| 6227 | } |
| 6228 | |
| 6229 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 6230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6232 | |
| 6233 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6235 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6236 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6237 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6239 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6240 | |
| 6241 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6242 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6243 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6244 | { } /* end */ |
| 6245 | }; |
| 6246 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6247 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 6248 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6249 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6250 | |
| 6251 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6252 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6253 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6254 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6255 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6256 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6257 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 6258 | |
| 6259 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 6260 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 6261 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6262 | { } /* end */ |
| 6263 | }; |
| 6264 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6265 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6266 | { |
| 6267 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6268 | |
| 6269 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6270 | AC_VERB_GET_GPIO_DATA, 0); |
| 6271 | |
| 6272 | if (!muted) |
| 6273 | gpiostate |= (1 << pin); |
| 6274 | else |
| 6275 | gpiostate &= ~(1 << pin); |
| 6276 | |
| 6277 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6278 | AC_VERB_GET_GPIO_MASK, 0); |
| 6279 | gpiomask |= (1 << pin); |
| 6280 | |
| 6281 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6282 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6283 | gpiodir |= (1 << pin); |
| 6284 | |
| 6285 | |
| 6286 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6287 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6288 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6289 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6290 | |
| 6291 | msleep(1); |
| 6292 | |
| 6293 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6294 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6295 | } |
| 6296 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6297 | /* set up GPIO at initialization */ |
| 6298 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6299 | { |
| 6300 | alc882_gpio_mute(codec, 0, 0); |
| 6301 | alc882_gpio_mute(codec, 1, 0); |
| 6302 | } |
| 6303 | |
| 6304 | /* set up GPIO and update auto-muting at initialization */ |
| 6305 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6306 | { |
| 6307 | alc885_macpro_init_hook(codec); |
| 6308 | alc885_imac24_automute(codec); |
| 6309 | } |
| 6310 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6311 | /* |
| 6312 | * generic initialization of ADC, input mixers and output mixers |
| 6313 | */ |
| 6314 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6315 | /* |
| 6316 | * Unmute ADC0-2 and set the default input to mic-in |
| 6317 | */ |
| 6318 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6319 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6320 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6321 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6322 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6323 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6324 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6325 | /* 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] | 6326 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6327 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6328 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6329 | */ |
| 6330 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6332 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6333 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6334 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6336 | |
| 6337 | /* |
| 6338 | * Set up output mixers (0x0c - 0x0f) |
| 6339 | */ |
| 6340 | /* set vol=0 to output mixers */ |
| 6341 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6343 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6344 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6345 | /* set up input amps for analog loopback */ |
| 6346 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6348 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6349 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6350 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6351 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6352 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6353 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6354 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6355 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6356 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6357 | |
| 6358 | /* FIXME: use matrix-type input source selection */ |
| 6359 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6360 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6364 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6365 | /* Input mixer2 */ |
| 6366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6369 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6370 | /* Input mixer3 */ |
| 6371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6375 | |
| 6376 | { } |
| 6377 | }; |
| 6378 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6379 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6380 | #define alc882_loopbacks alc880_loopbacks |
| 6381 | #endif |
| 6382 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6383 | /* pcm configuration: identiacal with ALC880 */ |
| 6384 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6385 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6386 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6387 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6388 | |
| 6389 | /* |
| 6390 | * configuration and preset |
| 6391 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6392 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6393 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6394 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6395 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6396 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6397 | [ALC882_TARGA] = "targa", |
| 6398 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6399 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6400 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6401 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6402 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6403 | [ALC882_AUTO] = "auto", |
| 6404 | }; |
| 6405 | |
| 6406 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6407 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6408 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6409 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6410 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6411 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6412 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6413 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6414 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6415 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6416 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6417 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6418 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6419 | {} |
| 6420 | }; |
| 6421 | |
| 6422 | static struct alc_config_preset alc882_presets[] = { |
| 6423 | [ALC882_3ST_DIG] = { |
| 6424 | .mixers = { alc882_base_mixer }, |
| 6425 | .init_verbs = { alc882_init_verbs }, |
| 6426 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6427 | .dac_nids = alc882_dac_nids, |
| 6428 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6429 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6430 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6431 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6432 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6433 | .input_mux = &alc882_capture_source, |
| 6434 | }, |
| 6435 | [ALC882_6ST_DIG] = { |
| 6436 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6437 | .init_verbs = { alc882_init_verbs }, |
| 6438 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6439 | .dac_nids = alc882_dac_nids, |
| 6440 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6441 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6442 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6443 | .channel_mode = alc882_sixstack_modes, |
| 6444 | .input_mux = &alc882_capture_source, |
| 6445 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6446 | [ALC882_ARIMA] = { |
| 6447 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6448 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6449 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6450 | .dac_nids = alc882_dac_nids, |
| 6451 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6452 | .channel_mode = alc882_sixstack_modes, |
| 6453 | .input_mux = &alc882_capture_source, |
| 6454 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6455 | [ALC882_W2JC] = { |
| 6456 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6457 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6458 | alc880_gpio1_init_verbs }, |
| 6459 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6460 | .dac_nids = alc882_dac_nids, |
| 6461 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6462 | .channel_mode = alc880_threestack_modes, |
| 6463 | .need_dac_fix = 1, |
| 6464 | .input_mux = &alc882_capture_source, |
| 6465 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6466 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6467 | [ALC885_MBP3] = { |
| 6468 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6469 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6470 | alc880_gpio1_init_verbs }, |
| 6471 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6472 | .dac_nids = alc882_dac_nids, |
| 6473 | .channel_mode = alc885_mbp_6ch_modes, |
| 6474 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6475 | .input_mux = &alc882_capture_source, |
| 6476 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6477 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6478 | .unsol_event = alc885_mbp3_unsol_event, |
| 6479 | .init_hook = alc885_mbp3_automute, |
| 6480 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6481 | [ALC885_MACPRO] = { |
| 6482 | .mixers = { alc882_macpro_mixer }, |
| 6483 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6484 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6485 | .dac_nids = alc882_dac_nids, |
| 6486 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6487 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6488 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6489 | .channel_mode = alc882_ch_modes, |
| 6490 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6491 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6492 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6493 | [ALC885_IMAC24] = { |
| 6494 | .mixers = { alc885_imac24_mixer }, |
| 6495 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6496 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6497 | .dac_nids = alc882_dac_nids, |
| 6498 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6499 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6500 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6501 | .channel_mode = alc882_ch_modes, |
| 6502 | .input_mux = &alc882_capture_source, |
| 6503 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6504 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6505 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6506 | [ALC882_TARGA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6507 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6508 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6509 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6510 | .dac_nids = alc882_dac_nids, |
| 6511 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6512 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6513 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6514 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6515 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6516 | .channel_mode = alc882_3ST_6ch_modes, |
| 6517 | .need_dac_fix = 1, |
| 6518 | .input_mux = &alc882_capture_source, |
| 6519 | .unsol_event = alc882_targa_unsol_event, |
| 6520 | .init_hook = alc882_targa_automute, |
| 6521 | }, |
| 6522 | [ALC882_ASUS_A7J] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6523 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6524 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6525 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6526 | .dac_nids = alc882_dac_nids, |
| 6527 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6528 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6529 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6530 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6531 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6532 | .channel_mode = alc882_3ST_6ch_modes, |
| 6533 | .need_dac_fix = 1, |
| 6534 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6535 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6536 | [ALC882_ASUS_A7M] = { |
| 6537 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6538 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6539 | alc880_gpio1_init_verbs, |
| 6540 | alc882_asus_a7m_verbs }, |
| 6541 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6542 | .dac_nids = alc882_dac_nids, |
| 6543 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6544 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6545 | .channel_mode = alc880_threestack_modes, |
| 6546 | .need_dac_fix = 1, |
| 6547 | .input_mux = &alc882_capture_source, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6548 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6549 | }; |
| 6550 | |
| 6551 | |
| 6552 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6553 | * Pin config fixes |
| 6554 | */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6555 | enum { |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6556 | PINFIX_ABIT_AW9D_MAX |
| 6557 | }; |
| 6558 | |
| 6559 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6560 | { 0x15, 0x01080104 }, /* side */ |
| 6561 | { 0x16, 0x01011012 }, /* rear */ |
| 6562 | { 0x17, 0x01016011 }, /* clfe */ |
| 6563 | { } |
| 6564 | }; |
| 6565 | |
| 6566 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6567 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6568 | }; |
| 6569 | |
| 6570 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6571 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6572 | {} |
| 6573 | }; |
| 6574 | |
| 6575 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6576 | * BIOS auto configuration |
| 6577 | */ |
| 6578 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6579 | hda_nid_t nid, int pin_type, |
| 6580 | int dac_idx) |
| 6581 | { |
| 6582 | /* set as output */ |
| 6583 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6584 | int idx; |
| 6585 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6586 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6587 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6588 | idx = 4; |
| 6589 | else |
| 6590 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6591 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6592 | |
| 6593 | } |
| 6594 | |
| 6595 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6596 | { |
| 6597 | struct alc_spec *spec = codec->spec; |
| 6598 | int i; |
| 6599 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6600 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6601 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6602 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6603 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6604 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6605 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6606 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6607 | } |
| 6608 | } |
| 6609 | |
| 6610 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6611 | { |
| 6612 | struct alc_spec *spec = codec->spec; |
| 6613 | hda_nid_t pin; |
| 6614 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6615 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6616 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6617 | /* use dac 0 */ |
| 6618 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6619 | pin = spec->autocfg.speaker_pins[0]; |
| 6620 | if (pin) |
| 6621 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6622 | } |
| 6623 | |
| 6624 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6625 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6626 | |
| 6627 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6628 | { |
| 6629 | struct alc_spec *spec = codec->spec; |
| 6630 | int i; |
| 6631 | |
| 6632 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6633 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6634 | unsigned int vref; |
| 6635 | if (!nid) |
| 6636 | continue; |
| 6637 | vref = PIN_IN; |
| 6638 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6639 | unsigned int pincap; |
| 6640 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6641 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6642 | AC_PINCAP_VREF_80) |
| 6643 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6644 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6645 | snd_hda_codec_write(codec, nid, 0, |
| 6646 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6647 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6648 | snd_hda_codec_write(codec, nid, 0, |
| 6649 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6650 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6651 | } |
| 6652 | } |
| 6653 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6654 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 6655 | { |
| 6656 | struct alc_spec *spec = codec->spec; |
| 6657 | const struct hda_input_mux *imux = spec->input_mux; |
| 6658 | int c; |
| 6659 | |
| 6660 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 6661 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 6662 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 6663 | int conns, mute, idx, item; |
| 6664 | |
| 6665 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 6666 | ARRAY_SIZE(conn_list)); |
| 6667 | if (conns < 0) |
| 6668 | continue; |
| 6669 | for (idx = 0; idx < conns; idx++) { |
| 6670 | /* if the current connection is the selected one, |
| 6671 | * unmute it as default - otherwise mute it |
| 6672 | */ |
| 6673 | mute = AMP_IN_MUTE(idx); |
| 6674 | for (item = 0; item < imux->num_items; item++) { |
| 6675 | if (imux->items[item].index == idx) { |
| 6676 | if (spec->cur_mux[c] == item) |
| 6677 | mute = AMP_IN_UNMUTE(idx); |
| 6678 | break; |
| 6679 | } |
| 6680 | } |
| 6681 | snd_hda_codec_write(codec, nid, 0, |
| 6682 | AC_VERB_SET_AMP_GAIN_MUTE, mute); |
| 6683 | } |
| 6684 | } |
| 6685 | } |
| 6686 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6687 | /* add mic boosts if needed */ |
| 6688 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6689 | { |
| 6690 | struct alc_spec *spec = codec->spec; |
| 6691 | int err; |
| 6692 | hda_nid_t nid; |
| 6693 | |
| 6694 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6695 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6696 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6697 | "Mic Boost", |
| 6698 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6699 | if (err < 0) |
| 6700 | return err; |
| 6701 | } |
| 6702 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6703 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6704 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6705 | "Front Mic Boost", |
| 6706 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6707 | if (err < 0) |
| 6708 | return err; |
| 6709 | } |
| 6710 | return 0; |
| 6711 | } |
| 6712 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6713 | /* almost identical with ALC880 parser... */ |
| 6714 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6715 | { |
| 6716 | struct alc_spec *spec = codec->spec; |
| 6717 | int err = alc880_parse_auto_config(codec); |
| 6718 | |
| 6719 | if (err < 0) |
| 6720 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6721 | else if (!err) |
| 6722 | return 0; /* no config found */ |
| 6723 | |
| 6724 | err = alc_auto_add_mic_boost(codec); |
| 6725 | if (err < 0) |
| 6726 | return err; |
| 6727 | |
| 6728 | /* hack - override the init verbs */ |
| 6729 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6730 | |
| 6731 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6732 | } |
| 6733 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6734 | /* additional initialization for auto-configuration model */ |
| 6735 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6736 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6737 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6738 | alc882_auto_init_multi_out(codec); |
| 6739 | alc882_auto_init_hp_out(codec); |
| 6740 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 6741 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6742 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6743 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6744 | } |
| 6745 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6746 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6747 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6748 | static int patch_alc882(struct hda_codec *codec) |
| 6749 | { |
| 6750 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6751 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6752 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6753 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6754 | if (spec == NULL) |
| 6755 | return -ENOMEM; |
| 6756 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6757 | codec->spec = spec; |
| 6758 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6759 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6760 | alc882_models, |
| 6761 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6762 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6763 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6764 | /* Pick up systems that don't supply PCI SSID */ |
| 6765 | switch (codec->subsystem_id) { |
| 6766 | case 0x106b0c00: /* Mac Pro */ |
| 6767 | board_config = ALC885_MACPRO; |
| 6768 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6769 | case 0x106b1000: /* iMac 24 */ |
Peter Korsgaard | f3911c5 | 2008-09-27 09:13:45 +0200 | [diff] [blame] | 6770 | case 0x106b2800: /* AppleTV */ |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6771 | board_config = ALC885_IMAC24; |
| 6772 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6773 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
David Woodhouse | 9c95c43 | 2008-09-18 13:37:13 -0700 | [diff] [blame] | 6774 | case 0x106b00a4: /* MacbookPro4,1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6775 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6776 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6777 | board_config = ALC885_MBP3; |
| 6778 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6779 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6780 | /* ALC889A is handled better as ALC888-compatible */ |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 6781 | if (codec->revision_id == 0x100101 || |
| 6782 | codec->revision_id == 0x100103) { |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6783 | alc_free(codec); |
| 6784 | return patch_alc883(codec); |
| 6785 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6786 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6787 | "trying auto-probe from BIOS...\n"); |
| 6788 | board_config = ALC882_AUTO; |
| 6789 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6790 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6791 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6792 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6793 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6794 | if (board_config == ALC882_AUTO) { |
| 6795 | /* automatic parse from the BIOS config */ |
| 6796 | err = alc882_parse_auto_config(codec); |
| 6797 | if (err < 0) { |
| 6798 | alc_free(codec); |
| 6799 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6800 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6801 | printk(KERN_INFO |
| 6802 | "hda_codec: Cannot set up configuration " |
| 6803 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6804 | board_config = ALC882_3ST_DIG; |
| 6805 | } |
| 6806 | } |
| 6807 | |
| 6808 | if (board_config != ALC882_AUTO) |
| 6809 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6810 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6811 | if (codec->vendor_id == 0x10ec0885) { |
| 6812 | spec->stream_name_analog = "ALC885 Analog"; |
| 6813 | spec->stream_name_digital = "ALC885 Digital"; |
| 6814 | } else { |
| 6815 | spec->stream_name_analog = "ALC882 Analog"; |
| 6816 | spec->stream_name_digital = "ALC882 Digital"; |
| 6817 | } |
| 6818 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6819 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6820 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6821 | /* FIXME: setup DAC5 */ |
| 6822 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6823 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6825 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6826 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6827 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 6828 | spec->is_mix_capture = 1; /* matrix-style capture */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6829 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6830 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6831 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6832 | /* get type */ |
| 6833 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6834 | if (wcap != AC_WID_AUD_IN) { |
| 6835 | spec->adc_nids = alc882_adc_nids_alt; |
| 6836 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6837 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6838 | } else { |
| 6839 | spec->adc_nids = alc882_adc_nids; |
| 6840 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6841 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6842 | } |
| 6843 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6844 | set_capture_mixer(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6845 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6846 | spec->vmaster_nid = 0x0c; |
| 6847 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6848 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6849 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6850 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6851 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6852 | if (!spec->loopback.amplist) |
| 6853 | spec->loopback.amplist = alc882_loopbacks; |
| 6854 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6855 | |
| 6856 | return 0; |
| 6857 | } |
| 6858 | |
| 6859 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6860 | * ALC883 support |
| 6861 | * |
| 6862 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6863 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6864 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6865 | * 6-channel independent captures. |
| 6866 | * |
| 6867 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6868 | * driver yet). |
| 6869 | */ |
| 6870 | #define ALC883_DIGOUT_NID 0x06 |
| 6871 | #define ALC883_DIGIN_NID 0x0a |
| 6872 | |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 6873 | #define ALC1200_DIGOUT_NID 0x10 |
| 6874 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6875 | static hda_nid_t alc883_dac_nids[4] = { |
| 6876 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6877 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6878 | }; |
| 6879 | |
| 6880 | static hda_nid_t alc883_adc_nids[2] = { |
| 6881 | /* ADC1-2 */ |
| 6882 | 0x08, 0x09, |
| 6883 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6884 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6885 | static hda_nid_t alc883_adc_nids_alt[1] = { |
| 6886 | /* ADC1 */ |
| 6887 | 0x08, |
| 6888 | }; |
| 6889 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6890 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6891 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6892 | /* input MUX */ |
| 6893 | /* FIXME: should be a matrix-type input source selection */ |
| 6894 | |
| 6895 | static struct hda_input_mux alc883_capture_source = { |
| 6896 | .num_items = 4, |
| 6897 | .items = { |
| 6898 | { "Mic", 0x0 }, |
| 6899 | { "Front Mic", 0x1 }, |
| 6900 | { "Line", 0x2 }, |
| 6901 | { "CD", 0x4 }, |
| 6902 | }, |
| 6903 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6904 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6905 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6906 | .num_items = 4, |
| 6907 | .items = { |
| 6908 | { "Mic", 0x1 }, |
| 6909 | { "Front Mic", 0x0 }, |
| 6910 | { "Line", 0x2 }, |
| 6911 | { "CD", 0x4 }, |
| 6912 | }, |
| 6913 | }; |
| 6914 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6915 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6916 | .num_items = 2, |
| 6917 | .items = { |
| 6918 | { "Mic", 0x1 }, |
| 6919 | { "Line", 0x2 }, |
| 6920 | }, |
| 6921 | }; |
| 6922 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6923 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6924 | .num_items = 4, |
| 6925 | .items = { |
| 6926 | { "Mic", 0x0 }, |
| 6927 | { "iMic", 0x1 }, |
| 6928 | { "Line", 0x2 }, |
| 6929 | { "CD", 0x4 }, |
| 6930 | }, |
| 6931 | }; |
| 6932 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6933 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6934 | .num_items = 2, |
| 6935 | .items = { |
| 6936 | { "Mic", 0x0 }, |
| 6937 | { "Int Mic", 0x1 }, |
| 6938 | }, |
| 6939 | }; |
| 6940 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 6941 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6942 | .num_items = 3, |
| 6943 | .items = { |
| 6944 | { "Mic", 0x0 }, |
| 6945 | { "Front Mic", 0x1 }, |
| 6946 | { "Line", 0x4 }, |
| 6947 | }, |
| 6948 | }; |
| 6949 | |
| 6950 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6951 | .num_items = 2, |
| 6952 | .items = { |
| 6953 | { "Mic", 0x0 }, |
| 6954 | { "Line", 0x2 }, |
| 6955 | }, |
| 6956 | }; |
| 6957 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6958 | /* |
| 6959 | * 2ch mode |
| 6960 | */ |
| 6961 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6962 | { 2, NULL } |
| 6963 | }; |
| 6964 | |
| 6965 | /* |
| 6966 | * 2ch mode |
| 6967 | */ |
| 6968 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6969 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6970 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6971 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6972 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6973 | { } /* end */ |
| 6974 | }; |
| 6975 | |
| 6976 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6977 | * 4ch mode |
| 6978 | */ |
| 6979 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6980 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6981 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6982 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6983 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6984 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6985 | { } /* end */ |
| 6986 | }; |
| 6987 | |
| 6988 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6989 | * 6ch mode |
| 6990 | */ |
| 6991 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6992 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6993 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6994 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6995 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6996 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6997 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6998 | { } /* end */ |
| 6999 | }; |
| 7000 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7001 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7002 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 7003 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7004 | { 6, alc883_3ST_ch6_init }, |
| 7005 | }; |
| 7006 | |
| 7007 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7008 | * 2ch mode |
| 7009 | */ |
| 7010 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7011 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7012 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7013 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7014 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7015 | { } /* end */ |
| 7016 | }; |
| 7017 | |
| 7018 | /* |
| 7019 | * 4ch mode |
| 7020 | */ |
| 7021 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7022 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7023 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7026 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7027 | { } /* end */ |
| 7028 | }; |
| 7029 | |
| 7030 | /* |
| 7031 | * 6ch mode |
| 7032 | */ |
| 7033 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7034 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7035 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7036 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7037 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7038 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7039 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7040 | { } /* end */ |
| 7041 | }; |
| 7042 | |
| 7043 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7044 | { 2, alc883_3ST_ch2_intel_init }, |
| 7045 | { 4, alc883_3ST_ch4_intel_init }, |
| 7046 | { 6, alc883_3ST_ch6_intel_init }, |
| 7047 | }; |
| 7048 | |
| 7049 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7050 | * 6ch mode |
| 7051 | */ |
| 7052 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7053 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7054 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7055 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7056 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7057 | { } /* end */ |
| 7058 | }; |
| 7059 | |
| 7060 | /* |
| 7061 | * 8ch mode |
| 7062 | */ |
| 7063 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7064 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7065 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7066 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7067 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7068 | { } /* end */ |
| 7069 | }; |
| 7070 | |
| 7071 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7072 | { 6, alc883_sixstack_ch6_init }, |
| 7073 | { 8, alc883_sixstack_ch8_init }, |
| 7074 | }; |
| 7075 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7076 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7077 | /* eanable EAPD on medion laptop */ |
| 7078 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7079 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7080 | { } |
| 7081 | }; |
| 7082 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7083 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7084 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7085 | */ |
| 7086 | |
| 7087 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 7088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7089 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7090 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7091 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7092 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7093 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7094 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7095 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7096 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7097 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7098 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7099 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7100 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7101 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7102 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7103 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7104 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7106 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7107 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7108 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7109 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7110 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7111 | { } /* end */ |
| 7112 | }; |
| 7113 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7114 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7115 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7116 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7117 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7118 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7119 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7120 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7122 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7123 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7125 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7126 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7127 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7128 | { } /* end */ |
| 7129 | }; |
| 7130 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7131 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7133 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7134 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7135 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7139 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7140 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7141 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7142 | { } /* end */ |
| 7143 | }; |
| 7144 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7145 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7146 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7147 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7148 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7149 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7151 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7152 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7153 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7154 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7155 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7156 | { } /* end */ |
| 7157 | }; |
| 7158 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7159 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7161 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7162 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7163 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7164 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7165 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7166 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7167 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7168 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7170 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7171 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7172 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7173 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7174 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7175 | { } /* end */ |
| 7176 | }; |
| 7177 | |
| 7178 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7179 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7180 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7181 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7182 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7183 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7184 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7185 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7186 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7187 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7188 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7189 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7190 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7191 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7193 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7194 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7195 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7196 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7197 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7198 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7199 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7200 | { } /* end */ |
| 7201 | }; |
| 7202 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7203 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7204 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7205 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7206 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7207 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7208 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7209 | HDA_OUTPUT), |
| 7210 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7211 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7212 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7213 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7214 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7215 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7216 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7217 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7218 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7219 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7221 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7222 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7223 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7224 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7225 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7226 | { } /* end */ |
| 7227 | }; |
| 7228 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7229 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7230 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7231 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7232 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7233 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7234 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7235 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7236 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7237 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7238 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7240 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7241 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7242 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7244 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7246 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7247 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7248 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7249 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7250 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7251 | { } /* end */ |
| 7252 | }; |
| 7253 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7254 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7255 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7256 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7257 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7258 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7259 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7260 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7261 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7262 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7263 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7265 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7266 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7267 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7268 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7269 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7270 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7271 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7272 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7273 | |
| 7274 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7275 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7276 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7277 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7278 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7279 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7281 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7282 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7283 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7284 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7285 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7286 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7287 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7288 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7289 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7291 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7292 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7293 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7294 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7296 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7298 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7299 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7300 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7301 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7302 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7303 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7304 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7305 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7306 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7309 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7310 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7311 | { } /* end */ |
| 7312 | }; |
| 7313 | |
| 7314 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7315 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7316 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7317 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7318 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7319 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7320 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7321 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7322 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7323 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7324 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7325 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7326 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7327 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7328 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7329 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7330 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7331 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7332 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7334 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7336 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7337 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7338 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7339 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7340 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7341 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7342 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7343 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7344 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7345 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7346 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7347 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7348 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7349 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7350 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7352 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 7353 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7354 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7355 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7356 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7357 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7358 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7360 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7361 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7362 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7363 | { } /* end */ |
| 7364 | }; |
| 7365 | |
| 7366 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7367 | .ops = &snd_hda_bind_vol, |
| 7368 | .values = { |
| 7369 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7370 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7371 | 0 |
| 7372 | }, |
| 7373 | }; |
| 7374 | |
| 7375 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7376 | .ops = &snd_hda_bind_sw, |
| 7377 | .values = { |
| 7378 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7379 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7380 | 0 |
| 7381 | }, |
| 7382 | }; |
| 7383 | |
| 7384 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7385 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7386 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7387 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7388 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7389 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7390 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7391 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7393 | { } /* end */ |
| 7394 | }; |
| 7395 | |
| 7396 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7397 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7398 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7399 | { |
| 7400 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7401 | /* .name = "Capture Source", */ |
| 7402 | .name = "Input Source", |
| 7403 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7404 | .info = alc_mux_enum_info, |
| 7405 | .get = alc_mux_enum_get, |
| 7406 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7407 | }, |
| 7408 | { } /* end */ |
| 7409 | }; |
| 7410 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7411 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7412 | { |
| 7413 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7414 | .name = "Channel Mode", |
| 7415 | .info = alc_ch_mode_info, |
| 7416 | .get = alc_ch_mode_get, |
| 7417 | .put = alc_ch_mode_put, |
| 7418 | }, |
| 7419 | { } /* end */ |
| 7420 | }; |
| 7421 | |
| 7422 | static struct hda_verb alc883_init_verbs[] = { |
| 7423 | /* ADC1: mute amp left and right */ |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7424 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7425 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7426 | /* ADC2: mute amp left and right */ |
| 7427 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7428 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7429 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7433 | /* Rear mixer */ |
| 7434 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7435 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7436 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7437 | /* CLFE mixer */ |
| 7438 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7439 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7441 | /* Side mixer */ |
| 7442 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7443 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7444 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7445 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7446 | /* mute analog input loopbacks */ |
| 7447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7450 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7451 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7452 | |
| 7453 | /* Front Pin: output 0 (0x0c) */ |
| 7454 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7455 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7456 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7457 | /* Rear Pin: output 1 (0x0d) */ |
| 7458 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7459 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7461 | /* CLFE Pin: output 2 (0x0e) */ |
| 7462 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7463 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7464 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7465 | /* Side Pin: output 3 (0x0f) */ |
| 7466 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7467 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7468 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7469 | /* Mic (rear) pin: input vref at 80% */ |
| 7470 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7471 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7472 | /* Front Mic pin: input vref at 80% */ |
| 7473 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7474 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7475 | /* Line In pin: input */ |
| 7476 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7477 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7478 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7479 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7480 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7481 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7482 | /* CD pin widget for input */ |
| 7483 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7484 | |
| 7485 | /* FIXME: use matrix-type input source selection */ |
| 7486 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7487 | /* Input mixer2 */ |
| 7488 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7489 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7490 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7491 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7492 | /* Input mixer3 */ |
| 7493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7497 | { } |
| 7498 | }; |
| 7499 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7500 | /* toggle speaker-output according to the hp-jack state */ |
| 7501 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7502 | { |
| 7503 | unsigned int present; |
| 7504 | |
| 7505 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7506 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7507 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7508 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7509 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7510 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7511 | } |
| 7512 | |
| 7513 | /* auto-toggle front mic */ |
| 7514 | /* |
| 7515 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7516 | { |
| 7517 | unsigned int present; |
| 7518 | unsigned char bits; |
| 7519 | |
| 7520 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7521 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7522 | bits = present ? HDA_AMP_MUTE : 0; |
| 7523 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7524 | } |
| 7525 | */ |
| 7526 | |
| 7527 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7528 | { |
| 7529 | alc883_mitac_hp_automute(codec); |
| 7530 | /* alc883_mitac_mic_automute(codec); */ |
| 7531 | } |
| 7532 | |
| 7533 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7534 | unsigned int res) |
| 7535 | { |
| 7536 | switch (res >> 26) { |
| 7537 | case ALC880_HP_EVENT: |
| 7538 | alc883_mitac_hp_automute(codec); |
| 7539 | break; |
| 7540 | case ALC880_MIC_EVENT: |
| 7541 | /* alc883_mitac_mic_automute(codec); */ |
| 7542 | break; |
| 7543 | } |
| 7544 | } |
| 7545 | |
| 7546 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7547 | /* HP */ |
| 7548 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7549 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7550 | /* Subwoofer */ |
| 7551 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7552 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7553 | |
| 7554 | /* enable unsolicited event */ |
| 7555 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7556 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7557 | |
| 7558 | { } /* end */ |
| 7559 | }; |
| 7560 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7561 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7562 | /* HP */ |
| 7563 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7565 | /* Int speaker */ |
| 7566 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7567 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7568 | |
| 7569 | /* enable unsolicited event */ |
| 7570 | {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] | 7571 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7572 | |
| 7573 | { } /* end */ |
| 7574 | }; |
| 7575 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7576 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7577 | /* HP */ |
| 7578 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7579 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7580 | /* Subwoofer */ |
| 7581 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7582 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7583 | |
| 7584 | /* enable unsolicited event */ |
| 7585 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7586 | |
| 7587 | { } /* end */ |
| 7588 | }; |
| 7589 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7590 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7593 | |
| 7594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7595 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7596 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7597 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7598 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7599 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7600 | |
| 7601 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7602 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7603 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7604 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7605 | |
| 7606 | { } /* end */ |
| 7607 | }; |
| 7608 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7609 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7611 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7612 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7613 | { } /* end */ |
| 7614 | }; |
| 7615 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7616 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7617 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7618 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7619 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7620 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7621 | { } /* end */ |
| 7622 | }; |
| 7623 | |
| 7624 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7625 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7626 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7627 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7628 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7629 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7630 | { } /* end */ |
| 7631 | }; |
| 7632 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7633 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7634 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7636 | |
| 7637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7638 | |
| 7639 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7641 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7642 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7643 | { } /* end */ |
| 7644 | }; |
| 7645 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7646 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7647 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7649 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7650 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7651 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7652 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7653 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7654 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7655 | { } /* end */ |
| 7656 | }; |
| 7657 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7658 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7659 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7660 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7661 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7662 | { } |
| 7663 | }; |
| 7664 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7665 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7666 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7667 | { } |
| 7668 | }; |
| 7669 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7670 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7671 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7672 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7673 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7674 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7675 | { } |
| 7676 | }; |
| 7677 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7678 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7679 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7680 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7681 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7682 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7683 | { } |
| 7684 | }; |
| 7685 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7686 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7687 | { 2, alc888_3st_hp_2ch_init }, |
| 7688 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7689 | }; |
| 7690 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7691 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7692 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7693 | { |
| 7694 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7695 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7696 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7697 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7698 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7699 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7700 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7701 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7702 | } |
| 7703 | |
| 7704 | /* toggle RCA according to the front-jack state */ |
| 7705 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7706 | { |
| 7707 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7708 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7709 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7710 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7711 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7712 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7713 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7714 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7715 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7716 | unsigned int res) |
| 7717 | { |
| 7718 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7719 | alc888_lenovo_ms7195_front_automute(codec); |
| 7720 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7721 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7722 | } |
| 7723 | |
| 7724 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7726 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7727 | |
| 7728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7729 | |
| 7730 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7731 | { } /* end */ |
| 7732 | }; |
| 7733 | |
| 7734 | /* toggle speaker-output according to the hp-jack state */ |
| 7735 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7736 | { |
| 7737 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7738 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7739 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7740 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7741 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7742 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7743 | } |
| 7744 | |
| 7745 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7746 | unsigned int res) |
| 7747 | { |
| 7748 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7749 | alc883_medion_md2_automute(codec); |
| 7750 | } |
| 7751 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7752 | /* toggle speaker-output according to the hp-jack state */ |
| 7753 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7754 | { |
| 7755 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7756 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7757 | |
| 7758 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7759 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7760 | bits = present ? HDA_AMP_MUTE : 0; |
| 7761 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7762 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7763 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7764 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7765 | } |
| 7766 | |
| 7767 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7768 | { |
| 7769 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7770 | alc883_tagra_automute(codec); |
| 7771 | } |
| 7772 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7773 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7774 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7775 | { |
| 7776 | unsigned int present; |
| 7777 | unsigned char bits; |
| 7778 | |
| 7779 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7780 | & AC_PINSENSE_PRESENCE; |
| 7781 | bits = present ? HDA_AMP_MUTE : 0; |
| 7782 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7783 | HDA_AMP_MUTE, bits); |
| 7784 | } |
| 7785 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7786 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7787 | { |
| 7788 | unsigned int present; |
| 7789 | |
| 7790 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7791 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7792 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7793 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7794 | } |
| 7795 | |
| 7796 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7797 | { |
| 7798 | alc883_clevo_m720_hp_automute(codec); |
| 7799 | alc883_clevo_m720_mic_automute(codec); |
| 7800 | } |
| 7801 | |
| 7802 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7803 | unsigned int res) |
| 7804 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7805 | switch (res >> 26) { |
| 7806 | case ALC880_HP_EVENT: |
| 7807 | alc883_clevo_m720_hp_automute(codec); |
| 7808 | break; |
| 7809 | case ALC880_MIC_EVENT: |
| 7810 | alc883_clevo_m720_mic_automute(codec); |
| 7811 | break; |
| 7812 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7813 | } |
| 7814 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7815 | /* toggle speaker-output according to the hp-jack state */ |
| 7816 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7817 | { |
| 7818 | unsigned int present; |
| 7819 | unsigned char bits; |
| 7820 | |
| 7821 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7822 | & AC_PINSENSE_PRESENCE; |
| 7823 | bits = present ? HDA_AMP_MUTE : 0; |
| 7824 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7825 | HDA_AMP_MUTE, bits); |
| 7826 | } |
| 7827 | |
| 7828 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7829 | unsigned int res) |
| 7830 | { |
| 7831 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7832 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7833 | } |
| 7834 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7835 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7836 | { |
| 7837 | unsigned int present; |
| 7838 | unsigned char bits; |
| 7839 | |
| 7840 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7841 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7842 | bits = present ? 0x80 : 0; |
| 7843 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7844 | 0x80, bits); |
| 7845 | } |
| 7846 | |
| 7847 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7848 | unsigned int res) |
| 7849 | { |
| 7850 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7851 | alc883_haier_w66_automute(codec); |
| 7852 | } |
| 7853 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7854 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7855 | { |
| 7856 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7857 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7858 | |
| 7859 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7860 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7861 | bits = present ? HDA_AMP_MUTE : 0; |
| 7862 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7863 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7864 | } |
| 7865 | |
| 7866 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7867 | { |
| 7868 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7869 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7870 | |
| 7871 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7872 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7873 | bits = present ? HDA_AMP_MUTE : 0; |
| 7874 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7875 | HDA_AMP_MUTE, bits); |
| 7876 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7877 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7878 | } |
| 7879 | |
| 7880 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7881 | unsigned int res) |
| 7882 | { |
| 7883 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7884 | alc883_lenovo_101e_all_automute(codec); |
| 7885 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7886 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7887 | } |
| 7888 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7889 | /* toggle speaker-output according to the hp-jack state */ |
| 7890 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7891 | { |
| 7892 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7893 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7894 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7895 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7896 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7897 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7898 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7899 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7900 | } |
| 7901 | |
| 7902 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7903 | unsigned int res) |
| 7904 | { |
| 7905 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7906 | alc883_acer_aspire_automute(codec); |
| 7907 | } |
| 7908 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7909 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7910 | /* HP Pin: output 0 (0x0c) */ |
| 7911 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7912 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7913 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7914 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7915 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7916 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7917 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7918 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7919 | /* eanable EAPD on medion laptop */ |
| 7920 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7921 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7922 | /* enable unsolicited event */ |
| 7923 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7924 | { } |
| 7925 | }; |
| 7926 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7927 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7928 | { |
| 7929 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7930 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7931 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7932 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7933 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7934 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7935 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7936 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7937 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7938 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7939 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7940 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7941 | } |
| 7942 | |
| 7943 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7944 | unsigned int res) |
| 7945 | { |
| 7946 | switch (res >> 26) { |
| 7947 | case ALC880_HP_EVENT: |
| 7948 | printk("hp_event\n"); |
| 7949 | alc888_6st_dell_front_automute(codec); |
| 7950 | break; |
| 7951 | } |
| 7952 | } |
| 7953 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7954 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) |
| 7955 | { |
| 7956 | unsigned int mute; |
| 7957 | unsigned int present; |
| 7958 | |
| 7959 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 7960 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7961 | AC_VERB_GET_PIN_SENSE, 0); |
| 7962 | present = (present & 0x80000000) != 0; |
| 7963 | if (present) { |
| 7964 | /* mute internal speaker */ |
| 7965 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7966 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7967 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7968 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7969 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7970 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7971 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7972 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7973 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7974 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 7975 | } else { |
| 7976 | /* unmute internal speaker if necessary */ |
| 7977 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 7978 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7979 | HDA_AMP_MUTE, mute); |
| 7980 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7981 | HDA_AMP_MUTE, mute); |
| 7982 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7983 | HDA_AMP_MUTE, mute); |
| 7984 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7985 | HDA_AMP_MUTE, mute); |
| 7986 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 7987 | HDA_AMP_MUTE, mute); |
| 7988 | } |
| 7989 | } |
| 7990 | |
| 7991 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, |
| 7992 | unsigned int res) |
| 7993 | { |
| 7994 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7995 | alc888_lenovo_sky_front_automute(codec); |
| 7996 | } |
| 7997 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7998 | /* |
| 7999 | * generic initialization of ADC, input mixers and output mixers |
| 8000 | */ |
| 8001 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 8002 | /* |
| 8003 | * Unmute ADC0-2 and set the default input to mic-in |
| 8004 | */ |
| 8005 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8007 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8008 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8009 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8010 | /* 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] | 8011 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8012 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8013 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8014 | */ |
| 8015 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8017 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8018 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8019 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8020 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8021 | |
| 8022 | /* |
| 8023 | * Set up output mixers (0x0c - 0x0f) |
| 8024 | */ |
| 8025 | /* set vol=0 to output mixers */ |
| 8026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8028 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8029 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8030 | /* set up input amps for analog loopback */ |
| 8031 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8033 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8034 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8035 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8036 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8037 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8038 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8039 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8040 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8041 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8042 | |
| 8043 | /* FIXME: use matrix-type input source selection */ |
| 8044 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8045 | /* Input mixer1 */ |
| 8046 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8047 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8048 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8049 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 8051 | /* Input mixer2 */ |
| 8052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8054 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8055 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 8056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8057 | |
| 8058 | { } |
| 8059 | }; |
| 8060 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8061 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8064 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8065 | /* enable unsolicited event */ |
| 8066 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8067 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8068 | { } /* end */ |
| 8069 | }; |
| 8070 | |
| 8071 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8072 | { |
| 8073 | unsigned int present; |
| 8074 | |
| 8075 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8076 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8077 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8078 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8079 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8080 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8081 | } |
| 8082 | |
| 8083 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) |
| 8084 | { |
| 8085 | unsigned int present; |
| 8086 | unsigned char bits; |
| 8087 | |
| 8088 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8089 | AC_VERB_GET_PIN_SENSE, 0) |
| 8090 | & AC_PINSENSE_PRESENCE; |
| 8091 | bits = present ? 0 : PIN_OUT; |
| 8092 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8093 | bits); |
| 8094 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8095 | bits); |
| 8096 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8097 | bits); |
| 8098 | } |
| 8099 | |
| 8100 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8101 | unsigned int res) |
| 8102 | { |
| 8103 | switch (res >> 26) { |
| 8104 | case ALC880_HP_EVENT: |
| 8105 | alc883_M90V_speaker_automute(codec); |
| 8106 | break; |
| 8107 | case ALC880_MIC_EVENT: |
| 8108 | alc883_nb_mic_automute(codec); |
| 8109 | break; |
| 8110 | } |
| 8111 | } |
| 8112 | |
| 8113 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8114 | { |
| 8115 | alc883_M90V_speaker_automute(codec); |
| 8116 | alc883_nb_mic_automute(codec); |
| 8117 | } |
| 8118 | |
| 8119 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8121 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8123 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8124 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8125 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8126 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8127 | /* enable unsolicited event */ |
| 8128 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8129 | { } /* end */ |
| 8130 | }; |
| 8131 | |
| 8132 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) |
| 8133 | { |
| 8134 | unsigned int present; |
| 8135 | unsigned char bits; |
| 8136 | |
| 8137 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8138 | AC_VERB_GET_PIN_SENSE, 0) |
| 8139 | & AC_PINSENSE_PRESENCE; |
| 8140 | bits = present ? 0 : PIN_OUT; |
| 8141 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8142 | bits); |
| 8143 | } |
| 8144 | |
| 8145 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, |
| 8146 | unsigned int res) |
| 8147 | { |
| 8148 | switch (res >> 26) { |
| 8149 | case ALC880_HP_EVENT: |
| 8150 | alc883_eee1601_speaker_automute(codec); |
| 8151 | break; |
| 8152 | } |
| 8153 | } |
| 8154 | |
| 8155 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8156 | { |
| 8157 | alc883_eee1601_speaker_automute(codec); |
| 8158 | } |
| 8159 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8160 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8161 | #define alc883_loopbacks alc880_loopbacks |
| 8162 | #endif |
| 8163 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8164 | /* pcm configuration: identiacal with ALC880 */ |
| 8165 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 8166 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8167 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8168 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 8169 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 8170 | |
| 8171 | /* |
| 8172 | * configuration and preset |
| 8173 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8174 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 8175 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 8176 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8177 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 8178 | [ALC883_6ST_DIG] = "6stack-dig", |
| 8179 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8180 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8181 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8182 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8183 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8184 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8185 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8186 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8187 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8188 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8189 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8190 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8191 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8192 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8193 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8194 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8195 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8196 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8197 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8198 | [ALC883_AUTO] = "auto", |
| 8199 | }; |
| 8200 | |
| 8201 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 8202 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8203 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8204 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8205 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8206 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8207 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8208 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8209 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8210 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8211 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8212 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8213 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8214 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8215 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8216 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8217 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8218 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8219 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8220 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8221 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8222 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8223 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 8224 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8225 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8226 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8227 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8228 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8229 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8230 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8231 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8232 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8233 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8234 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8235 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8236 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 8237 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8238 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8239 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8240 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8241 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8242 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8243 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8244 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8245 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8246 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8247 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8248 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8249 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8250 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8251 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8252 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8253 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8254 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8255 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8256 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8257 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8258 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8259 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8260 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8261 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8262 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8263 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8264 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8265 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8266 | {} |
| 8267 | }; |
| 8268 | |
| 8269 | static struct alc_config_preset alc883_presets[] = { |
| 8270 | [ALC883_3ST_2ch_DIG] = { |
| 8271 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8272 | .init_verbs = { alc883_init_verbs }, |
| 8273 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8274 | .dac_nids = alc883_dac_nids, |
| 8275 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8276 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8277 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8278 | .channel_mode = alc883_3ST_2ch_modes, |
| 8279 | .input_mux = &alc883_capture_source, |
| 8280 | }, |
| 8281 | [ALC883_3ST_6ch_DIG] = { |
| 8282 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8283 | .init_verbs = { alc883_init_verbs }, |
| 8284 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8285 | .dac_nids = alc883_dac_nids, |
| 8286 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8287 | .dig_in_nid = ALC883_DIGIN_NID, |
| 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 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8293 | [ALC883_3ST_6ch] = { |
| 8294 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8295 | .init_verbs = { alc883_init_verbs }, |
| 8296 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8297 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8298 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8299 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8300 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8301 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8302 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8303 | [ALC883_3ST_6ch_INTEL] = { |
| 8304 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8305 | .init_verbs = { alc883_init_verbs }, |
| 8306 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8307 | .dac_nids = alc883_dac_nids, |
| 8308 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8309 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8310 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8311 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8312 | .need_dac_fix = 1, |
| 8313 | .input_mux = &alc883_3stack_6ch_intel, |
| 8314 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8315 | [ALC883_6ST_DIG] = { |
| 8316 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8317 | .init_verbs = { alc883_init_verbs }, |
| 8318 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8319 | .dac_nids = alc883_dac_nids, |
| 8320 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8321 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8322 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8323 | .channel_mode = alc883_sixstack_modes, |
| 8324 | .input_mux = &alc883_capture_source, |
| 8325 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8326 | [ALC883_TARGA_DIG] = { |
| 8327 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8328 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8329 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8330 | .dac_nids = alc883_dac_nids, |
| 8331 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8332 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8333 | .channel_mode = alc883_3ST_6ch_modes, |
| 8334 | .need_dac_fix = 1, |
| 8335 | .input_mux = &alc883_capture_source, |
| 8336 | .unsol_event = alc883_tagra_unsol_event, |
| 8337 | .init_hook = alc883_tagra_automute, |
| 8338 | }, |
| 8339 | [ALC883_TARGA_2ch_DIG] = { |
| 8340 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8341 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8342 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8343 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8344 | .adc_nids = alc883_adc_nids_alt, |
| 8345 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8346 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8347 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8348 | .channel_mode = alc883_3ST_2ch_modes, |
| 8349 | .input_mux = &alc883_capture_source, |
| 8350 | .unsol_event = alc883_tagra_unsol_event, |
| 8351 | .init_hook = alc883_tagra_automute, |
| 8352 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8353 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8354 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8355 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8356 | * and the headphone jack. Turn this on and rely on the |
| 8357 | * standard mute methods whenever the user wants to turn |
| 8358 | * these outputs off. |
| 8359 | */ |
| 8360 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8361 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8362 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +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, |
| 8366 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8367 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8368 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8369 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8370 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8371 | .dac_nids = alc883_dac_nids, |
| 8372 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8373 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8374 | .channel_mode = alc883_3ST_2ch_modes, |
| 8375 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8376 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8377 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8378 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8379 | [ALC883_MEDION] = { |
| 8380 | .mixers = { alc883_fivestack_mixer, |
| 8381 | alc883_chmode_mixer }, |
| 8382 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8383 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8384 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8385 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8386 | .adc_nids = alc883_adc_nids_alt, |
| 8387 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8388 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8389 | .channel_mode = alc883_sixstack_modes, |
| 8390 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8391 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8392 | [ALC883_MEDION_MD2] = { |
| 8393 | .mixers = { alc883_medion_md2_mixer}, |
| 8394 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8395 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8396 | .dac_nids = alc883_dac_nids, |
| 8397 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8398 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8399 | .channel_mode = alc883_3ST_2ch_modes, |
| 8400 | .input_mux = &alc883_capture_source, |
| 8401 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8402 | .init_hook = alc883_medion_md2_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8403 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8404 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8405 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8406 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8407 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8408 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8409 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8410 | .channel_mode = alc883_3ST_2ch_modes, |
| 8411 | .input_mux = &alc883_capture_source, |
| 8412 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8413 | [ALC883_CLEVO_M720] = { |
| 8414 | .mixers = { alc883_clevo_m720_mixer }, |
| 8415 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8416 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8417 | .dac_nids = alc883_dac_nids, |
| 8418 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8419 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8420 | .channel_mode = alc883_3ST_2ch_modes, |
| 8421 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8422 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8423 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8424 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8425 | [ALC883_LENOVO_101E_2ch] = { |
| 8426 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8427 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8428 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8429 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8430 | .adc_nids = alc883_adc_nids_alt, |
| 8431 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8432 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8433 | .channel_mode = alc883_3ST_2ch_modes, |
| 8434 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8435 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8436 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8437 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8438 | [ALC883_LENOVO_NB0763] = { |
| 8439 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8440 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8441 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8442 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8443 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8444 | .channel_mode = alc883_3ST_2ch_modes, |
| 8445 | .need_dac_fix = 1, |
| 8446 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8447 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8448 | .init_hook = alc883_medion_md2_automute, |
| 8449 | }, |
| 8450 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8451 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8452 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8453 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8454 | .dac_nids = alc883_dac_nids, |
| 8455 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8456 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8457 | .channel_mode = alc883_3ST_6ch_modes, |
| 8458 | .need_dac_fix = 1, |
| 8459 | .input_mux = &alc883_capture_source, |
| 8460 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8461 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8462 | }, |
| 8463 | [ALC883_HAIER_W66] = { |
| 8464 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8465 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8466 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8467 | .dac_nids = alc883_dac_nids, |
| 8468 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8469 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8470 | .channel_mode = alc883_3ST_2ch_modes, |
| 8471 | .input_mux = &alc883_capture_source, |
| 8472 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8473 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8474 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8475 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8476 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8477 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8478 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8479 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8480 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8481 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8482 | .need_dac_fix = 1, |
| 8483 | .input_mux = &alc883_capture_source, |
| 8484 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8485 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8486 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8487 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8488 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8489 | .dac_nids = alc883_dac_nids, |
| 8490 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8491 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8492 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8493 | .channel_mode = alc883_sixstack_modes, |
| 8494 | .input_mux = &alc883_capture_source, |
| 8495 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8496 | .init_hook = alc888_6st_dell_front_automute, |
| 8497 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8498 | [ALC883_MITAC] = { |
| 8499 | .mixers = { alc883_mitac_mixer }, |
| 8500 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8501 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8502 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8503 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8504 | .channel_mode = alc883_3ST_2ch_modes, |
| 8505 | .input_mux = &alc883_capture_source, |
| 8506 | .unsol_event = alc883_mitac_unsol_event, |
| 8507 | .init_hook = alc883_mitac_automute, |
| 8508 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8509 | [ALC883_FUJITSU_PI2515] = { |
| 8510 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8511 | .init_verbs = { alc883_init_verbs, |
| 8512 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8513 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8514 | .dac_nids = alc883_dac_nids, |
| 8515 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8516 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8517 | .channel_mode = alc883_3ST_2ch_modes, |
| 8518 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8519 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8520 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8521 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8522 | [ALC888_LENOVO_SKY] = { |
| 8523 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8524 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8525 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8526 | .dac_nids = alc883_dac_nids, |
| 8527 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8528 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8529 | .channel_mode = alc883_sixstack_modes, |
| 8530 | .need_dac_fix = 1, |
| 8531 | .input_mux = &alc883_lenovo_sky_capture_source, |
| 8532 | .unsol_event = alc883_lenovo_sky_unsol_event, |
| 8533 | .init_hook = alc888_lenovo_sky_front_automute, |
| 8534 | }, |
| 8535 | [ALC888_ASUS_M90V] = { |
| 8536 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8537 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 8538 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8539 | .dac_nids = alc883_dac_nids, |
| 8540 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8541 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8542 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8543 | .channel_mode = alc883_3ST_6ch_modes, |
| 8544 | .need_dac_fix = 1, |
| 8545 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8546 | .unsol_event = alc883_mode2_unsol_event, |
| 8547 | .init_hook = alc883_mode2_inithook, |
| 8548 | }, |
| 8549 | [ALC888_ASUS_EEE1601] = { |
| 8550 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8551 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8552 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 8553 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8554 | .dac_nids = alc883_dac_nids, |
| 8555 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8556 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8557 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8558 | .channel_mode = alc883_3ST_2ch_modes, |
| 8559 | .need_dac_fix = 1, |
| 8560 | .input_mux = &alc883_asus_eee1601_capture_source, |
| 8561 | .unsol_event = alc883_eee1601_unsol_event, |
| 8562 | .init_hook = alc883_eee1601_inithook, |
| 8563 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8564 | [ALC1200_ASUS_P5Q] = { |
| 8565 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8566 | .init_verbs = { alc883_init_verbs }, |
| 8567 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8568 | .dac_nids = alc883_dac_nids, |
| 8569 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 8570 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8571 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8572 | .channel_mode = alc883_sixstack_modes, |
| 8573 | .input_mux = &alc883_capture_source, |
| 8574 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8575 | }; |
| 8576 | |
| 8577 | |
| 8578 | /* |
| 8579 | * BIOS auto configuration |
| 8580 | */ |
| 8581 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8582 | hda_nid_t nid, int pin_type, |
| 8583 | int dac_idx) |
| 8584 | { |
| 8585 | /* set as output */ |
| 8586 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8587 | int idx; |
| 8588 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8589 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8590 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8591 | idx = 4; |
| 8592 | else |
| 8593 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8594 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8595 | |
| 8596 | } |
| 8597 | |
| 8598 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8599 | { |
| 8600 | struct alc_spec *spec = codec->spec; |
| 8601 | int i; |
| 8602 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8603 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8604 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8605 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8606 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8607 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8608 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8609 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8610 | } |
| 8611 | } |
| 8612 | |
| 8613 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8614 | { |
| 8615 | struct alc_spec *spec = codec->spec; |
| 8616 | hda_nid_t pin; |
| 8617 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8618 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8619 | if (pin) /* connect to front */ |
| 8620 | /* use dac 0 */ |
| 8621 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8622 | pin = spec->autocfg.speaker_pins[0]; |
| 8623 | if (pin) |
| 8624 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8625 | } |
| 8626 | |
| 8627 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8628 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8629 | |
| 8630 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8631 | { |
| 8632 | struct alc_spec *spec = codec->spec; |
| 8633 | int i; |
| 8634 | |
| 8635 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8636 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8637 | if (alc883_is_input_pin(nid)) { |
| 8638 | snd_hda_codec_write(codec, nid, 0, |
| 8639 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8640 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8641 | PIN_VREF80 : PIN_IN)); |
| 8642 | if (nid != ALC883_PIN_CD_NID) |
| 8643 | snd_hda_codec_write(codec, nid, 0, |
| 8644 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8645 | AMP_OUT_MUTE); |
| 8646 | } |
| 8647 | } |
| 8648 | } |
| 8649 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8650 | #define alc883_auto_init_input_src alc882_auto_init_input_src |
| 8651 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8652 | /* almost identical with ALC880 parser... */ |
| 8653 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8654 | { |
| 8655 | struct alc_spec *spec = codec->spec; |
| 8656 | int err = alc880_parse_auto_config(codec); |
| 8657 | |
| 8658 | if (err < 0) |
| 8659 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8660 | else if (!err) |
| 8661 | return 0; /* no config found */ |
| 8662 | |
| 8663 | err = alc_auto_add_mic_boost(codec); |
| 8664 | if (err < 0) |
| 8665 | return err; |
| 8666 | |
| 8667 | /* hack - override the init verbs */ |
| 8668 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8669 | |
| 8670 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8671 | } |
| 8672 | |
| 8673 | /* additional initialization for auto-configuration model */ |
| 8674 | static void alc883_auto_init(struct hda_codec *codec) |
| 8675 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8676 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8677 | alc883_auto_init_multi_out(codec); |
| 8678 | alc883_auto_init_hp_out(codec); |
| 8679 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 8680 | alc883_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8681 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 8682 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8683 | } |
| 8684 | |
| 8685 | static int patch_alc883(struct hda_codec *codec) |
| 8686 | { |
| 8687 | struct alc_spec *spec; |
| 8688 | int err, board_config; |
| 8689 | |
| 8690 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8691 | if (spec == NULL) |
| 8692 | return -ENOMEM; |
| 8693 | |
| 8694 | codec->spec = spec; |
| 8695 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8696 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8697 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8698 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8699 | alc883_models, |
| 8700 | alc883_cfg_tbl); |
| 8701 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8702 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8703 | "trying auto-probe from BIOS...\n"); |
| 8704 | board_config = ALC883_AUTO; |
| 8705 | } |
| 8706 | |
| 8707 | if (board_config == ALC883_AUTO) { |
| 8708 | /* automatic parse from the BIOS config */ |
| 8709 | err = alc883_parse_auto_config(codec); |
| 8710 | if (err < 0) { |
| 8711 | alc_free(codec); |
| 8712 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8713 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8714 | printk(KERN_INFO |
| 8715 | "hda_codec: Cannot set up configuration " |
| 8716 | "from BIOS. Using base mode...\n"); |
| 8717 | board_config = ALC883_3ST_2ch_DIG; |
| 8718 | } |
| 8719 | } |
| 8720 | |
| 8721 | if (board_config != ALC883_AUTO) |
| 8722 | setup_preset(spec, &alc883_presets[board_config]); |
| 8723 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8724 | switch (codec->vendor_id) { |
| 8725 | case 0x10ec0888: |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 8726 | if (codec->revision_id == 0x100101) { |
| 8727 | spec->stream_name_analog = "ALC1200 Analog"; |
| 8728 | spec->stream_name_digital = "ALC1200 Digital"; |
| 8729 | } else { |
| 8730 | spec->stream_name_analog = "ALC888 Analog"; |
| 8731 | spec->stream_name_digital = "ALC888 Digital"; |
| 8732 | } |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8733 | break; |
| 8734 | case 0x10ec0889: |
| 8735 | spec->stream_name_analog = "ALC889 Analog"; |
| 8736 | spec->stream_name_digital = "ALC889 Digital"; |
| 8737 | break; |
| 8738 | default: |
| 8739 | spec->stream_name_analog = "ALC883 Analog"; |
| 8740 | spec->stream_name_digital = "ALC883 Digital"; |
| 8741 | break; |
| 8742 | } |
| 8743 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8744 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8745 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8746 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8747 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8748 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8749 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8750 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8751 | if (!spec->num_adc_nids) { |
| 8752 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8753 | spec->adc_nids = alc883_adc_nids; |
| 8754 | } |
| 8755 | if (!spec->capsrc_nids) |
| 8756 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8757 | spec->is_mix_capture = 1; /* matrix-style capture */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8758 | if (!spec->cap_mixer) |
| 8759 | set_capture_mixer(spec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8760 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8761 | spec->vmaster_nid = 0x0c; |
| 8762 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8763 | codec->patch_ops = alc_patch_ops; |
| 8764 | if (board_config == ALC883_AUTO) |
| 8765 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8766 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8767 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8768 | if (!spec->loopback.amplist) |
| 8769 | spec->loopback.amplist = alc883_loopbacks; |
| 8770 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8771 | |
| 8772 | return 0; |
| 8773 | } |
| 8774 | |
| 8775 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8776 | * ALC262 support |
| 8777 | */ |
| 8778 | |
| 8779 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8780 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8781 | |
| 8782 | #define alc262_dac_nids alc260_dac_nids |
| 8783 | #define alc262_adc_nids alc882_adc_nids |
| 8784 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8785 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8786 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8787 | |
| 8788 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8789 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8790 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 8791 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 8792 | /* ADC0 */ |
| 8793 | 0x09 |
| 8794 | }; |
| 8795 | |
| 8796 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 8797 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8798 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8799 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8800 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8801 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8802 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8803 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8804 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8807 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8808 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8809 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8810 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8811 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8812 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8813 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8814 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8815 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8816 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8817 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8818 | }; |
| 8819 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8820 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8821 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8822 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8823 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8824 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8825 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8826 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8829 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8830 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8831 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8832 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8833 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8834 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8835 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8837 | { } /* end */ |
| 8838 | }; |
| 8839 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8840 | /* update HP, line and mono-out pins according to the master switch */ |
| 8841 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8842 | { |
| 8843 | struct alc_spec *spec = codec->spec; |
| 8844 | int val = spec->master_sw; |
| 8845 | |
| 8846 | /* HP & line-out */ |
| 8847 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8848 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8849 | val ? PIN_HP : 0); |
| 8850 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8851 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8852 | val ? PIN_HP : 0); |
| 8853 | /* mono (speaker) depending on the HP jack sense */ |
| 8854 | val = val && !spec->jack_present; |
| 8855 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8856 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8857 | val ? PIN_OUT : 0); |
| 8858 | } |
| 8859 | |
| 8860 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8861 | { |
| 8862 | struct alc_spec *spec = codec->spec; |
| 8863 | unsigned int presence; |
| 8864 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8865 | AC_VERB_GET_PIN_SENSE, 0); |
| 8866 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8867 | alc262_hp_master_update(codec); |
| 8868 | } |
| 8869 | |
| 8870 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8871 | { |
| 8872 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8873 | return; |
| 8874 | alc262_hp_bpc_automute(codec); |
| 8875 | } |
| 8876 | |
| 8877 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8878 | { |
| 8879 | struct alc_spec *spec = codec->spec; |
| 8880 | unsigned int presence; |
| 8881 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8882 | AC_VERB_GET_PIN_SENSE, 0); |
| 8883 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8884 | alc262_hp_master_update(codec); |
| 8885 | } |
| 8886 | |
| 8887 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8888 | unsigned int res) |
| 8889 | { |
| 8890 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8891 | return; |
| 8892 | alc262_hp_wildwest_automute(codec); |
| 8893 | } |
| 8894 | |
| 8895 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8896 | struct snd_ctl_elem_value *ucontrol) |
| 8897 | { |
| 8898 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8899 | struct alc_spec *spec = codec->spec; |
| 8900 | *ucontrol->value.integer.value = spec->master_sw; |
| 8901 | return 0; |
| 8902 | } |
| 8903 | |
| 8904 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8905 | struct snd_ctl_elem_value *ucontrol) |
| 8906 | { |
| 8907 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8908 | struct alc_spec *spec = codec->spec; |
| 8909 | int val = !!*ucontrol->value.integer.value; |
| 8910 | |
| 8911 | if (val == spec->master_sw) |
| 8912 | return 0; |
| 8913 | spec->master_sw = val; |
| 8914 | alc262_hp_master_update(codec); |
| 8915 | return 1; |
| 8916 | } |
| 8917 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8918 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8919 | { |
| 8920 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8921 | .name = "Master Playback Switch", |
| 8922 | .info = snd_ctl_boolean_mono_info, |
| 8923 | .get = alc262_hp_master_sw_get, |
| 8924 | .put = alc262_hp_master_sw_put, |
| 8925 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8926 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8927 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8928 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8929 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8930 | HDA_OUTPUT), |
| 8931 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8932 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8933 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8934 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8935 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8936 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8937 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8938 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8939 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8941 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8942 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8943 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8944 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8945 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8946 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8947 | { } /* end */ |
| 8948 | }; |
| 8949 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8950 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8951 | { |
| 8952 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8953 | .name = "Master Playback Switch", |
| 8954 | .info = snd_ctl_boolean_mono_info, |
| 8955 | .get = alc262_hp_master_sw_get, |
| 8956 | .put = alc262_hp_master_sw_put, |
| 8957 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8958 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8959 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8960 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8962 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8963 | HDA_OUTPUT), |
| 8964 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8965 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8966 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8967 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8968 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8971 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8972 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8973 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8974 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8975 | { } /* end */ |
| 8976 | }; |
| 8977 | |
| 8978 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8979 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8980 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8981 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8982 | { } /* end */ |
| 8983 | }; |
| 8984 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8985 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8986 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8987 | { |
| 8988 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8989 | |
| 8990 | if (force || !spec->sense_updated) { |
| 8991 | unsigned int present; |
| 8992 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8993 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8994 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8995 | spec->sense_updated = 1; |
| 8996 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8997 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8998 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8999 | } |
| 9000 | |
| 9001 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 9002 | unsigned int res) |
| 9003 | { |
| 9004 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9005 | return; |
| 9006 | alc262_hp_t5735_automute(codec, 1); |
| 9007 | } |
| 9008 | |
| 9009 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 9010 | { |
| 9011 | alc262_hp_t5735_automute(codec, 1); |
| 9012 | } |
| 9013 | |
| 9014 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9015 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9016 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9017 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9018 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9021 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9022 | { } /* end */ |
| 9023 | }; |
| 9024 | |
| 9025 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9028 | |
| 9029 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9030 | { } |
| 9031 | }; |
| 9032 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9033 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9034 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9035 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9036 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9037 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9039 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9040 | { } /* end */ |
| 9041 | }; |
| 9042 | |
| 9043 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9044 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9045 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9046 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9047 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9048 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9049 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9054 | {} |
| 9055 | }; |
| 9056 | |
| 9057 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9058 | .num_items = 1, |
| 9059 | .items = { |
| 9060 | { "Line", 0x1 }, |
| 9061 | }, |
| 9062 | }; |
| 9063 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9064 | /* bind hp and internal speaker mute (with plug check) */ |
| 9065 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9066 | struct snd_ctl_elem_value *ucontrol) |
| 9067 | { |
| 9068 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9069 | long *valp = ucontrol->value.integer.value; |
| 9070 | int change; |
| 9071 | |
| 9072 | /* change hp mute */ |
| 9073 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 9074 | HDA_AMP_MUTE, |
| 9075 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9076 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 9077 | HDA_AMP_MUTE, |
| 9078 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9079 | if (change) { |
| 9080 | /* change speaker according to HP jack state */ |
| 9081 | struct alc_spec *spec = codec->spec; |
| 9082 | unsigned int mute; |
| 9083 | if (spec->jack_present) |
| 9084 | mute = HDA_AMP_MUTE; |
| 9085 | else |
| 9086 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 9087 | HDA_OUTPUT, 0); |
| 9088 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9089 | HDA_AMP_MUTE, mute); |
| 9090 | } |
| 9091 | return change; |
| 9092 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9093 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9094 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9095 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9096 | { |
| 9097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9098 | .name = "Master Playback Switch", |
| 9099 | .info = snd_hda_mixer_amp_switch_info, |
| 9100 | .get = snd_hda_mixer_amp_switch_get, |
| 9101 | .put = alc262_sony_master_sw_put, |
| 9102 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9103 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9104 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9106 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9107 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9108 | { } /* end */ |
| 9109 | }; |
| 9110 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9111 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 9112 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9113 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9114 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9117 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9118 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9119 | { } /* end */ |
| 9120 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9121 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9122 | #define alc262_capture_mixer alc882_capture_mixer |
| 9123 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9124 | |
| 9125 | /* |
| 9126 | * generic initialization of ADC, input mixers and output mixers |
| 9127 | */ |
| 9128 | static struct hda_verb alc262_init_verbs[] = { |
| 9129 | /* |
| 9130 | * Unmute ADC0-2 and set the default input to mic-in |
| 9131 | */ |
| 9132 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9134 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9135 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9136 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9137 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9138 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9139 | /* 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] | 9140 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9141 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9142 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9143 | */ |
| 9144 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9145 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9146 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9149 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9150 | |
| 9151 | /* |
| 9152 | * Set up output mixers (0x0c - 0x0e) |
| 9153 | */ |
| 9154 | /* set vol=0 to output mixers */ |
| 9155 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9156 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9157 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9158 | /* set up input amps for analog loopback */ |
| 9159 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9160 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9161 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9162 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9163 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9164 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9165 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9166 | |
| 9167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9169 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9170 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9171 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9172 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9173 | |
| 9174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9176 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9177 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9178 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9180 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9181 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9183 | /* FIXME: use matrix-type input source selection */ |
| 9184 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9185 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9186 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9187 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9188 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9189 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9190 | /* Input mixer2 */ |
| 9191 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9192 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9193 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9194 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9195 | /* Input mixer3 */ |
| 9196 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9198 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9199 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9200 | |
| 9201 | { } |
| 9202 | }; |
| 9203 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9204 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9205 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9206 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9207 | { } |
| 9208 | }; |
| 9209 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9210 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9211 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9212 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9213 | {} |
| 9214 | }; |
| 9215 | |
| 9216 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9217 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9218 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9219 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9220 | |
| 9221 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9222 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9223 | {} |
| 9224 | }; |
| 9225 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9226 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9229 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9230 | |
| 9231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9233 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9234 | }; |
| 9235 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9236 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9237 | .num_items = 2, |
| 9238 | .items = { |
| 9239 | { "Int DMic", 0x9 }, |
| 9240 | { "Mic", 0x0 }, |
| 9241 | }, |
| 9242 | }; |
| 9243 | |
| 9244 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9245 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9246 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9248 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9249 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9250 | { } /* end */ |
| 9251 | }; |
| 9252 | |
| 9253 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9254 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9258 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9259 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9260 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9261 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9262 | {} |
| 9263 | }; |
| 9264 | |
| 9265 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9266 | { |
| 9267 | unsigned int present; |
| 9268 | |
| 9269 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9270 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9271 | snd_hda_codec_write(codec, 0x22, 0, |
| 9272 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9273 | } |
| 9274 | |
| 9275 | /* toggle speaker-output according to the hp-jack state */ |
| 9276 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) |
| 9277 | { |
| 9278 | unsigned int present; |
| 9279 | unsigned char bits; |
| 9280 | |
| 9281 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9282 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9283 | bits = present ? 0 : PIN_OUT; |
| 9284 | snd_hda_codec_write(codec, 0x14, 0, |
| 9285 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 9286 | } |
| 9287 | |
| 9288 | |
| 9289 | |
| 9290 | /* unsolicited event for HP jack sensing */ |
| 9291 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9292 | unsigned int res) |
| 9293 | { |
| 9294 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9295 | alc262_toshiba_s06_speaker_automute(codec); |
| 9296 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9297 | alc262_dmic_automute(codec); |
| 9298 | |
| 9299 | } |
| 9300 | |
| 9301 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9302 | { |
| 9303 | alc262_toshiba_s06_speaker_automute(codec); |
| 9304 | alc262_dmic_automute(codec); |
| 9305 | } |
| 9306 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9307 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9308 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9309 | { |
| 9310 | struct alc_spec *spec = codec->spec; |
| 9311 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9312 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9313 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9314 | /* need to execute and sync at first */ |
| 9315 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9316 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9317 | AC_VERB_GET_PIN_SENSE, 0); |
| 9318 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9319 | if (spec->jack_present) { |
| 9320 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9321 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9322 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9323 | } else { |
| 9324 | /* unmute internal speaker if necessary */ |
| 9325 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9326 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9327 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9328 | } |
| 9329 | } |
| 9330 | |
| 9331 | /* unsolicited event for HP jack sensing */ |
| 9332 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 9333 | unsigned int res) |
| 9334 | { |
| 9335 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9336 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9337 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9338 | } |
| 9339 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9340 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9341 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9342 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9343 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9344 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9345 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9346 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 9347 | AC_VERB_GET_PIN_SENSE, 0); |
| 9348 | present = (present & 0x80000000) != 0; |
| 9349 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9350 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9351 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9352 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9353 | } else { |
| 9354 | /* unmute internal speaker if necessary */ |
| 9355 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9356 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9357 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9358 | } |
| 9359 | } |
| 9360 | |
| 9361 | /* unsolicited event for HP jack sensing */ |
| 9362 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 9363 | unsigned int res) |
| 9364 | { |
| 9365 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9366 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9367 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9368 | } |
| 9369 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9370 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9371 | * nec model |
| 9372 | * 0x15 = headphone |
| 9373 | * 0x16 = internal speaker |
| 9374 | * 0x18 = external mic |
| 9375 | */ |
| 9376 | |
| 9377 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 9378 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9379 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 9380 | |
| 9381 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9382 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9383 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9384 | |
| 9385 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9386 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9387 | { } /* end */ |
| 9388 | }; |
| 9389 | |
| 9390 | static struct hda_verb alc262_nec_verbs[] = { |
| 9391 | /* Unmute Speaker */ |
| 9392 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9393 | |
| 9394 | /* Headphone */ |
| 9395 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9396 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9397 | |
| 9398 | /* External mic to headphone */ |
| 9399 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9400 | /* External mic to speaker */ |
| 9401 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9402 | {} |
| 9403 | }; |
| 9404 | |
| 9405 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9406 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9407 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 9408 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9409 | */ |
| 9410 | |
| 9411 | #define ALC_HP_EVENT 0x37 |
| 9412 | |
| 9413 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 9414 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9415 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9416 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9417 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9418 | {} |
| 9419 | }; |
| 9420 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9421 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 9422 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 9423 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9424 | {} |
| 9425 | }; |
| 9426 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9427 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9428 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9429 | .items = { |
| 9430 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9431 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9432 | { "CD", 0x4 }, |
| 9433 | }, |
| 9434 | }; |
| 9435 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9436 | static struct hda_input_mux alc262_HP_capture_source = { |
| 9437 | .num_items = 5, |
| 9438 | .items = { |
| 9439 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9440 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9441 | { "Line", 0x2 }, |
| 9442 | { "CD", 0x4 }, |
| 9443 | { "AUX IN", 0x6 }, |
| 9444 | }, |
| 9445 | }; |
| 9446 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9447 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 9448 | .num_items = 4, |
| 9449 | .items = { |
| 9450 | { "Mic", 0x0 }, |
| 9451 | { "Front Mic", 0x2 }, |
| 9452 | { "Line", 0x1 }, |
| 9453 | { "CD", 0x4 }, |
| 9454 | }, |
| 9455 | }; |
| 9456 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9457 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9458 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 9459 | { |
| 9460 | struct alc_spec *spec = codec->spec; |
| 9461 | unsigned int mute; |
| 9462 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9463 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9464 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9465 | /* need to execute and sync at first */ |
| 9466 | 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] | 9467 | /* check laptop HP jack */ |
| 9468 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9469 | AC_VERB_GET_PIN_SENSE, 0); |
| 9470 | /* need to execute and sync at first */ |
| 9471 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9472 | /* check docking HP jack */ |
| 9473 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 9474 | AC_VERB_GET_PIN_SENSE, 0); |
| 9475 | if (present & AC_PINSENSE_PRESENCE) |
| 9476 | spec->jack_present = 1; |
| 9477 | else |
| 9478 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9479 | spec->sense_updated = 1; |
| 9480 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9481 | /* unmute internal speaker only if both HPs are unplugged and |
| 9482 | * master switch is on |
| 9483 | */ |
| 9484 | if (spec->jack_present) |
| 9485 | mute = HDA_AMP_MUTE; |
| 9486 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9487 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9488 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9489 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9490 | } |
| 9491 | |
| 9492 | /* unsolicited event for HP jack sensing */ |
| 9493 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9494 | unsigned int res) |
| 9495 | { |
| 9496 | if ((res >> 26) != ALC_HP_EVENT) |
| 9497 | return; |
| 9498 | alc262_fujitsu_automute(codec, 1); |
| 9499 | } |
| 9500 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9501 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9502 | { |
| 9503 | alc262_fujitsu_automute(codec, 1); |
| 9504 | } |
| 9505 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9506 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9507 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9508 | .ops = &snd_hda_bind_vol, |
| 9509 | .values = { |
| 9510 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9511 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9512 | 0 |
| 9513 | }, |
| 9514 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9515 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9516 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9517 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9518 | { |
| 9519 | struct alc_spec *spec = codec->spec; |
| 9520 | unsigned int mute; |
| 9521 | |
| 9522 | if (force || !spec->sense_updated) { |
| 9523 | unsigned int present_int_hp; |
| 9524 | /* need to execute and sync at first */ |
| 9525 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9526 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9527 | AC_VERB_GET_PIN_SENSE, 0); |
| 9528 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9529 | spec->sense_updated = 1; |
| 9530 | } |
| 9531 | if (spec->jack_present) { |
| 9532 | /* mute internal speaker */ |
| 9533 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9534 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9535 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9536 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9537 | } else { |
| 9538 | /* unmute internal speaker if necessary */ |
| 9539 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9540 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9541 | HDA_AMP_MUTE, mute); |
| 9542 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9543 | HDA_AMP_MUTE, mute); |
| 9544 | } |
| 9545 | } |
| 9546 | |
| 9547 | /* unsolicited event for HP jack sensing */ |
| 9548 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9549 | unsigned int res) |
| 9550 | { |
| 9551 | if ((res >> 26) != ALC_HP_EVENT) |
| 9552 | return; |
| 9553 | alc262_lenovo_3000_automute(codec, 1); |
| 9554 | } |
| 9555 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9556 | /* bind hp and internal speaker mute (with plug check) */ |
| 9557 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9558 | struct snd_ctl_elem_value *ucontrol) |
| 9559 | { |
| 9560 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9561 | long *valp = ucontrol->value.integer.value; |
| 9562 | int change; |
| 9563 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9564 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9565 | HDA_AMP_MUTE, |
| 9566 | valp ? 0 : HDA_AMP_MUTE); |
| 9567 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9568 | HDA_AMP_MUTE, |
| 9569 | valp ? 0 : HDA_AMP_MUTE); |
| 9570 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9571 | if (change) |
| 9572 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9573 | return change; |
| 9574 | } |
| 9575 | |
| 9576 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9577 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9578 | { |
| 9579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9580 | .name = "Master Playback Switch", |
| 9581 | .info = snd_hda_mixer_amp_switch_info, |
| 9582 | .get = snd_hda_mixer_amp_switch_get, |
| 9583 | .put = alc262_fujitsu_master_sw_put, |
| 9584 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9585 | }, |
| 9586 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9587 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9588 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9589 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9590 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9591 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9592 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9593 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9594 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9595 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9596 | { } /* end */ |
| 9597 | }; |
| 9598 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9599 | /* bind hp and internal speaker mute (with plug check) */ |
| 9600 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9601 | struct snd_ctl_elem_value *ucontrol) |
| 9602 | { |
| 9603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9604 | long *valp = ucontrol->value.integer.value; |
| 9605 | int change; |
| 9606 | |
| 9607 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9608 | HDA_AMP_MUTE, |
| 9609 | valp ? 0 : HDA_AMP_MUTE); |
| 9610 | |
| 9611 | if (change) |
| 9612 | alc262_lenovo_3000_automute(codec, 0); |
| 9613 | return change; |
| 9614 | } |
| 9615 | |
| 9616 | static struct snd_kcontrol_new alc262_lenovo_3000_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_lenovo_3000_master_sw_put, |
| 9624 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9625 | }, |
| 9626 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9627 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9628 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9629 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9630 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9631 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9632 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9633 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9634 | { } /* end */ |
| 9635 | }; |
| 9636 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 9637 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 9638 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9639 | { |
| 9640 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9641 | .name = "Master Playback Switch", |
| 9642 | .info = snd_hda_mixer_amp_switch_info, |
| 9643 | .get = snd_hda_mixer_amp_switch_get, |
| 9644 | .put = alc262_sony_master_sw_put, |
| 9645 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 9646 | }, |
| 9647 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9649 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9650 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9651 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9652 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9653 | { } /* end */ |
| 9654 | }; |
| 9655 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9656 | /* additional init verbs for Benq laptops */ |
| 9657 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9658 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9659 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9660 | {} |
| 9661 | }; |
| 9662 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9663 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9664 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9665 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9666 | |
| 9667 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9668 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9669 | {} |
| 9670 | }; |
| 9671 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9672 | /* Samsung Q1 Ultra Vista model setup */ |
| 9673 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9674 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9675 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9676 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9677 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9678 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9679 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9680 | { } /* end */ |
| 9681 | }; |
| 9682 | |
| 9683 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9684 | /* output mixer */ |
| 9685 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9686 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9688 | /* speaker */ |
| 9689 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9690 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9692 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9693 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9696 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9697 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9698 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9699 | /* internal mic */ |
| 9700 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9702 | /* ADC, choose mic */ |
| 9703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9706 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9707 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9708 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9709 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9710 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9711 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9712 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9713 | {} |
| 9714 | }; |
| 9715 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9716 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9717 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9718 | { |
| 9719 | struct alc_spec *spec = codec->spec; |
| 9720 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9721 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9722 | mute = 0; |
| 9723 | /* auto-mute only when HP is used as HP */ |
| 9724 | if (!spec->cur_mux[0]) { |
| 9725 | unsigned int present; |
| 9726 | /* need to execute and sync at first */ |
| 9727 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9728 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9729 | AC_VERB_GET_PIN_SENSE, 0); |
| 9730 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9731 | if (spec->jack_present) |
| 9732 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9733 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9734 | /* mute/unmute internal speaker */ |
| 9735 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9736 | HDA_AMP_MUTE, mute); |
| 9737 | /* mute/unmute HP */ |
| 9738 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9739 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9740 | } |
| 9741 | |
| 9742 | /* unsolicited event for HP jack sensing */ |
| 9743 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9744 | unsigned int res) |
| 9745 | { |
| 9746 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9747 | return; |
| 9748 | alc262_ultra_automute(codec); |
| 9749 | } |
| 9750 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9751 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9752 | .num_items = 2, |
| 9753 | .items = { |
| 9754 | { "Mic", 0x1 }, |
| 9755 | { "Headphone", 0x7 }, |
| 9756 | }, |
| 9757 | }; |
| 9758 | |
| 9759 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9760 | struct snd_ctl_elem_value *ucontrol) |
| 9761 | { |
| 9762 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9763 | struct alc_spec *spec = codec->spec; |
| 9764 | int ret; |
| 9765 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9766 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9767 | if (!ret) |
| 9768 | return 0; |
| 9769 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9770 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9771 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9772 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9773 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9774 | return ret; |
| 9775 | } |
| 9776 | |
| 9777 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9778 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9779 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9780 | { |
| 9781 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9782 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9783 | .info = alc_mux_enum_info, |
| 9784 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9785 | .put = alc262_ultra_mux_enum_put, |
| 9786 | }, |
| 9787 | { } /* end */ |
| 9788 | }; |
| 9789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9790 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9791 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9792 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9793 | { |
| 9794 | hda_nid_t nid; |
| 9795 | int err; |
| 9796 | |
| 9797 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9798 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9799 | spec->multiout.dac_nids[0] = 2; |
| 9800 | |
| 9801 | nid = cfg->line_out_pins[0]; |
| 9802 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9803 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9804 | "Front Playback Volume", |
| 9805 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9806 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9807 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9808 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9809 | "Front Playback Switch", |
| 9810 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9811 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9812 | return err; |
| 9813 | } |
| 9814 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9815 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9816 | if (nid) { |
| 9817 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9818 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9819 | "Speaker Playback Volume", |
| 9820 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9821 | HDA_OUTPUT)); |
| 9822 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9823 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9824 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9825 | "Speaker Playback Switch", |
| 9826 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9827 | HDA_OUTPUT)); |
| 9828 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9829 | return err; |
| 9830 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9831 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9832 | "Speaker Playback Switch", |
| 9833 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9834 | HDA_OUTPUT)); |
| 9835 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9836 | return err; |
| 9837 | } |
| 9838 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9839 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9840 | if (nid) { |
| 9841 | /* spec->multiout.hp_nid = 2; */ |
| 9842 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9843 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9844 | "Headphone Playback Volume", |
| 9845 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9846 | HDA_OUTPUT)); |
| 9847 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9848 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9849 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9850 | "Headphone Playback Switch", |
| 9851 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9852 | HDA_OUTPUT)); |
| 9853 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9854 | return err; |
| 9855 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9856 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9857 | "Headphone Playback Switch", |
| 9858 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9859 | HDA_OUTPUT)); |
| 9860 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9861 | return err; |
| 9862 | } |
| 9863 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9864 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9865 | } |
| 9866 | |
| 9867 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9868 | #define alc262_auto_create_analog_input_ctls \ |
| 9869 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9870 | |
| 9871 | /* |
| 9872 | * generic initialization of ADC, input mixers and output mixers |
| 9873 | */ |
| 9874 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9875 | /* |
| 9876 | * Unmute ADC0-2 and set the default input to mic-in |
| 9877 | */ |
| 9878 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9880 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9881 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9882 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9883 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9884 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9885 | /* 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] | 9886 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9887 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9888 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9889 | */ |
| 9890 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9891 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9892 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9893 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9894 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9895 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9896 | |
| 9897 | /* |
| 9898 | * Set up output mixers (0x0c - 0x0f) |
| 9899 | */ |
| 9900 | /* set vol=0 to output mixers */ |
| 9901 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9902 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9904 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9905 | /* set up input amps for analog loopback */ |
| 9906 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9909 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9911 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9912 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9913 | |
| 9914 | /* FIXME: use matrix-type input source selection */ |
| 9915 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9916 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9917 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9919 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9920 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9921 | /* Input mixer2 */ |
| 9922 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9923 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9924 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9925 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9926 | /* Input mixer3 */ |
| 9927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9929 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9931 | |
| 9932 | { } |
| 9933 | }; |
| 9934 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9935 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9936 | /* |
| 9937 | * Unmute ADC0-2 and set the default input to mic-in |
| 9938 | */ |
| 9939 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9940 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9941 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9942 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9943 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9944 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9945 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9946 | /* 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] | 9947 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9948 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9949 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9950 | */ |
| 9951 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9952 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9953 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9954 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9955 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9956 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9957 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9958 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9959 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9960 | /* |
| 9961 | * Set up output mixers (0x0c - 0x0e) |
| 9962 | */ |
| 9963 | /* set vol=0 to output mixers */ |
| 9964 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9966 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9967 | |
| 9968 | /* set up input amps for analog loopback */ |
| 9969 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9970 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9971 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9972 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9973 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9974 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9975 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9976 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9977 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9979 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9980 | |
| 9981 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9982 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9983 | |
| 9984 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9985 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9986 | |
| 9987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9988 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9989 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9990 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9991 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9992 | |
| 9993 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9994 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9995 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9996 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9997 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9998 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9999 | |
| 10000 | |
| 10001 | /* FIXME: use matrix-type input source selection */ |
| 10002 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10003 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10004 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10005 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10008 | /* Input mixer2 */ |
| 10009 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10010 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10011 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10012 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10013 | /* Input mixer3 */ |
| 10014 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10015 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10016 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10017 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10018 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10019 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10020 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10021 | { } |
| 10022 | }; |
| 10023 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10024 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10025 | /* |
| 10026 | * Unmute ADC0-2 and set the default input to mic-in |
| 10027 | */ |
| 10028 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10030 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10031 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10032 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10033 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10034 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10035 | /* 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] | 10036 | * mixer widget |
| 10037 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10038 | * panel mic (mic 2) |
| 10039 | */ |
| 10040 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10047 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10048 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10049 | /* |
| 10050 | * Set up output mixers (0x0c - 0x0e) |
| 10051 | */ |
| 10052 | /* set vol=0 to output mixers */ |
| 10053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10054 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10055 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10056 | |
| 10057 | /* set up input amps for analog loopback */ |
| 10058 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10059 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10060 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10061 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10062 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10063 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10064 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10065 | |
| 10066 | |
| 10067 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10068 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10072 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10073 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10074 | |
| 10075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10076 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10077 | |
| 10078 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10079 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10080 | |
| 10081 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10082 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10083 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10085 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10086 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10087 | |
| 10088 | /* FIXME: use matrix-type input source selection */ |
| 10089 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10090 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10091 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10093 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10094 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10095 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10096 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10097 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10098 | /* Input mixer2 */ |
| 10099 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10100 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10101 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10102 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10103 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10104 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10105 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10106 | /* Input mixer3 */ |
| 10107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10112 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10113 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10114 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10115 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10116 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10117 | { } |
| 10118 | }; |
| 10119 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10120 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10121 | |
| 10122 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10123 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10124 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10125 | |
| 10126 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10127 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10128 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10129 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10130 | |
| 10131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10133 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10134 | {} |
| 10135 | }; |
| 10136 | |
| 10137 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10138 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10139 | #define alc262_loopbacks alc880_loopbacks |
| 10140 | #endif |
| 10141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10142 | /* pcm configuration: identiacal with ALC880 */ |
| 10143 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10144 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10145 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10146 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10147 | |
| 10148 | /* |
| 10149 | * BIOS auto configuration |
| 10150 | */ |
| 10151 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10152 | { |
| 10153 | struct alc_spec *spec = codec->spec; |
| 10154 | int err; |
| 10155 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10156 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10157 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10158 | alc262_ignore); |
| 10159 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10160 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10161 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10162 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10163 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10164 | if (err < 0) |
| 10165 | return err; |
| 10166 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10167 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10168 | return err; |
| 10169 | |
| 10170 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10171 | |
| 10172 | if (spec->autocfg.dig_out_pin) |
| 10173 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 10174 | if (spec->autocfg.dig_in_pin) |
| 10175 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10176 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10177 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10178 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10179 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10180 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10181 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10182 | spec->input_mux = &spec->private_imux; |
| 10183 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10184 | err = alc_auto_add_mic_boost(codec); |
| 10185 | if (err < 0) |
| 10186 | return err; |
| 10187 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 10188 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10189 | return 1; |
| 10190 | } |
| 10191 | |
| 10192 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10193 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10194 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10195 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10196 | |
| 10197 | |
| 10198 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10199 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10200 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10201 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10202 | alc262_auto_init_multi_out(codec); |
| 10203 | alc262_auto_init_hp_out(codec); |
| 10204 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10205 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10206 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10207 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10208 | } |
| 10209 | |
| 10210 | /* |
| 10211 | * configuration and preset |
| 10212 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10213 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10214 | [ALC262_BASIC] = "basic", |
| 10215 | [ALC262_HIPPO] = "hippo", |
| 10216 | [ALC262_HIPPO_1] = "hippo_1", |
| 10217 | [ALC262_FUJITSU] = "fujitsu", |
| 10218 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10219 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10220 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10221 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10222 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10223 | [ALC262_BENQ_T31] = "benq-t31", |
| 10224 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10225 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10226 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10227 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10228 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10229 | [ALC262_NEC] = "nec", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10230 | [ALC262_AUTO] = "auto", |
| 10231 | }; |
| 10232 | |
| 10233 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10234 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10235 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10236 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10237 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10238 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 10239 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 10240 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10241 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10242 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 10243 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10244 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10245 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10246 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10247 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10248 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10249 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10250 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10251 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10252 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10253 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10254 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10255 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10256 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10257 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10258 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10259 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10260 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10261 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 10262 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10263 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10264 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10265 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10266 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10267 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10268 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10269 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10270 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10271 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10272 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10273 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10274 | {} |
| 10275 | }; |
| 10276 | |
| 10277 | static struct alc_config_preset alc262_presets[] = { |
| 10278 | [ALC262_BASIC] = { |
| 10279 | .mixers = { alc262_base_mixer }, |
| 10280 | .init_verbs = { alc262_init_verbs }, |
| 10281 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10282 | .dac_nids = alc262_dac_nids, |
| 10283 | .hp_nid = 0x03, |
| 10284 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10285 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10286 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10287 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10288 | [ALC262_HIPPO] = { |
| 10289 | .mixers = { alc262_base_mixer }, |
| 10290 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10291 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10292 | .dac_nids = alc262_dac_nids, |
| 10293 | .hp_nid = 0x03, |
| 10294 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10295 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10296 | .channel_mode = alc262_modes, |
| 10297 | .input_mux = &alc262_capture_source, |
| 10298 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10299 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10300 | }, |
| 10301 | [ALC262_HIPPO_1] = { |
| 10302 | .mixers = { alc262_hippo1_mixer }, |
| 10303 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10304 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10305 | .dac_nids = alc262_dac_nids, |
| 10306 | .hp_nid = 0x02, |
| 10307 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10308 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10309 | .channel_mode = alc262_modes, |
| 10310 | .input_mux = &alc262_capture_source, |
| 10311 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10312 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10313 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10314 | [ALC262_FUJITSU] = { |
| 10315 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10316 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10317 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10318 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10319 | .dac_nids = alc262_dac_nids, |
| 10320 | .hp_nid = 0x03, |
| 10321 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10322 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10323 | .channel_mode = alc262_modes, |
| 10324 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10325 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10326 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10327 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10328 | [ALC262_HP_BPC] = { |
| 10329 | .mixers = { alc262_HP_BPC_mixer }, |
| 10330 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10331 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10332 | .dac_nids = alc262_dac_nids, |
| 10333 | .hp_nid = 0x03, |
| 10334 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10335 | .channel_mode = alc262_modes, |
| 10336 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10337 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 10338 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10339 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10340 | [ALC262_HP_BPC_D7000_WF] = { |
| 10341 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 10342 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10343 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10344 | .dac_nids = alc262_dac_nids, |
| 10345 | .hp_nid = 0x03, |
| 10346 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10347 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10348 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10349 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10350 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10351 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10352 | [ALC262_HP_BPC_D7000_WL] = { |
| 10353 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 10354 | alc262_HP_BPC_WildWest_option_mixer }, |
| 10355 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 10356 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10357 | .dac_nids = alc262_dac_nids, |
| 10358 | .hp_nid = 0x03, |
| 10359 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10360 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10361 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10362 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 10363 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10364 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10365 | [ALC262_HP_TC_T5735] = { |
| 10366 | .mixers = { alc262_hp_t5735_mixer }, |
| 10367 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_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, |
| 10374 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 10375 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10376 | }, |
| 10377 | [ALC262_HP_RP5700] = { |
| 10378 | .mixers = { alc262_hp_rp5700_mixer }, |
| 10379 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 10380 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10381 | .dac_nids = alc262_dac_nids, |
| 10382 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10383 | .channel_mode = alc262_modes, |
| 10384 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10385 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10386 | [ALC262_BENQ_ED8] = { |
| 10387 | .mixers = { alc262_base_mixer }, |
| 10388 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 10389 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10390 | .dac_nids = alc262_dac_nids, |
| 10391 | .hp_nid = 0x03, |
| 10392 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10393 | .channel_mode = alc262_modes, |
| 10394 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10395 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10396 | [ALC262_SONY_ASSAMD] = { |
| 10397 | .mixers = { alc262_sony_mixer }, |
| 10398 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 10399 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10400 | .dac_nids = alc262_dac_nids, |
| 10401 | .hp_nid = 0x02, |
| 10402 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10403 | .channel_mode = alc262_modes, |
| 10404 | .input_mux = &alc262_capture_source, |
| 10405 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10406 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10407 | }, |
| 10408 | [ALC262_BENQ_T31] = { |
| 10409 | .mixers = { alc262_benq_t31_mixer }, |
| 10410 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 10411 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10412 | .dac_nids = alc262_dac_nids, |
| 10413 | .hp_nid = 0x03, |
| 10414 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10415 | .channel_mode = alc262_modes, |
| 10416 | .input_mux = &alc262_capture_source, |
| 10417 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10418 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10419 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10420 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10421 | .mixers = { alc262_ultra_mixer }, |
| 10422 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10423 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10424 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10425 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10426 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10427 | .channel_mode = alc262_modes, |
| 10428 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10429 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 10430 | .capsrc_nids = alc262_capsrc_nids, |
| 10431 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10432 | .unsol_event = alc262_ultra_unsol_event, |
| 10433 | .init_hook = alc262_ultra_automute, |
| 10434 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10435 | [ALC262_LENOVO_3000] = { |
| 10436 | .mixers = { alc262_lenovo_3000_mixer }, |
| 10437 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10438 | alc262_lenovo_3000_unsol_verbs }, |
| 10439 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10440 | .dac_nids = alc262_dac_nids, |
| 10441 | .hp_nid = 0x03, |
| 10442 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10443 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10444 | .channel_mode = alc262_modes, |
| 10445 | .input_mux = &alc262_fujitsu_capture_source, |
| 10446 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 10447 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10448 | [ALC262_NEC] = { |
| 10449 | .mixers = { alc262_nec_mixer }, |
| 10450 | .init_verbs = { alc262_nec_verbs }, |
| 10451 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10452 | .dac_nids = alc262_dac_nids, |
| 10453 | .hp_nid = 0x03, |
| 10454 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10455 | .channel_mode = alc262_modes, |
| 10456 | .input_mux = &alc262_capture_source, |
| 10457 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10458 | [ALC262_TOSHIBA_S06] = { |
| 10459 | .mixers = { alc262_toshiba_s06_mixer }, |
| 10460 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 10461 | alc262_eapd_verbs }, |
| 10462 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10463 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 10464 | .dac_nids = alc262_dac_nids, |
| 10465 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
| 10466 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10467 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10468 | .channel_mode = alc262_modes, |
| 10469 | .input_mux = &alc262_dmic_capture_source, |
| 10470 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 10471 | .init_hook = alc262_toshiba_s06_init_hook, |
| 10472 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10473 | [ALC262_TOSHIBA_RX1] = { |
| 10474 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 10475 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 10476 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10477 | .dac_nids = alc262_dac_nids, |
| 10478 | .hp_nid = 0x03, |
| 10479 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10480 | .channel_mode = alc262_modes, |
| 10481 | .input_mux = &alc262_capture_source, |
| 10482 | .unsol_event = alc262_hippo_unsol_event, |
| 10483 | .init_hook = alc262_hippo_automute, |
| 10484 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10485 | }; |
| 10486 | |
| 10487 | static int patch_alc262(struct hda_codec *codec) |
| 10488 | { |
| 10489 | struct alc_spec *spec; |
| 10490 | int board_config; |
| 10491 | int err; |
| 10492 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 10493 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10494 | if (spec == NULL) |
| 10495 | return -ENOMEM; |
| 10496 | |
| 10497 | codec->spec = spec; |
| 10498 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10499 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 10500 | * under-run |
| 10501 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10502 | { |
| 10503 | int tmp; |
| 10504 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10505 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 10506 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 10507 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 10508 | } |
| 10509 | #endif |
| 10510 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 10511 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10512 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10513 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 10514 | alc262_models, |
| 10515 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10516 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10517 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10518 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 10519 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10520 | board_config = ALC262_AUTO; |
| 10521 | } |
| 10522 | |
| 10523 | if (board_config == ALC262_AUTO) { |
| 10524 | /* automatic parse from the BIOS config */ |
| 10525 | err = alc262_parse_auto_config(codec); |
| 10526 | if (err < 0) { |
| 10527 | alc_free(codec); |
| 10528 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10529 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10530 | printk(KERN_INFO |
| 10531 | "hda_codec: Cannot set up configuration " |
| 10532 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10533 | board_config = ALC262_BASIC; |
| 10534 | } |
| 10535 | } |
| 10536 | |
| 10537 | if (board_config != ALC262_AUTO) |
| 10538 | setup_preset(spec, &alc262_presets[board_config]); |
| 10539 | |
| 10540 | spec->stream_name_analog = "ALC262 Analog"; |
| 10541 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 10542 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10543 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10544 | spec->stream_name_digital = "ALC262 Digital"; |
| 10545 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 10546 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 10547 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10548 | spec->is_mix_capture = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10549 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10550 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 10551 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 10552 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10553 | /* get type */ |
| 10554 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10555 | if (wcap != AC_WID_AUD_IN) { |
| 10556 | spec->adc_nids = alc262_adc_nids_alt; |
| 10557 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10558 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10559 | } else { |
| 10560 | spec->adc_nids = alc262_adc_nids; |
| 10561 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10562 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10563 | } |
| 10564 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10565 | if (!spec->cap_mixer) |
| 10566 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10567 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10568 | spec->vmaster_nid = 0x0c; |
| 10569 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10570 | codec->patch_ops = alc_patch_ops; |
| 10571 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10572 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10573 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10574 | if (!spec->loopback.amplist) |
| 10575 | spec->loopback.amplist = alc262_loopbacks; |
| 10576 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10577 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10578 | return 0; |
| 10579 | } |
| 10580 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10581 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10582 | * ALC268 channel source setting (2 channel) |
| 10583 | */ |
| 10584 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10585 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10586 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10587 | static hda_nid_t alc268_dac_nids[2] = { |
| 10588 | /* front, hp */ |
| 10589 | 0x02, 0x03 |
| 10590 | }; |
| 10591 | |
| 10592 | static hda_nid_t alc268_adc_nids[2] = { |
| 10593 | /* ADC0-1 */ |
| 10594 | 0x08, 0x07 |
| 10595 | }; |
| 10596 | |
| 10597 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10598 | /* ADC0 */ |
| 10599 | 0x08 |
| 10600 | }; |
| 10601 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10602 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10603 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10604 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10605 | /* output mixer control */ |
| 10606 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10607 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10608 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10609 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10610 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10611 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10612 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10613 | { } |
| 10614 | }; |
| 10615 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10616 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10617 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10618 | .ops = &snd_hda_bind_sw, |
| 10619 | .values = { |
| 10620 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10621 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10622 | 0 |
| 10623 | }, |
| 10624 | }; |
| 10625 | |
| 10626 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10627 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10628 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10629 | { } |
| 10630 | }; |
| 10631 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10632 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10633 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10634 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10635 | { } |
| 10636 | }; |
| 10637 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10638 | /* Toshiba specific */ |
| 10639 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10640 | |
| 10641 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10642 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10643 | { } /* end */ |
| 10644 | }; |
| 10645 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10646 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 10647 | .num_items = 2, |
| 10648 | .items = { |
| 10649 | { "i-Mic", 0x6 }, |
| 10650 | { "E-Mic", 0x0 }, |
| 10651 | }, |
| 10652 | }; |
| 10653 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10654 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10655 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10656 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10657 | .ops = &snd_hda_bind_vol, |
| 10658 | .values = { |
| 10659 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10660 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10661 | 0 |
| 10662 | }, |
| 10663 | }; |
| 10664 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10665 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10666 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10667 | { |
| 10668 | struct alc_spec *spec = codec->spec; |
| 10669 | unsigned int mute; |
| 10670 | |
| 10671 | if (force || !spec->sense_updated) { |
| 10672 | unsigned int present; |
| 10673 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10674 | AC_VERB_GET_PIN_SENSE, 0); |
| 10675 | spec->jack_present = (present & 0x80000000) != 0; |
| 10676 | spec->sense_updated = 1; |
| 10677 | } |
| 10678 | if (spec->jack_present) |
| 10679 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10680 | else /* unmute internal speaker if necessary */ |
| 10681 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10682 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10683 | HDA_AMP_MUTE, mute); |
| 10684 | } |
| 10685 | |
| 10686 | |
| 10687 | /* bind hp and internal speaker mute (with plug check) */ |
| 10688 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10689 | struct snd_ctl_elem_value *ucontrol) |
| 10690 | { |
| 10691 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10692 | long *valp = ucontrol->value.integer.value; |
| 10693 | int change; |
| 10694 | |
| 10695 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10696 | HDA_AMP_MUTE, |
| 10697 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10698 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10699 | HDA_AMP_MUTE, |
| 10700 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10701 | if (change) |
| 10702 | alc268_acer_automute(codec, 0); |
| 10703 | return change; |
| 10704 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10705 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10706 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 10707 | /* output mixer control */ |
| 10708 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10709 | { |
| 10710 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10711 | .name = "Master Playback Switch", |
| 10712 | .info = snd_hda_mixer_amp_switch_info, |
| 10713 | .get = snd_hda_mixer_amp_switch_get, |
| 10714 | .put = alc268_acer_master_sw_put, |
| 10715 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10716 | }, |
| 10717 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 10718 | { } |
| 10719 | }; |
| 10720 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10721 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10722 | /* output mixer control */ |
| 10723 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10724 | { |
| 10725 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10726 | .name = "Master Playback Switch", |
| 10727 | .info = snd_hda_mixer_amp_switch_info, |
| 10728 | .get = snd_hda_mixer_amp_switch_get, |
| 10729 | .put = alc268_acer_master_sw_put, |
| 10730 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10731 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10732 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10733 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10734 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10735 | { } |
| 10736 | }; |
| 10737 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 10738 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 10739 | /* output mixer control */ |
| 10740 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10741 | { |
| 10742 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10743 | .name = "Master Playback Switch", |
| 10744 | .info = snd_hda_mixer_amp_switch_info, |
| 10745 | .get = snd_hda_mixer_amp_switch_get, |
| 10746 | .put = alc268_acer_master_sw_put, |
| 10747 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10748 | }, |
| 10749 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10750 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 10751 | { } |
| 10752 | }; |
| 10753 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10754 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 10755 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10756 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10757 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10758 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10759 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 10760 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 10761 | { } |
| 10762 | }; |
| 10763 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10764 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10765 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10766 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10768 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10769 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10770 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10771 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10772 | { } |
| 10773 | }; |
| 10774 | |
| 10775 | /* unsolicited event for HP jack sensing */ |
| 10776 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10777 | unsigned int res) |
| 10778 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10779 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10780 | return; |
| 10781 | alc268_toshiba_automute(codec); |
| 10782 | } |
| 10783 | |
| 10784 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10785 | unsigned int res) |
| 10786 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10787 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10788 | return; |
| 10789 | alc268_acer_automute(codec, 1); |
| 10790 | } |
| 10791 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10792 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10793 | { |
| 10794 | alc268_acer_automute(codec, 1); |
| 10795 | } |
| 10796 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 10797 | /* toggle speaker-output according to the hp-jack state */ |
| 10798 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 10799 | { |
| 10800 | unsigned int present; |
| 10801 | unsigned char bits; |
| 10802 | |
| 10803 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10804 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10805 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 10806 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 10807 | AMP_IN_MUTE(0), bits); |
| 10808 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 10809 | AMP_IN_MUTE(0), bits); |
| 10810 | } |
| 10811 | |
| 10812 | |
| 10813 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 10814 | { |
| 10815 | unsigned int present; |
| 10816 | |
| 10817 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10818 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10819 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 10820 | present ? 0x0 : 0x6); |
| 10821 | } |
| 10822 | |
| 10823 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 10824 | unsigned int res) |
| 10825 | { |
| 10826 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10827 | alc268_aspire_one_speaker_automute(codec); |
| 10828 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10829 | alc268_acer_mic_automute(codec); |
| 10830 | } |
| 10831 | |
| 10832 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 10833 | { |
| 10834 | alc268_aspire_one_speaker_automute(codec); |
| 10835 | alc268_acer_mic_automute(codec); |
| 10836 | } |
| 10837 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10838 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10839 | /* output mixer control */ |
| 10840 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10841 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10842 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10843 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10844 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10845 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10846 | { } |
| 10847 | }; |
| 10848 | |
| 10849 | static struct hda_verb alc268_dell_verbs[] = { |
| 10850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10851 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10852 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10853 | { } |
| 10854 | }; |
| 10855 | |
| 10856 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10857 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10858 | { |
| 10859 | unsigned int present; |
| 10860 | unsigned int mute; |
| 10861 | |
| 10862 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10863 | if (present & 0x80000000) |
| 10864 | mute = HDA_AMP_MUTE; |
| 10865 | else |
| 10866 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10867 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10868 | HDA_AMP_MUTE, mute); |
| 10869 | } |
| 10870 | |
| 10871 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10872 | unsigned int res) |
| 10873 | { |
| 10874 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10875 | return; |
| 10876 | alc268_dell_automute(codec); |
| 10877 | } |
| 10878 | |
| 10879 | #define alc268_dell_init_hook alc268_dell_automute |
| 10880 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10881 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10882 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10883 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10884 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10886 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10887 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10888 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10889 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10890 | { } |
| 10891 | }; |
| 10892 | |
| 10893 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10894 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10895 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10896 | { } |
| 10897 | }; |
| 10898 | |
| 10899 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10900 | { |
| 10901 | unsigned int present; |
| 10902 | |
| 10903 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10904 | & AC_PINSENSE_PRESENCE; |
| 10905 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10906 | present ? 0 : PIN_OUT); |
| 10907 | } |
| 10908 | |
| 10909 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10910 | { |
| 10911 | unsigned int present; |
| 10912 | |
| 10913 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10914 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10915 | snd_hda_codec_write(codec, 0x23, 0, |
| 10916 | AC_VERB_SET_CONNECT_SEL, |
| 10917 | present ? 0x00 : 0x01); |
| 10918 | } |
| 10919 | |
| 10920 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10921 | { |
| 10922 | alc267_quanta_il1_hp_automute(codec); |
| 10923 | alc267_quanta_il1_mic_automute(codec); |
| 10924 | } |
| 10925 | |
| 10926 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10927 | unsigned int res) |
| 10928 | { |
| 10929 | switch (res >> 26) { |
| 10930 | case ALC880_HP_EVENT: |
| 10931 | alc267_quanta_il1_hp_automute(codec); |
| 10932 | break; |
| 10933 | case ALC880_MIC_EVENT: |
| 10934 | alc267_quanta_il1_mic_automute(codec); |
| 10935 | break; |
| 10936 | } |
| 10937 | } |
| 10938 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10939 | /* |
| 10940 | * generic initialization of ADC, input mixers and output mixers |
| 10941 | */ |
| 10942 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10943 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10944 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10945 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10946 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10947 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10948 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10949 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10950 | |
| 10951 | /* |
| 10952 | * Set up output mixers (0x0c - 0x0e) |
| 10953 | */ |
| 10954 | /* set vol=0 to output mixers */ |
| 10955 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10956 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10957 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10958 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10959 | |
| 10960 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10961 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10962 | |
| 10963 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10964 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10965 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10966 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10967 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10969 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10970 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10971 | |
| 10972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10975 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10977 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10978 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10979 | |
| 10980 | /* set PCBEEP vol = 0, mute connections */ |
| 10981 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10982 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10983 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10984 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10985 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10986 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10987 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10988 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10989 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10991 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10992 | { } |
| 10993 | }; |
| 10994 | |
| 10995 | /* |
| 10996 | * generic initialization of ADC, input mixers and output mixers |
| 10997 | */ |
| 10998 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10999 | /* set output DAC */ |
| 11000 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11001 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11002 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11003 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11004 | |
| 11005 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11006 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11007 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11008 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11009 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11010 | |
| 11011 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11012 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11013 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11014 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11015 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11016 | |
| 11017 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11018 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11019 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11020 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11021 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11022 | /* set PCBEEP vol = 0, mute connections */ |
| 11023 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11024 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11025 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11026 | |
| 11027 | { } |
| 11028 | }; |
| 11029 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11030 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11031 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11032 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11033 | { |
| 11034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11035 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11036 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11037 | */ |
| 11038 | /* .name = "Capture Source", */ |
| 11039 | .name = "Input Source", |
| 11040 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11041 | .info = alc_mux_enum_info, |
| 11042 | .get = alc_mux_enum_get, |
| 11043 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11044 | }, |
| 11045 | { } /* end */ |
| 11046 | }; |
| 11047 | |
| 11048 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11049 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11050 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11051 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11052 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11053 | { |
| 11054 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11055 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11056 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11057 | */ |
| 11058 | /* .name = "Capture Source", */ |
| 11059 | .name = "Input Source", |
| 11060 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11061 | .info = alc_mux_enum_info, |
| 11062 | .get = alc_mux_enum_get, |
| 11063 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11064 | }, |
| 11065 | { } /* end */ |
| 11066 | }; |
| 11067 | |
| 11068 | static struct hda_input_mux alc268_capture_source = { |
| 11069 | .num_items = 4, |
| 11070 | .items = { |
| 11071 | { "Mic", 0x0 }, |
| 11072 | { "Front Mic", 0x1 }, |
| 11073 | { "Line", 0x2 }, |
| 11074 | { "CD", 0x3 }, |
| 11075 | }, |
| 11076 | }; |
| 11077 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11078 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11079 | .num_items = 3, |
| 11080 | .items = { |
| 11081 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11082 | { "Internal Mic", 0x1 }, |
| 11083 | { "Line", 0x2 }, |
| 11084 | }, |
| 11085 | }; |
| 11086 | |
| 11087 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11088 | .num_items = 3, |
| 11089 | .items = { |
| 11090 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11091 | { "Internal Mic", 0x6 }, |
| 11092 | { "Line", 0x2 }, |
| 11093 | }, |
| 11094 | }; |
| 11095 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11096 | #ifdef CONFIG_SND_DEBUG |
| 11097 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11098 | /* Volume widgets */ |
| 11099 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11100 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11101 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11102 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11103 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11104 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11105 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11106 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11107 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11108 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11109 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11110 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11111 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11112 | /* The below appears problematic on some hardwares */ |
| 11113 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11114 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11115 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11116 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11117 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11118 | |
| 11119 | /* Modes for retasking pin widgets */ |
| 11120 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11121 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11122 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11123 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11124 | |
| 11125 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11126 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11127 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11128 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11129 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11130 | |
| 11131 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11132 | * The ALC268 does not have an SPDIF input. |
| 11133 | */ |
| 11134 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11135 | |
| 11136 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11137 | * this output to turn on an external amplifier. |
| 11138 | */ |
| 11139 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11140 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11141 | |
| 11142 | { } /* end */ |
| 11143 | }; |
| 11144 | #endif |
| 11145 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11146 | /* create input playback/capture controls for the given pin */ |
| 11147 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11148 | const char *ctlname, int idx) |
| 11149 | { |
| 11150 | char name[32]; |
| 11151 | int err; |
| 11152 | |
| 11153 | sprintf(name, "%s Playback Volume", ctlname); |
| 11154 | if (nid == 0x14) { |
| 11155 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11156 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11157 | HDA_OUTPUT)); |
| 11158 | if (err < 0) |
| 11159 | return err; |
| 11160 | } else if (nid == 0x15) { |
| 11161 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11162 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11163 | HDA_OUTPUT)); |
| 11164 | if (err < 0) |
| 11165 | return err; |
| 11166 | } else |
| 11167 | return -1; |
| 11168 | sprintf(name, "%s Playback Switch", ctlname); |
| 11169 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11170 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11171 | if (err < 0) |
| 11172 | return err; |
| 11173 | return 0; |
| 11174 | } |
| 11175 | |
| 11176 | /* add playback controls from the parsed DAC table */ |
| 11177 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11178 | const struct auto_pin_cfg *cfg) |
| 11179 | { |
| 11180 | hda_nid_t nid; |
| 11181 | int err; |
| 11182 | |
| 11183 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11184 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11185 | spec->multiout.dac_nids[0] = 2; |
| 11186 | spec->multiout.dac_nids[1] = 3; |
| 11187 | |
| 11188 | nid = cfg->line_out_pins[0]; |
| 11189 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11190 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11191 | |
| 11192 | nid = cfg->speaker_pins[0]; |
| 11193 | if (nid == 0x1d) { |
| 11194 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11195 | "Speaker Playback Volume", |
| 11196 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11197 | if (err < 0) |
| 11198 | return err; |
| 11199 | } |
| 11200 | nid = cfg->hp_pins[0]; |
| 11201 | if (nid) |
| 11202 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11203 | |
| 11204 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11205 | if (nid == 0x16) { |
| 11206 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11207 | "Mono Playback Switch", |
| 11208 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11209 | if (err < 0) |
| 11210 | return err; |
| 11211 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11212 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11213 | } |
| 11214 | |
| 11215 | /* create playback/capture controls for input pins */ |
| 11216 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11217 | const struct auto_pin_cfg *cfg) |
| 11218 | { |
| 11219 | struct hda_input_mux *imux = &spec->private_imux; |
| 11220 | int i, idx1; |
| 11221 | |
| 11222 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11223 | switch(cfg->input_pins[i]) { |
| 11224 | case 0x18: |
| 11225 | idx1 = 0; /* Mic 1 */ |
| 11226 | break; |
| 11227 | case 0x19: |
| 11228 | idx1 = 1; /* Mic 2 */ |
| 11229 | break; |
| 11230 | case 0x1a: |
| 11231 | idx1 = 2; /* Line In */ |
| 11232 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11233 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11234 | idx1 = 3; /* CD */ |
| 11235 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11236 | case 0x12: |
| 11237 | case 0x13: |
| 11238 | idx1 = 6; /* digital mics */ |
| 11239 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11240 | default: |
| 11241 | continue; |
| 11242 | } |
| 11243 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11244 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11245 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11246 | } |
| 11247 | return 0; |
| 11248 | } |
| 11249 | |
| 11250 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11251 | { |
| 11252 | struct alc_spec *spec = codec->spec; |
| 11253 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11254 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11255 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11256 | unsigned int dac_vol1, dac_vol2; |
| 11257 | |
| 11258 | if (speaker_nid) { |
| 11259 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11260 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11261 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11262 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11263 | AMP_IN_UNMUTE(1)); |
| 11264 | snd_hda_codec_write(codec, 0x10, 0, |
| 11265 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11266 | AMP_IN_UNMUTE(1)); |
| 11267 | } else { |
| 11268 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11269 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11270 | snd_hda_codec_write(codec, 0x10, 0, |
| 11271 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11272 | } |
| 11273 | |
| 11274 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11275 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11276 | dac_vol2 = AMP_OUT_ZERO; |
| 11277 | else if (line_nid == 0x15) |
| 11278 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11279 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11280 | dac_vol2 = AMP_OUT_ZERO; |
| 11281 | else if (hp_nid == 0x15) |
| 11282 | dac_vol1 = AMP_OUT_ZERO; |
| 11283 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11284 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11285 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11286 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11287 | |
| 11288 | snd_hda_codec_write(codec, 0x02, 0, |
| 11289 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11290 | snd_hda_codec_write(codec, 0x03, 0, |
| 11291 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11292 | } |
| 11293 | |
| 11294 | /* pcm configuration: identiacal with ALC880 */ |
| 11295 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11296 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11297 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11298 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11299 | |
| 11300 | /* |
| 11301 | * BIOS auto configuration |
| 11302 | */ |
| 11303 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11304 | { |
| 11305 | struct alc_spec *spec = codec->spec; |
| 11306 | int err; |
| 11307 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11308 | |
| 11309 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11310 | alc268_ignore); |
| 11311 | if (err < 0) |
| 11312 | return err; |
| 11313 | if (!spec->autocfg.line_outs) |
| 11314 | return 0; /* can't find valid BIOS pin config */ |
| 11315 | |
| 11316 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11317 | if (err < 0) |
| 11318 | return err; |
| 11319 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11320 | if (err < 0) |
| 11321 | return err; |
| 11322 | |
| 11323 | spec->multiout.max_channels = 2; |
| 11324 | |
| 11325 | /* digital only support output */ |
| 11326 | if (spec->autocfg.dig_out_pin) |
| 11327 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 11328 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11329 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11330 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11331 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11332 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11333 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11334 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11335 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11336 | spec->num_mux_defs = 1; |
| 11337 | spec->input_mux = &spec->private_imux; |
| 11338 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11339 | err = alc_auto_add_mic_boost(codec); |
| 11340 | if (err < 0) |
| 11341 | return err; |
| 11342 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 11343 | store_pin_configs(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11344 | return 1; |
| 11345 | } |
| 11346 | |
| 11347 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 11348 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 11349 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 11350 | |
| 11351 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11352 | static void alc268_auto_init(struct hda_codec *codec) |
| 11353 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11354 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11355 | alc268_auto_init_multi_out(codec); |
| 11356 | alc268_auto_init_hp_out(codec); |
| 11357 | alc268_auto_init_mono_speaker_out(codec); |
| 11358 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11359 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11360 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11361 | } |
| 11362 | |
| 11363 | /* |
| 11364 | * configuration and preset |
| 11365 | */ |
| 11366 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11367 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11368 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 11369 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11370 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11371 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11372 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11373 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11374 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11375 | #ifdef CONFIG_SND_DEBUG |
| 11376 | [ALC268_TEST] = "test", |
| 11377 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11378 | [ALC268_AUTO] = "auto", |
| 11379 | }; |
| 11380 | |
| 11381 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 11382 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11383 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 11384 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11385 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 11386 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11387 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 11388 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11389 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11390 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11391 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11392 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 11393 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Travis Place | 2346d0c | 2008-09-01 08:24:00 +0200 | [diff] [blame] | 11394 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 11395 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 11396 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11397 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11398 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11399 | {} |
| 11400 | }; |
| 11401 | |
| 11402 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11403 | [ALC267_QUANTA_IL1] = { |
| 11404 | .mixers = { alc267_quanta_il1_mixer }, |
| 11405 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11406 | alc267_quanta_il1_verbs }, |
| 11407 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11408 | .dac_nids = alc268_dac_nids, |
| 11409 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11410 | .adc_nids = alc268_adc_nids_alt, |
| 11411 | .hp_nid = 0x03, |
| 11412 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11413 | .channel_mode = alc268_modes, |
| 11414 | .input_mux = &alc268_capture_source, |
| 11415 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 11416 | .init_hook = alc267_quanta_il1_automute, |
| 11417 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11418 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11419 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11420 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11421 | .init_verbs = { alc268_base_init_verbs }, |
| 11422 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11423 | .dac_nids = alc268_dac_nids, |
| 11424 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11425 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11426 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11427 | .hp_nid = 0x03, |
| 11428 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11429 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11430 | .channel_mode = alc268_modes, |
| 11431 | .input_mux = &alc268_capture_source, |
| 11432 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11433 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11434 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11435 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11436 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11437 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11438 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11439 | .dac_nids = alc268_dac_nids, |
| 11440 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11441 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11442 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11443 | .hp_nid = 0x03, |
| 11444 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11445 | .channel_mode = alc268_modes, |
| 11446 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11447 | .unsol_event = alc268_toshiba_unsol_event, |
| 11448 | .init_hook = alc268_toshiba_automute, |
| 11449 | }, |
| 11450 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11451 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 11452 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11453 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11454 | alc268_acer_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, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11460 | .hp_nid = 0x02, |
| 11461 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11462 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11463 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11464 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11465 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11466 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11467 | [ALC268_ACER_DMIC] = { |
| 11468 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 11469 | alc268_beep_mixer }, |
| 11470 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11471 | alc268_acer_verbs }, |
| 11472 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11473 | .dac_nids = alc268_dac_nids, |
| 11474 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11475 | .adc_nids = alc268_adc_nids_alt, |
| 11476 | .capsrc_nids = alc268_capsrc_nids, |
| 11477 | .hp_nid = 0x02, |
| 11478 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11479 | .channel_mode = alc268_modes, |
| 11480 | .input_mux = &alc268_acer_dmic_capture_source, |
| 11481 | .unsol_event = alc268_acer_unsol_event, |
| 11482 | .init_hook = alc268_acer_init_hook, |
| 11483 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11484 | [ALC268_ACER_ASPIRE_ONE] = { |
| 11485 | .mixers = { alc268_acer_aspire_one_mixer, |
| 11486 | alc268_capture_alt_mixer }, |
| 11487 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11488 | alc268_acer_aspire_one_verbs }, |
| 11489 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11490 | .dac_nids = alc268_dac_nids, |
| 11491 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11492 | .adc_nids = alc268_adc_nids_alt, |
| 11493 | .capsrc_nids = alc268_capsrc_nids, |
| 11494 | .hp_nid = 0x03, |
| 11495 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11496 | .channel_mode = alc268_modes, |
| 11497 | .input_mux = &alc268_acer_lc_capture_source, |
| 11498 | .unsol_event = alc268_acer_lc_unsol_event, |
| 11499 | .init_hook = alc268_acer_lc_init_hook, |
| 11500 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11501 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11502 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11503 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11504 | alc268_dell_verbs }, |
| 11505 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11506 | .dac_nids = alc268_dac_nids, |
| 11507 | .hp_nid = 0x02, |
| 11508 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11509 | .channel_mode = alc268_modes, |
| 11510 | .unsol_event = alc268_dell_unsol_event, |
| 11511 | .init_hook = alc268_dell_init_hook, |
| 11512 | .input_mux = &alc268_capture_source, |
| 11513 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11514 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11515 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 11516 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11517 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11518 | alc268_toshiba_verbs }, |
| 11519 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11520 | .dac_nids = alc268_dac_nids, |
| 11521 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11522 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11523 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 11524 | .hp_nid = 0x03, |
| 11525 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11526 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11527 | .channel_mode = alc268_modes, |
| 11528 | .input_mux = &alc268_capture_source, |
| 11529 | .unsol_event = alc268_toshiba_unsol_event, |
| 11530 | .init_hook = alc268_toshiba_automute |
| 11531 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11532 | #ifdef CONFIG_SND_DEBUG |
| 11533 | [ALC268_TEST] = { |
| 11534 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 11535 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 11536 | alc268_volume_init_verbs }, |
| 11537 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 11538 | .dac_nids = alc268_dac_nids, |
| 11539 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 11540 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11541 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11542 | .hp_nid = 0x03, |
| 11543 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 11544 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 11545 | .channel_mode = alc268_modes, |
| 11546 | .input_mux = &alc268_capture_source, |
| 11547 | }, |
| 11548 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11549 | }; |
| 11550 | |
| 11551 | static int patch_alc268(struct hda_codec *codec) |
| 11552 | { |
| 11553 | struct alc_spec *spec; |
| 11554 | int board_config; |
| 11555 | int err; |
| 11556 | |
| 11557 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 11558 | if (spec == NULL) |
| 11559 | return -ENOMEM; |
| 11560 | |
| 11561 | codec->spec = spec; |
| 11562 | |
| 11563 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 11564 | alc268_models, |
| 11565 | alc268_cfg_tbl); |
| 11566 | |
| 11567 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 11568 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 11569 | "trying auto-probe from BIOS...\n"); |
| 11570 | board_config = ALC268_AUTO; |
| 11571 | } |
| 11572 | |
| 11573 | if (board_config == ALC268_AUTO) { |
| 11574 | /* automatic parse from the BIOS config */ |
| 11575 | err = alc268_parse_auto_config(codec); |
| 11576 | if (err < 0) { |
| 11577 | alc_free(codec); |
| 11578 | return err; |
| 11579 | } else if (!err) { |
| 11580 | printk(KERN_INFO |
| 11581 | "hda_codec: Cannot set up configuration " |
| 11582 | "from BIOS. Using base mode...\n"); |
| 11583 | board_config = ALC268_3ST; |
| 11584 | } |
| 11585 | } |
| 11586 | |
| 11587 | if (board_config != ALC268_AUTO) |
| 11588 | setup_preset(spec, &alc268_presets[board_config]); |
| 11589 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11590 | if (codec->vendor_id == 0x10ec0267) { |
| 11591 | spec->stream_name_analog = "ALC267 Analog"; |
| 11592 | spec->stream_name_digital = "ALC267 Digital"; |
| 11593 | } else { |
| 11594 | spec->stream_name_analog = "ALC268 Analog"; |
| 11595 | spec->stream_name_digital = "ALC268 Digital"; |
| 11596 | } |
| 11597 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11598 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 11599 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11600 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11601 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11602 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 11603 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11604 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 11605 | /* override the amp caps for beep generator */ |
| 11606 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 11607 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 11608 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 11609 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 11610 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 11611 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11612 | if (!spec->adc_nids && spec->input_mux) { |
| 11613 | /* check whether NID 0x07 is valid */ |
| 11614 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11615 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11616 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11617 | /* get type */ |
| 11618 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 11619 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11620 | spec->adc_nids = alc268_adc_nids_alt; |
| 11621 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11622 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11623 | } else { |
| 11624 | spec->adc_nids = alc268_adc_nids; |
| 11625 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11626 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11627 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11628 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 11629 | /* set default input source */ |
| 11630 | for (i = 0; i < spec->num_adc_nids; i++) |
| 11631 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 11632 | 0, AC_VERB_SET_CONNECT_SEL, |
| 11633 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11634 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11635 | |
| 11636 | spec->vmaster_nid = 0x02; |
| 11637 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11638 | codec->patch_ops = alc_patch_ops; |
| 11639 | if (board_config == ALC268_AUTO) |
| 11640 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11641 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11642 | return 0; |
| 11643 | } |
| 11644 | |
| 11645 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11646 | * ALC269 channel source setting (2 channel) |
| 11647 | */ |
| 11648 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 11649 | |
| 11650 | #define alc269_dac_nids alc260_dac_nids |
| 11651 | |
| 11652 | static hda_nid_t alc269_adc_nids[1] = { |
| 11653 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11654 | 0x08, |
| 11655 | }; |
| 11656 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 11657 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 11658 | 0x23, |
| 11659 | }; |
| 11660 | |
| 11661 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 11662 | * not a mux! |
| 11663 | */ |
| 11664 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11665 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 11666 | .num_items = 2, |
| 11667 | .items = { |
| 11668 | { "i-Mic", 0x5 }, |
| 11669 | { "e-Mic", 0x0 }, |
| 11670 | }, |
| 11671 | }; |
| 11672 | |
| 11673 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 11674 | .num_items = 2, |
| 11675 | .items = { |
| 11676 | { "i-Mic", 0x1 }, |
| 11677 | { "e-Mic", 0x0 }, |
| 11678 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11679 | }; |
| 11680 | |
| 11681 | #define alc269_modes alc260_modes |
| 11682 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 11683 | |
| 11684 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 11685 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11686 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11687 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11688 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11689 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11690 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11691 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11692 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11693 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11694 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11695 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11696 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11698 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 11699 | { } /* end */ |
| 11700 | }; |
| 11701 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11702 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 11703 | /* output mixer control */ |
| 11704 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11705 | { |
| 11706 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11707 | .name = "Master Playback Switch", |
| 11708 | .info = snd_hda_mixer_amp_switch_info, |
| 11709 | .get = snd_hda_mixer_amp_switch_get, |
| 11710 | .put = alc268_acer_master_sw_put, |
| 11711 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11712 | }, |
| 11713 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11715 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11716 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11717 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11718 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11719 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11720 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11721 | { } |
| 11722 | }; |
| 11723 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 11724 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 11725 | /* output mixer control */ |
| 11726 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11727 | { |
| 11728 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11729 | .name = "Master Playback Switch", |
| 11730 | .info = snd_hda_mixer_amp_switch_info, |
| 11731 | .get = snd_hda_mixer_amp_switch_get, |
| 11732 | .put = alc268_acer_master_sw_put, |
| 11733 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11734 | }, |
| 11735 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11737 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11738 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11739 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11740 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11741 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 11742 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 11743 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
| 11744 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11745 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11746 | { } |
| 11747 | }; |
| 11748 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11749 | /* bind volumes of both NID 0x0c and 0x0d */ |
| 11750 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
| 11751 | .ops = &snd_hda_bind_vol, |
| 11752 | .values = { |
| 11753 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11754 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11755 | 0 |
| 11756 | }, |
| 11757 | }; |
| 11758 | |
| 11759 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
| 11760 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11761 | HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol), |
| 11762 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11763 | { } /* end */ |
| 11764 | }; |
| 11765 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11766 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11767 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 11768 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11769 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 11770 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11771 | { } /* end */ |
| 11772 | }; |
| 11773 | |
| 11774 | /* FSC amilo */ |
| 11775 | static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { |
| 11776 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11777 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11778 | HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 11779 | { } /* end */ |
| 11780 | }; |
| 11781 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 11782 | /* beep control */ |
| 11783 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
| 11784 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 11785 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
| 11786 | { } /* end */ |
| 11787 | }; |
| 11788 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11789 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 11790 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11791 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11792 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11793 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11794 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11795 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11796 | { } |
| 11797 | }; |
| 11798 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 11799 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 11800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11801 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11802 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11804 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11806 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11807 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11808 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11809 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11810 | { } |
| 11811 | }; |
| 11812 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11813 | /* toggle speaker-output according to the hp-jack state */ |
| 11814 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 11815 | { |
| 11816 | unsigned int present; |
| 11817 | unsigned char bits; |
| 11818 | |
| 11819 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11820 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11821 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11822 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11823 | AMP_IN_MUTE(0), bits); |
| 11824 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11825 | AMP_IN_MUTE(0), bits); |
| 11826 | |
| 11827 | snd_hda_codec_write(codec, 0x20, 0, |
| 11828 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11829 | snd_hda_codec_write(codec, 0x20, 0, |
| 11830 | AC_VERB_SET_PROC_COEF, 0x680); |
| 11831 | |
| 11832 | snd_hda_codec_write(codec, 0x20, 0, |
| 11833 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11834 | snd_hda_codec_write(codec, 0x20, 0, |
| 11835 | AC_VERB_SET_PROC_COEF, 0x480); |
| 11836 | } |
| 11837 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 11838 | /* toggle speaker-output according to the hp-jacks state */ |
| 11839 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 11840 | { |
| 11841 | unsigned int present; |
| 11842 | unsigned char bits; |
| 11843 | |
| 11844 | /* Check laptop headphone socket */ |
| 11845 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11846 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11847 | |
| 11848 | /* Check port replicator headphone socket */ |
| 11849 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 11850 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11851 | |
| 11852 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11853 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11854 | AMP_IN_MUTE(0), bits); |
| 11855 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11856 | AMP_IN_MUTE(0), bits); |
| 11857 | |
| 11858 | snd_hda_codec_write(codec, 0x20, 0, |
| 11859 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11860 | snd_hda_codec_write(codec, 0x20, 0, |
| 11861 | AC_VERB_SET_PROC_COEF, 0x680); |
| 11862 | |
| 11863 | snd_hda_codec_write(codec, 0x20, 0, |
| 11864 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 11865 | snd_hda_codec_write(codec, 0x20, 0, |
| 11866 | AC_VERB_SET_PROC_COEF, 0x480); |
| 11867 | } |
| 11868 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11869 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 11870 | { |
| 11871 | unsigned int present; |
| 11872 | |
| 11873 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11874 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11875 | snd_hda_codec_write(codec, 0x23, 0, |
| 11876 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 11877 | } |
| 11878 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 11879 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 11880 | { |
| 11881 | unsigned int present_laptop; |
| 11882 | unsigned int present_dock; |
| 11883 | |
| 11884 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 11885 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11886 | |
| 11887 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 11888 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11889 | |
| 11890 | /* Laptop mic port overrides dock mic port, design decision */ |
| 11891 | if (present_dock) |
| 11892 | snd_hda_codec_write(codec, 0x23, 0, |
| 11893 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 11894 | if (present_laptop) |
| 11895 | snd_hda_codec_write(codec, 0x23, 0, |
| 11896 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 11897 | if (!present_dock && !present_laptop) |
| 11898 | snd_hda_codec_write(codec, 0x23, 0, |
| 11899 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 11900 | } |
| 11901 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11902 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 11903 | unsigned int res) |
| 11904 | { |
| 11905 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11906 | alc269_quanta_fl1_speaker_automute(codec); |
| 11907 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11908 | alc269_quanta_fl1_mic_automute(codec); |
| 11909 | } |
| 11910 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 11911 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 11912 | unsigned int res) |
| 11913 | { |
| 11914 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11915 | alc269_lifebook_speaker_automute(codec); |
| 11916 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11917 | alc269_lifebook_mic_autoswitch(codec); |
| 11918 | } |
| 11919 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11920 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 11921 | { |
| 11922 | alc269_quanta_fl1_speaker_automute(codec); |
| 11923 | alc269_quanta_fl1_mic_automute(codec); |
| 11924 | } |
| 11925 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 11926 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 11927 | { |
| 11928 | alc269_lifebook_speaker_automute(codec); |
| 11929 | alc269_lifebook_mic_autoswitch(codec); |
| 11930 | } |
| 11931 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 11932 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 11933 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11934 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 11935 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11936 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 11937 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11938 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11939 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11940 | {} |
| 11941 | }; |
| 11942 | |
| 11943 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 11944 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11945 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11946 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 11947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 11948 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11949 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11950 | {} |
| 11951 | }; |
| 11952 | |
| 11953 | /* toggle speaker-output according to the hp-jack state */ |
| 11954 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 11955 | { |
| 11956 | unsigned int present; |
| 11957 | unsigned char bits; |
| 11958 | |
| 11959 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11960 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11961 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11962 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 11963 | AMP_IN_MUTE(0), bits); |
| 11964 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 11965 | AMP_IN_MUTE(0), bits); |
| 11966 | } |
| 11967 | |
| 11968 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 11969 | { |
| 11970 | unsigned int present; |
| 11971 | |
| 11972 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11973 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11974 | snd_hda_codec_write(codec, 0x23, 0, |
| 11975 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 11976 | } |
| 11977 | |
| 11978 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 11979 | { |
| 11980 | unsigned int present; |
| 11981 | |
| 11982 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11983 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11984 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11985 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 11986 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11987 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 11988 | } |
| 11989 | |
| 11990 | /* unsolicited event for HP jack sensing */ |
| 11991 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 11992 | unsigned int res) |
| 11993 | { |
| 11994 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11995 | alc269_speaker_automute(codec); |
| 11996 | |
| 11997 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11998 | alc269_eeepc_dmic_automute(codec); |
| 11999 | } |
| 12000 | |
| 12001 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12002 | { |
| 12003 | alc269_speaker_automute(codec); |
| 12004 | alc269_eeepc_dmic_automute(codec); |
| 12005 | } |
| 12006 | |
| 12007 | /* unsolicited event for HP jack sensing */ |
| 12008 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12009 | unsigned int res) |
| 12010 | { |
| 12011 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12012 | alc269_speaker_automute(codec); |
| 12013 | |
| 12014 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12015 | alc269_eeepc_amic_automute(codec); |
| 12016 | } |
| 12017 | |
| 12018 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12019 | { |
| 12020 | alc269_speaker_automute(codec); |
| 12021 | alc269_eeepc_amic_automute(codec); |
| 12022 | } |
| 12023 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12024 | /* |
| 12025 | * generic initialization of ADC, input mixers and output mixers |
| 12026 | */ |
| 12027 | static struct hda_verb alc269_init_verbs[] = { |
| 12028 | /* |
| 12029 | * Unmute ADC0 and set the default input to mic-in |
| 12030 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12031 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12032 | |
| 12033 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12034 | * analog-loopback mixer widget |
| 12035 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12036 | * front panel mic (mic 2) |
| 12037 | */ |
| 12038 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12044 | |
| 12045 | /* |
| 12046 | * Set up output mixers (0x0c - 0x0e) |
| 12047 | */ |
| 12048 | /* set vol=0 to output mixers */ |
| 12049 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12050 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12051 | |
| 12052 | /* set up input amps for analog loopback */ |
| 12053 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12056 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12058 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12059 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12060 | |
| 12061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12063 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12064 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12065 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12067 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12068 | |
| 12069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12070 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12071 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12072 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12073 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12074 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12076 | |
| 12077 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12078 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12079 | |
| 12080 | /* FIXME: use matrix-type input source selection */ |
| 12081 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12082 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12085 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12087 | |
| 12088 | /* set EAPD */ |
| 12089 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12090 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12091 | { } |
| 12092 | }; |
| 12093 | |
| 12094 | /* add playback controls from the parsed DAC table */ |
| 12095 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12096 | const struct auto_pin_cfg *cfg) |
| 12097 | { |
| 12098 | hda_nid_t nid; |
| 12099 | int err; |
| 12100 | |
| 12101 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12102 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12103 | spec->multiout.dac_nids[0] = 2; |
| 12104 | |
| 12105 | nid = cfg->line_out_pins[0]; |
| 12106 | if (nid) { |
| 12107 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12108 | "Front Playback Volume", |
| 12109 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12110 | if (err < 0) |
| 12111 | return err; |
| 12112 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12113 | "Front Playback Switch", |
| 12114 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12115 | if (err < 0) |
| 12116 | return err; |
| 12117 | } |
| 12118 | |
| 12119 | nid = cfg->speaker_pins[0]; |
| 12120 | if (nid) { |
| 12121 | if (!cfg->line_out_pins[0]) { |
| 12122 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12123 | "Speaker Playback Volume", |
| 12124 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12125 | HDA_OUTPUT)); |
| 12126 | if (err < 0) |
| 12127 | return err; |
| 12128 | } |
| 12129 | if (nid == 0x16) { |
| 12130 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12131 | "Speaker Playback Switch", |
| 12132 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12133 | HDA_OUTPUT)); |
| 12134 | if (err < 0) |
| 12135 | return err; |
| 12136 | } else { |
| 12137 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12138 | "Speaker Playback Switch", |
| 12139 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12140 | HDA_OUTPUT)); |
| 12141 | if (err < 0) |
| 12142 | return err; |
| 12143 | } |
| 12144 | } |
| 12145 | nid = cfg->hp_pins[0]; |
| 12146 | if (nid) { |
| 12147 | /* spec->multiout.hp_nid = 2; */ |
| 12148 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12149 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12150 | "Headphone Playback Volume", |
| 12151 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12152 | HDA_OUTPUT)); |
| 12153 | if (err < 0) |
| 12154 | return err; |
| 12155 | } |
| 12156 | if (nid == 0x16) { |
| 12157 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12158 | "Headphone Playback Switch", |
| 12159 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12160 | HDA_OUTPUT)); |
| 12161 | if (err < 0) |
| 12162 | return err; |
| 12163 | } else { |
| 12164 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12165 | "Headphone Playback Switch", |
| 12166 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12167 | HDA_OUTPUT)); |
| 12168 | if (err < 0) |
| 12169 | return err; |
| 12170 | } |
| 12171 | } |
| 12172 | return 0; |
| 12173 | } |
| 12174 | |
Takashi Iwai | ee956e0 | 2008-10-31 17:16:31 +0100 | [diff] [blame] | 12175 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12176 | const struct auto_pin_cfg *cfg) |
| 12177 | { |
| 12178 | int err; |
| 12179 | |
| 12180 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 12181 | if (err < 0) |
| 12182 | return err; |
| 12183 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 12184 | * because it's under 0x18 |
| 12185 | */ |
| 12186 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 12187 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 12188 | struct hda_input_mux *imux = &spec->private_imux; |
| 12189 | imux->items[imux->num_items].label = "Int Mic"; |
| 12190 | imux->items[imux->num_items].index = 0x05; |
| 12191 | imux->num_items++; |
| 12192 | } |
| 12193 | return 0; |
| 12194 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12195 | |
| 12196 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12197 | #define alc269_loopbacks alc880_loopbacks |
| 12198 | #endif |
| 12199 | |
| 12200 | /* pcm configuration: identiacal with ALC880 */ |
| 12201 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12202 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12203 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12204 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12205 | |
| 12206 | /* |
| 12207 | * BIOS auto configuration |
| 12208 | */ |
| 12209 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12210 | { |
| 12211 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12212 | int i, err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12213 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12214 | |
| 12215 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12216 | alc269_ignore); |
| 12217 | if (err < 0) |
| 12218 | return err; |
| 12219 | |
| 12220 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12221 | if (err < 0) |
| 12222 | return err; |
| 12223 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12224 | if (err < 0) |
| 12225 | return err; |
| 12226 | |
| 12227 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12228 | |
| 12229 | if (spec->autocfg.dig_out_pin) |
| 12230 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12231 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12232 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12233 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12234 | |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12235 | /* create a beep mixer control if the pin 0x1d isn't assigned */ |
| 12236 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) |
| 12237 | if (spec->autocfg.input_pins[i] == 0x1d) |
| 12238 | break; |
| 12239 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12240 | add_mixer(spec, alc269_beep_mixer); |
Takashi Iwai | 2005af2 | 2008-08-20 18:38:26 +0200 | [diff] [blame] | 12241 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12242 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12243 | spec->num_mux_defs = 1; |
| 12244 | spec->input_mux = &spec->private_imux; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12245 | /* set default input source */ |
| 12246 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12247 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12248 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12249 | |
| 12250 | err = alc_auto_add_mic_boost(codec); |
| 12251 | if (err < 0) |
| 12252 | return err; |
| 12253 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12254 | if (!spec->cap_mixer) |
| 12255 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12256 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 12257 | store_pin_configs(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12258 | return 1; |
| 12259 | } |
| 12260 | |
| 12261 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12262 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12263 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12264 | |
| 12265 | |
| 12266 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12267 | static void alc269_auto_init(struct hda_codec *codec) |
| 12268 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12269 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12270 | alc269_auto_init_multi_out(codec); |
| 12271 | alc269_auto_init_hp_out(codec); |
| 12272 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12273 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12274 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12275 | } |
| 12276 | |
| 12277 | /* |
| 12278 | * configuration and preset |
| 12279 | */ |
| 12280 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12281 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12282 | [ALC269_QUANTA_FL1] = "quanta", |
| 12283 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12284 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12285 | [ALC269_FUJITSU] = "fujitsu", |
| 12286 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12287 | }; |
| 12288 | |
| 12289 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12290 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12291 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12292 | ALC269_ASUS_EEEPC_P703), |
| 12293 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12294 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12295 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12296 | ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12297 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12298 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12299 | {} |
| 12300 | }; |
| 12301 | |
| 12302 | static struct alc_config_preset alc269_presets[] = { |
| 12303 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12304 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12305 | .init_verbs = { alc269_init_verbs }, |
| 12306 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12307 | .dac_nids = alc269_dac_nids, |
| 12308 | .hp_nid = 0x03, |
| 12309 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12310 | .channel_mode = alc269_modes, |
| 12311 | .input_mux = &alc269_capture_source, |
| 12312 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12313 | [ALC269_QUANTA_FL1] = { |
| 12314 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12315 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12316 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12317 | .dac_nids = alc269_dac_nids, |
| 12318 | .hp_nid = 0x03, |
| 12319 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12320 | .channel_mode = alc269_modes, |
| 12321 | .input_mux = &alc269_capture_source, |
| 12322 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12323 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12324 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12325 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12326 | .mixers = { alc269_eeepc_mixer }, |
| 12327 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12328 | .init_verbs = { alc269_init_verbs, |
| 12329 | alc269_eeepc_amic_init_verbs }, |
| 12330 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12331 | .dac_nids = alc269_dac_nids, |
| 12332 | .hp_nid = 0x03, |
| 12333 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12334 | .channel_mode = alc269_modes, |
| 12335 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 12336 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 12337 | .init_hook = alc269_eeepc_amic_inithook, |
| 12338 | }, |
| 12339 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12340 | .mixers = { alc269_eeepc_mixer }, |
| 12341 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12342 | .init_verbs = { alc269_init_verbs, |
| 12343 | alc269_eeepc_dmic_init_verbs }, |
| 12344 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12345 | .dac_nids = alc269_dac_nids, |
| 12346 | .hp_nid = 0x03, |
| 12347 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12348 | .channel_mode = alc269_modes, |
| 12349 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12350 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12351 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12352 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12353 | [ALC269_FUJITSU] = { |
| 12354 | .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer }, |
| 12355 | .cap_mixer = alc269_epc_capture_mixer, |
| 12356 | .init_verbs = { alc269_init_verbs, |
| 12357 | alc269_eeepc_dmic_init_verbs }, |
| 12358 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12359 | .dac_nids = alc269_dac_nids, |
| 12360 | .hp_nid = 0x03, |
| 12361 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12362 | .channel_mode = alc269_modes, |
| 12363 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 12364 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 12365 | .init_hook = alc269_eeepc_dmic_inithook, |
| 12366 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12367 | [ALC269_LIFEBOOK] = { |
| 12368 | .mixers = { alc269_lifebook_mixer }, |
| 12369 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 12370 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12371 | .dac_nids = alc269_dac_nids, |
| 12372 | .hp_nid = 0x03, |
| 12373 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12374 | .channel_mode = alc269_modes, |
| 12375 | .input_mux = &alc269_capture_source, |
| 12376 | .unsol_event = alc269_lifebook_unsol_event, |
| 12377 | .init_hook = alc269_lifebook_init_hook, |
| 12378 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12379 | }; |
| 12380 | |
| 12381 | static int patch_alc269(struct hda_codec *codec) |
| 12382 | { |
| 12383 | struct alc_spec *spec; |
| 12384 | int board_config; |
| 12385 | int err; |
| 12386 | |
| 12387 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12388 | if (spec == NULL) |
| 12389 | return -ENOMEM; |
| 12390 | |
| 12391 | codec->spec = spec; |
| 12392 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12393 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 12394 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12395 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 12396 | alc269_models, |
| 12397 | alc269_cfg_tbl); |
| 12398 | |
| 12399 | if (board_config < 0) { |
| 12400 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 12401 | "trying auto-probe from BIOS...\n"); |
| 12402 | board_config = ALC269_AUTO; |
| 12403 | } |
| 12404 | |
| 12405 | if (board_config == ALC269_AUTO) { |
| 12406 | /* automatic parse from the BIOS config */ |
| 12407 | err = alc269_parse_auto_config(codec); |
| 12408 | if (err < 0) { |
| 12409 | alc_free(codec); |
| 12410 | return err; |
| 12411 | } else if (!err) { |
| 12412 | printk(KERN_INFO |
| 12413 | "hda_codec: Cannot set up configuration " |
| 12414 | "from BIOS. Using base mode...\n"); |
| 12415 | board_config = ALC269_BASIC; |
| 12416 | } |
| 12417 | } |
| 12418 | |
| 12419 | if (board_config != ALC269_AUTO) |
| 12420 | setup_preset(spec, &alc269_presets[board_config]); |
| 12421 | |
| 12422 | spec->stream_name_analog = "ALC269 Analog"; |
| 12423 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 12424 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 12425 | |
| 12426 | spec->stream_name_digital = "ALC269 Digital"; |
| 12427 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 12428 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 12429 | |
| 12430 | spec->adc_nids = alc269_adc_nids; |
| 12431 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12432 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12433 | if (!spec->cap_mixer) |
| 12434 | set_capture_mixer(spec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12435 | |
| 12436 | codec->patch_ops = alc_patch_ops; |
| 12437 | if (board_config == ALC269_AUTO) |
| 12438 | spec->init_hook = alc269_auto_init; |
| 12439 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12440 | if (!spec->loopback.amplist) |
| 12441 | spec->loopback.amplist = alc269_loopbacks; |
| 12442 | #endif |
| 12443 | |
| 12444 | return 0; |
| 12445 | } |
| 12446 | |
| 12447 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12448 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 12449 | */ |
| 12450 | |
| 12451 | /* |
| 12452 | * set the path ways for 2 channel output |
| 12453 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 12454 | */ |
| 12455 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 12456 | /* set pin widget 1Ah (line in) for input */ |
| 12457 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12458 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12459 | * the vref |
| 12460 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12461 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12462 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12463 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12464 | #if 0 |
| 12465 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12466 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12467 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12468 | { } /* end */ |
| 12469 | }; |
| 12470 | /* |
| 12471 | * 6ch mode |
| 12472 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 12473 | */ |
| 12474 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 12475 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12476 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12477 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12478 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12479 | |
| 12480 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12481 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12482 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12483 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12484 | #if 0 |
| 12485 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12486 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12487 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12488 | { } /* end */ |
| 12489 | }; |
| 12490 | |
| 12491 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 12492 | { 2, alc861_threestack_ch2_init }, |
| 12493 | { 6, alc861_threestack_ch6_init }, |
| 12494 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12495 | /* Set mic1 as input and unmute the mixer */ |
| 12496 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 12497 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12498 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12499 | { } /* end */ |
| 12500 | }; |
| 12501 | /* Set mic1 as output and mute mixer */ |
| 12502 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 12503 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12504 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12505 | { } /* end */ |
| 12506 | }; |
| 12507 | |
| 12508 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 12509 | { 2, alc861_uniwill_m31_ch2_init }, |
| 12510 | { 4, alc861_uniwill_m31_ch4_init }, |
| 12511 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12512 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12513 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 12514 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 12515 | /* set pin widget 1Ah (line in) for input */ |
| 12516 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12517 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 12518 | * the vref |
| 12519 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12520 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12521 | |
| 12522 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 12523 | #if 0 |
| 12524 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 12525 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 12526 | #endif |
| 12527 | { } /* end */ |
| 12528 | }; |
| 12529 | /* Set mic1 nad line-in as output and mute mixer */ |
| 12530 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 12531 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 12532 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12533 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12534 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 12535 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12536 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 12537 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12538 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12539 | |
| 12540 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 12541 | #if 0 |
| 12542 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 12543 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 12544 | #endif |
| 12545 | { } /* end */ |
| 12546 | }; |
| 12547 | |
| 12548 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 12549 | { 2, alc861_asus_ch2_init }, |
| 12550 | { 6, alc861_asus_ch6_init }, |
| 12551 | }; |
| 12552 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12553 | /* patch-ALC861 */ |
| 12554 | |
| 12555 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 12556 | /* output mixer control */ |
| 12557 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12558 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12559 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12560 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12561 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12562 | |
| 12563 | /*Input mixer control */ |
| 12564 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12565 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12566 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12567 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12568 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12569 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12570 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12571 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12572 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12573 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12574 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12575 | { } /* end */ |
| 12576 | }; |
| 12577 | |
| 12578 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 12579 | /* output mixer control */ |
| 12580 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12581 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12582 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12583 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12584 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12585 | |
| 12586 | /* Input mixer control */ |
| 12587 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12588 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12589 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12590 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12591 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12592 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12593 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12595 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12596 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12597 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12598 | { |
| 12599 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12600 | .name = "Channel Mode", |
| 12601 | .info = alc_ch_mode_info, |
| 12602 | .get = alc_ch_mode_get, |
| 12603 | .put = alc_ch_mode_put, |
| 12604 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 12605 | }, |
| 12606 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12607 | }; |
| 12608 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12609 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12610 | /* output mixer control */ |
| 12611 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12614 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12615 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12616 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12617 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12618 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 12619 | /* output mixer control */ |
| 12620 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12621 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12622 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12623 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12624 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 12625 | |
| 12626 | /* Input mixer control */ |
| 12627 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12628 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 12629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12630 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12631 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12632 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12634 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 12636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12637 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12638 | { |
| 12639 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12640 | .name = "Channel Mode", |
| 12641 | .info = alc_ch_mode_info, |
| 12642 | .get = alc_ch_mode_get, |
| 12643 | .put = alc_ch_mode_put, |
| 12644 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12645 | }, |
| 12646 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12647 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12648 | |
| 12649 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 12650 | /* output mixer control */ |
| 12651 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12652 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 12653 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 12654 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 12655 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 12656 | |
| 12657 | /* Input mixer control */ |
| 12658 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 12659 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12660 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12661 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12662 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 12663 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 12664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 12665 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 12666 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 12668 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12669 | { |
| 12670 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12671 | .name = "Channel Mode", |
| 12672 | .info = alc_ch_mode_info, |
| 12673 | .get = alc_ch_mode_get, |
| 12674 | .put = alc_ch_mode_put, |
| 12675 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 12676 | }, |
| 12677 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12678 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12679 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12680 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 12681 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12682 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 12683 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 12684 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12685 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12686 | { } |
| 12687 | }; |
| 12688 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12689 | /* |
| 12690 | * generic initialization of ADC, input mixers and output mixers |
| 12691 | */ |
| 12692 | static struct hda_verb alc861_base_init_verbs[] = { |
| 12693 | /* |
| 12694 | * Unmute ADC0 and set the default input to mic-in |
| 12695 | */ |
| 12696 | /* port-A for surround (rear panel) */ |
| 12697 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12698 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12699 | /* port-B for mic-in (rear panel) with vref */ |
| 12700 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12701 | /* port-C for line-in (rear panel) */ |
| 12702 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12703 | /* port-D for Front */ |
| 12704 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12705 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12706 | /* port-E for HP out (front panel) */ |
| 12707 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12708 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12709 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12710 | /* port-F for mic-in (front panel) with vref */ |
| 12711 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12712 | /* port-G for CLFE (rear panel) */ |
| 12713 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12714 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12715 | /* port-H for side (rear panel) */ |
| 12716 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12717 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12718 | /* CD-in */ |
| 12719 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12720 | /* route front mic to ADC1*/ |
| 12721 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12722 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12723 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12724 | /* Unmute DAC0~3 & spdif out*/ |
| 12725 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12726 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12727 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12728 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12730 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12731 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12732 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12733 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12734 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12735 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12736 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12737 | /* Unmute Stereo Mixer 15 */ |
| 12738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12739 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12740 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12742 | |
| 12743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12744 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12746 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12751 | /* hp used DAC 3 (Front) */ |
| 12752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12754 | |
| 12755 | { } |
| 12756 | }; |
| 12757 | |
| 12758 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 12759 | /* |
| 12760 | * Unmute ADC0 and set the default input to mic-in |
| 12761 | */ |
| 12762 | /* port-A for surround (rear panel) */ |
| 12763 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12764 | /* port-B for mic-in (rear panel) with vref */ |
| 12765 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12766 | /* port-C for line-in (rear panel) */ |
| 12767 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12768 | /* port-D for Front */ |
| 12769 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12770 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12771 | /* port-E for HP out (front panel) */ |
| 12772 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 12773 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12774 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12775 | /* port-F for mic-in (front panel) with vref */ |
| 12776 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12777 | /* port-G for CLFE (rear panel) */ |
| 12778 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12779 | /* port-H for side (rear panel) */ |
| 12780 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12781 | /* CD-in */ |
| 12782 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12783 | /* route front mic to ADC1*/ |
| 12784 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12785 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12786 | /* Unmute DAC0~3 & spdif out*/ |
| 12787 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12788 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12789 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12790 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12793 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12794 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12795 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12796 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12797 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12798 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12799 | /* Unmute Stereo Mixer 15 */ |
| 12800 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12802 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12803 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12804 | |
| 12805 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12806 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12807 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12808 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12809 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12810 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12811 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12812 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12813 | /* hp used DAC 3 (Front) */ |
| 12814 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12815 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12816 | { } |
| 12817 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12818 | |
| 12819 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 12820 | /* |
| 12821 | * Unmute ADC0 and set the default input to mic-in |
| 12822 | */ |
| 12823 | /* port-A for surround (rear panel) */ |
| 12824 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12825 | /* port-B for mic-in (rear panel) with vref */ |
| 12826 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12827 | /* port-C for line-in (rear panel) */ |
| 12828 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12829 | /* port-D for Front */ |
| 12830 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12831 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12832 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12833 | /* this has to be set to VREF80 */ |
| 12834 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12835 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12836 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12837 | /* port-F for mic-in (front panel) with vref */ |
| 12838 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12839 | /* port-G for CLFE (rear panel) */ |
| 12840 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12841 | /* port-H for side (rear panel) */ |
| 12842 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12843 | /* CD-in */ |
| 12844 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12845 | /* route front mic to ADC1*/ |
| 12846 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12847 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12848 | /* Unmute DAC0~3 & spdif out*/ |
| 12849 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12850 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12851 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12852 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12854 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12855 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12856 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12857 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12858 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12859 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12860 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12861 | /* Unmute Stereo Mixer 15 */ |
| 12862 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12863 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12866 | |
| 12867 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12868 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12869 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12870 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12871 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12873 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12874 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12875 | /* hp used DAC 3 (Front) */ |
| 12876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12877 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12878 | { } |
| 12879 | }; |
| 12880 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12881 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 12882 | /* |
| 12883 | * Unmute ADC0 and set the default input to mic-in |
| 12884 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12885 | /* port-A for surround (rear panel) |
| 12886 | * according to codec#0 this is the HP jack |
| 12887 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12888 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 12889 | /* route front PCM to HP */ |
| 12890 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12891 | /* port-B for mic-in (rear panel) with vref */ |
| 12892 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12893 | /* port-C for line-in (rear panel) */ |
| 12894 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12895 | /* port-D for Front */ |
| 12896 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12897 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 12898 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12899 | /* this has to be set to VREF80 */ |
| 12900 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12901 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 12902 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12903 | /* port-F for mic-in (front panel) with vref */ |
| 12904 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 12905 | /* port-G for CLFE (rear panel) */ |
| 12906 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12907 | /* port-H for side (rear panel) */ |
| 12908 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 12909 | /* CD-in */ |
| 12910 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 12911 | /* route front mic to ADC1*/ |
| 12912 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12913 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12914 | /* Unmute DAC0~3 & spdif out*/ |
| 12915 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12916 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12917 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12918 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12920 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12921 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12922 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12923 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12924 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12925 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12926 | /* Unmute Stereo Mixer 15 */ |
| 12927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12930 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12931 | |
| 12932 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12933 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12934 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12935 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12936 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12937 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12938 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12939 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12940 | /* hp used DAC 3 (Front) */ |
| 12941 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12942 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12943 | { } |
| 12944 | }; |
| 12945 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12946 | /* additional init verbs for ASUS laptops */ |
| 12947 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 12948 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 12949 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 12950 | { } |
| 12951 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12952 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12953 | /* |
| 12954 | * generic initialization of ADC, input mixers and output mixers |
| 12955 | */ |
| 12956 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 12957 | /* |
| 12958 | * Unmute ADC0 and set the default input to mic-in |
| 12959 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12960 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12961 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12962 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12963 | /* Unmute DAC0~3 & spdif out*/ |
| 12964 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12965 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12966 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12967 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12969 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12970 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 12971 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12972 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12973 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12974 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12975 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12976 | /* Unmute Stereo Mixer 15 */ |
| 12977 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12978 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12979 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12980 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 12981 | |
| 12982 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12983 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12984 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12985 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12986 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12987 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12988 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12989 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12990 | |
| 12991 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12992 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12993 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12994 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12995 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12996 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12997 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12998 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12999 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13000 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13001 | |
| 13002 | { } |
| 13003 | }; |
| 13004 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13005 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13006 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13007 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13008 | { } |
| 13009 | }; |
| 13010 | |
| 13011 | /* toggle speaker-output according to the hp-jack state */ |
| 13012 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13013 | { |
| 13014 | unsigned int present; |
| 13015 | |
| 13016 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13017 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13018 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13019 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13020 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13021 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13022 | } |
| 13023 | |
| 13024 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13025 | unsigned int res) |
| 13026 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13027 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13028 | alc861_toshiba_automute(codec); |
| 13029 | } |
| 13030 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13031 | /* pcm configuration: identiacal with ALC880 */ |
| 13032 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13033 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13034 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13035 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13036 | |
| 13037 | |
| 13038 | #define ALC861_DIGOUT_NID 0x07 |
| 13039 | |
| 13040 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13041 | { 8, NULL } |
| 13042 | }; |
| 13043 | |
| 13044 | static hda_nid_t alc861_dac_nids[4] = { |
| 13045 | /* front, surround, clfe, side */ |
| 13046 | 0x03, 0x06, 0x05, 0x04 |
| 13047 | }; |
| 13048 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13049 | static hda_nid_t alc660_dac_nids[3] = { |
| 13050 | /* front, clfe, surround */ |
| 13051 | 0x03, 0x05, 0x06 |
| 13052 | }; |
| 13053 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13054 | static hda_nid_t alc861_adc_nids[1] = { |
| 13055 | /* ADC0-2 */ |
| 13056 | 0x08, |
| 13057 | }; |
| 13058 | |
| 13059 | static struct hda_input_mux alc861_capture_source = { |
| 13060 | .num_items = 5, |
| 13061 | .items = { |
| 13062 | { "Mic", 0x0 }, |
| 13063 | { "Front Mic", 0x3 }, |
| 13064 | { "Line", 0x1 }, |
| 13065 | { "CD", 0x4 }, |
| 13066 | { "Mixer", 0x5 }, |
| 13067 | }, |
| 13068 | }; |
| 13069 | |
| 13070 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13071 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13072 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13073 | { |
| 13074 | int i; |
| 13075 | hda_nid_t nid; |
| 13076 | |
| 13077 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13078 | for (i = 0; i < cfg->line_outs; i++) { |
| 13079 | nid = cfg->line_out_pins[i]; |
| 13080 | if (nid) { |
| 13081 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13082 | continue; |
| 13083 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13084 | } |
| 13085 | } |
| 13086 | spec->multiout.num_dacs = cfg->line_outs; |
| 13087 | return 0; |
| 13088 | } |
| 13089 | |
| 13090 | /* add playback controls from the parsed DAC table */ |
| 13091 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13092 | const struct auto_pin_cfg *cfg) |
| 13093 | { |
| 13094 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13095 | static const char *chname[4] = { |
| 13096 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13097 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13098 | hda_nid_t nid; |
| 13099 | int i, idx, err; |
| 13100 | |
| 13101 | for (i = 0; i < cfg->line_outs; i++) { |
| 13102 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13103 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13104 | continue; |
| 13105 | if (nid == 0x05) { |
| 13106 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13107 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13108 | "Center Playback Switch", |
| 13109 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13110 | HDA_OUTPUT)); |
| 13111 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13112 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13113 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13114 | "LFE Playback Switch", |
| 13115 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13116 | HDA_OUTPUT)); |
| 13117 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13118 | return err; |
| 13119 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13120 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13121 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13122 | if (nid == alc861_dac_nids[idx]) |
| 13123 | break; |
| 13124 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13125 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13126 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13127 | HDA_OUTPUT)); |
| 13128 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13129 | return err; |
| 13130 | } |
| 13131 | } |
| 13132 | return 0; |
| 13133 | } |
| 13134 | |
| 13135 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13136 | { |
| 13137 | int err; |
| 13138 | hda_nid_t nid; |
| 13139 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13140 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13141 | return 0; |
| 13142 | |
| 13143 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13144 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13145 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13146 | "Headphone Playback Switch", |
| 13147 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13148 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13149 | return err; |
| 13150 | spec->multiout.hp_nid = nid; |
| 13151 | } |
| 13152 | return 0; |
| 13153 | } |
| 13154 | |
| 13155 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13156 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13157 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13158 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13159 | struct hda_input_mux *imux = &spec->private_imux; |
| 13160 | int i, err, idx, idx1; |
| 13161 | |
| 13162 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13163 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13164 | case 0x0c: |
| 13165 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13166 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13167 | break; |
| 13168 | case 0x0f: |
| 13169 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13170 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13171 | break; |
| 13172 | case 0x0d: |
| 13173 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13174 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13175 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13176 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13177 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13178 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13179 | break; |
| 13180 | case 0x11: |
| 13181 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13182 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13183 | break; |
| 13184 | default: |
| 13185 | continue; |
| 13186 | } |
| 13187 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13188 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13189 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13190 | if (err < 0) |
| 13191 | return err; |
| 13192 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13193 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13194 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13195 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13196 | } |
| 13197 | return 0; |
| 13198 | } |
| 13199 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13200 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13201 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13202 | int pin_type, int dac_idx) |
| 13203 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13204 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13205 | pin_type); |
| 13206 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13207 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13208 | } |
| 13209 | |
| 13210 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13211 | { |
| 13212 | struct alc_spec *spec = codec->spec; |
| 13213 | int i; |
| 13214 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13215 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13216 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13217 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13218 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13219 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13220 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13221 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13222 | } |
| 13223 | } |
| 13224 | |
| 13225 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13226 | { |
| 13227 | struct alc_spec *spec = codec->spec; |
| 13228 | hda_nid_t pin; |
| 13229 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13230 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13231 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13232 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13233 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13234 | pin = spec->autocfg.speaker_pins[0]; |
| 13235 | if (pin) |
| 13236 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13237 | } |
| 13238 | |
| 13239 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13240 | { |
| 13241 | struct alc_spec *spec = codec->spec; |
| 13242 | int i; |
| 13243 | |
| 13244 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13245 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13246 | if (nid >= 0x0c && nid <= 0x11) { |
| 13247 | snd_hda_codec_write(codec, nid, 0, |
| 13248 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13249 | i <= AUTO_PIN_FRONT_MIC ? |
| 13250 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13251 | } |
| 13252 | } |
| 13253 | } |
| 13254 | |
| 13255 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13256 | /* return 1 if successful, 0 if the proper config is not found, |
| 13257 | * or a negative error code |
| 13258 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13259 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13260 | { |
| 13261 | struct alc_spec *spec = codec->spec; |
| 13262 | int err; |
| 13263 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13264 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13265 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13266 | alc861_ignore); |
| 13267 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13268 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13269 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13270 | return 0; /* can't find valid BIOS pin config */ |
| 13271 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13272 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13273 | if (err < 0) |
| 13274 | return err; |
| 13275 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13276 | if (err < 0) |
| 13277 | return err; |
| 13278 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13279 | if (err < 0) |
| 13280 | return err; |
| 13281 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13282 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13283 | return err; |
| 13284 | |
| 13285 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13286 | |
| 13287 | if (spec->autocfg.dig_out_pin) |
| 13288 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13289 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13290 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13291 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13292 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13293 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13294 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13295 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13296 | spec->input_mux = &spec->private_imux; |
| 13297 | |
| 13298 | spec->adc_nids = alc861_adc_nids; |
| 13299 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13300 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13301 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 13302 | store_pin_configs(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13303 | return 1; |
| 13304 | } |
| 13305 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13306 | /* additional initialization for auto-configuration model */ |
| 13307 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13308 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13309 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13310 | alc861_auto_init_multi_out(codec); |
| 13311 | alc861_auto_init_hp_out(codec); |
| 13312 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13313 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13314 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13315 | } |
| 13316 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13317 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13318 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13319 | { 0x15, HDA_INPUT, 0 }, |
| 13320 | { 0x15, HDA_INPUT, 1 }, |
| 13321 | { 0x15, HDA_INPUT, 2 }, |
| 13322 | { 0x15, HDA_INPUT, 3 }, |
| 13323 | { } /* end */ |
| 13324 | }; |
| 13325 | #endif |
| 13326 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13327 | |
| 13328 | /* |
| 13329 | * configuration and preset |
| 13330 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13331 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 13332 | [ALC861_3ST] = "3stack", |
| 13333 | [ALC660_3ST] = "3stack-660", |
| 13334 | [ALC861_3ST_DIG] = "3stack-dig", |
| 13335 | [ALC861_6ST_DIG] = "6stack-dig", |
| 13336 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 13337 | [ALC861_TOSHIBA] = "toshiba", |
| 13338 | [ALC861_ASUS] = "asus", |
| 13339 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 13340 | [ALC861_AUTO] = "auto", |
| 13341 | }; |
| 13342 | |
| 13343 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 13344 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13345 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13346 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 13347 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13348 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 13349 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 13350 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 13351 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 13352 | * Any other models that need this preset? |
| 13353 | */ |
| 13354 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 13355 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 13356 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13357 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 13358 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 13359 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 13360 | /* FIXME: the below seems conflict */ |
| 13361 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 13362 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 13363 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13364 | {} |
| 13365 | }; |
| 13366 | |
| 13367 | static struct alc_config_preset alc861_presets[] = { |
| 13368 | [ALC861_3ST] = { |
| 13369 | .mixers = { alc861_3ST_mixer }, |
| 13370 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13371 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13372 | .dac_nids = alc861_dac_nids, |
| 13373 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13374 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13375 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13376 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13377 | .adc_nids = alc861_adc_nids, |
| 13378 | .input_mux = &alc861_capture_source, |
| 13379 | }, |
| 13380 | [ALC861_3ST_DIG] = { |
| 13381 | .mixers = { alc861_base_mixer }, |
| 13382 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13383 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13384 | .dac_nids = alc861_dac_nids, |
| 13385 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13386 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13387 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13388 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13389 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13390 | .adc_nids = alc861_adc_nids, |
| 13391 | .input_mux = &alc861_capture_source, |
| 13392 | }, |
| 13393 | [ALC861_6ST_DIG] = { |
| 13394 | .mixers = { alc861_base_mixer }, |
| 13395 | .init_verbs = { alc861_base_init_verbs }, |
| 13396 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13397 | .dac_nids = alc861_dac_nids, |
| 13398 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13399 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 13400 | .channel_mode = alc861_8ch_modes, |
| 13401 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13402 | .adc_nids = alc861_adc_nids, |
| 13403 | .input_mux = &alc861_capture_source, |
| 13404 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13405 | [ALC660_3ST] = { |
| 13406 | .mixers = { alc861_3ST_mixer }, |
| 13407 | .init_verbs = { alc861_threestack_init_verbs }, |
| 13408 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 13409 | .dac_nids = alc660_dac_nids, |
| 13410 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 13411 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 13412 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13413 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13414 | .adc_nids = alc861_adc_nids, |
| 13415 | .input_mux = &alc861_capture_source, |
| 13416 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13417 | [ALC861_UNIWILL_M31] = { |
| 13418 | .mixers = { alc861_uniwill_m31_mixer }, |
| 13419 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 13420 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13421 | .dac_nids = alc861_dac_nids, |
| 13422 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13423 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13424 | .channel_mode = alc861_uniwill_m31_modes, |
| 13425 | .need_dac_fix = 1, |
| 13426 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13427 | .adc_nids = alc861_adc_nids, |
| 13428 | .input_mux = &alc861_capture_source, |
| 13429 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13430 | [ALC861_TOSHIBA] = { |
| 13431 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13432 | .init_verbs = { alc861_base_init_verbs, |
| 13433 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13434 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13435 | .dac_nids = alc861_dac_nids, |
| 13436 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13437 | .channel_mode = alc883_3ST_2ch_modes, |
| 13438 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13439 | .adc_nids = alc861_adc_nids, |
| 13440 | .input_mux = &alc861_capture_source, |
| 13441 | .unsol_event = alc861_toshiba_unsol_event, |
| 13442 | .init_hook = alc861_toshiba_automute, |
| 13443 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13444 | [ALC861_ASUS] = { |
| 13445 | .mixers = { alc861_asus_mixer }, |
| 13446 | .init_verbs = { alc861_asus_init_verbs }, |
| 13447 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13448 | .dac_nids = alc861_dac_nids, |
| 13449 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13450 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 13451 | .channel_mode = alc861_asus_modes, |
| 13452 | .need_dac_fix = 1, |
| 13453 | .hp_nid = 0x06, |
| 13454 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13455 | .adc_nids = alc861_adc_nids, |
| 13456 | .input_mux = &alc861_capture_source, |
| 13457 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13458 | [ALC861_ASUS_LAPTOP] = { |
| 13459 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 13460 | .init_verbs = { alc861_asus_init_verbs, |
| 13461 | alc861_asus_laptop_init_verbs }, |
| 13462 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 13463 | .dac_nids = alc861_dac_nids, |
| 13464 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 13465 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 13466 | .channel_mode = alc883_3ST_2ch_modes, |
| 13467 | .need_dac_fix = 1, |
| 13468 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 13469 | .adc_nids = alc861_adc_nids, |
| 13470 | .input_mux = &alc861_capture_source, |
| 13471 | }, |
| 13472 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13473 | |
| 13474 | |
| 13475 | static int patch_alc861(struct hda_codec *codec) |
| 13476 | { |
| 13477 | struct alc_spec *spec; |
| 13478 | int board_config; |
| 13479 | int err; |
| 13480 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13481 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13482 | if (spec == NULL) |
| 13483 | return -ENOMEM; |
| 13484 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13485 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13486 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13487 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 13488 | alc861_models, |
| 13489 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13490 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13491 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13492 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 13493 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13494 | board_config = ALC861_AUTO; |
| 13495 | } |
| 13496 | |
| 13497 | if (board_config == ALC861_AUTO) { |
| 13498 | /* automatic parse from the BIOS config */ |
| 13499 | err = alc861_parse_auto_config(codec); |
| 13500 | if (err < 0) { |
| 13501 | alc_free(codec); |
| 13502 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13503 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13504 | printk(KERN_INFO |
| 13505 | "hda_codec: Cannot set up configuration " |
| 13506 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13507 | board_config = ALC861_3ST_DIG; |
| 13508 | } |
| 13509 | } |
| 13510 | |
| 13511 | if (board_config != ALC861_AUTO) |
| 13512 | setup_preset(spec, &alc861_presets[board_config]); |
| 13513 | |
| 13514 | spec->stream_name_analog = "ALC861 Analog"; |
| 13515 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 13516 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 13517 | |
| 13518 | spec->stream_name_digital = "ALC861 Digital"; |
| 13519 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 13520 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 13521 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13522 | spec->vmaster_nid = 0x03; |
| 13523 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13524 | codec->patch_ops = alc_patch_ops; |
| 13525 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13526 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13527 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13528 | if (!spec->loopback.amplist) |
| 13529 | spec->loopback.amplist = alc861_loopbacks; |
| 13530 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13531 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13532 | return 0; |
| 13533 | } |
| 13534 | |
| 13535 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13536 | * ALC861-VD support |
| 13537 | * |
| 13538 | * Based on ALC882 |
| 13539 | * |
| 13540 | * In addition, an independent DAC |
| 13541 | */ |
| 13542 | #define ALC861VD_DIGOUT_NID 0x06 |
| 13543 | |
| 13544 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 13545 | /* front, surr, clfe, side surr */ |
| 13546 | 0x02, 0x03, 0x04, 0x05 |
| 13547 | }; |
| 13548 | |
| 13549 | /* dac_nids for ALC660vd are in a different order - according to |
| 13550 | * Realtek's driver. |
| 13551 | * This should probably tesult in a different mixer for 6stack models |
| 13552 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 13553 | * - and it is the same as in 861vd. |
| 13554 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 13555 | */ |
| 13556 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 13557 | /* front, rear, clfe, rear_surr */ |
| 13558 | 0x02, 0x04, 0x03 |
| 13559 | }; |
| 13560 | |
| 13561 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 13562 | /* ADC0 */ |
| 13563 | 0x09, |
| 13564 | }; |
| 13565 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13566 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 13567 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13568 | /* input MUX */ |
| 13569 | /* FIXME: should be a matrix-type input source selection */ |
| 13570 | static struct hda_input_mux alc861vd_capture_source = { |
| 13571 | .num_items = 4, |
| 13572 | .items = { |
| 13573 | { "Mic", 0x0 }, |
| 13574 | { "Front Mic", 0x1 }, |
| 13575 | { "Line", 0x2 }, |
| 13576 | { "CD", 0x4 }, |
| 13577 | }, |
| 13578 | }; |
| 13579 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13580 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13581 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13582 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13583 | { "Ext Mic", 0x0 }, |
| 13584 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13585 | }, |
| 13586 | }; |
| 13587 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13588 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 13589 | .num_items = 2, |
| 13590 | .items = { |
| 13591 | { "Front Mic", 0x0 }, |
| 13592 | { "ATAPI Mic", 0x1 }, |
| 13593 | }, |
| 13594 | }; |
| 13595 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13596 | /* |
| 13597 | * 2ch mode |
| 13598 | */ |
| 13599 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 13600 | { 2, NULL } |
| 13601 | }; |
| 13602 | |
| 13603 | /* |
| 13604 | * 6ch mode |
| 13605 | */ |
| 13606 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 13607 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13608 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13609 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13610 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13611 | { } /* end */ |
| 13612 | }; |
| 13613 | |
| 13614 | /* |
| 13615 | * 8ch mode |
| 13616 | */ |
| 13617 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 13618 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13619 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13620 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13621 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13622 | { } /* end */ |
| 13623 | }; |
| 13624 | |
| 13625 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 13626 | { 6, alc861vd_6stack_ch6_init }, |
| 13627 | { 8, alc861vd_6stack_ch8_init }, |
| 13628 | }; |
| 13629 | |
| 13630 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 13631 | { |
| 13632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13633 | .name = "Channel Mode", |
| 13634 | .info = alc_ch_mode_info, |
| 13635 | .get = alc_ch_mode_get, |
| 13636 | .put = alc_ch_mode_put, |
| 13637 | }, |
| 13638 | { } /* end */ |
| 13639 | }; |
| 13640 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13641 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13642 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13643 | */ |
| 13644 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 13645 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13646 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13647 | |
| 13648 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13649 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13650 | |
| 13651 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 13652 | HDA_OUTPUT), |
| 13653 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 13654 | HDA_OUTPUT), |
| 13655 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13656 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 13657 | |
| 13658 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 13659 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13660 | |
| 13661 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13662 | |
| 13663 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13665 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13666 | |
| 13667 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13668 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13669 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13670 | |
| 13671 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13672 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13673 | |
| 13674 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13675 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13676 | |
| 13677 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13678 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13679 | |
| 13680 | { } /* end */ |
| 13681 | }; |
| 13682 | |
| 13683 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 13684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13685 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13686 | |
| 13687 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13688 | |
| 13689 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13692 | |
| 13693 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13694 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13695 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13696 | |
| 13697 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13698 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13699 | |
| 13700 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13701 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13702 | |
| 13703 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13704 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 13705 | |
| 13706 | { } /* end */ |
| 13707 | }; |
| 13708 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13709 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 13710 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13711 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 13712 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13713 | |
| 13714 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13715 | |
| 13716 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13717 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13719 | |
| 13720 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13721 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13722 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13723 | |
| 13724 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13725 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13726 | |
| 13727 | { } /* end */ |
| 13728 | }; |
| 13729 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13730 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 13731 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13732 | */ |
| 13733 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13734 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13735 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13736 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13737 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13738 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 13739 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13740 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13741 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 13742 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13743 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13744 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 13745 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13746 | { } /* end */ |
| 13747 | }; |
| 13748 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13749 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 13750 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 13751 | */ |
| 13752 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 13753 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13754 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13755 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13756 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 13757 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13758 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13759 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13760 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13761 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13762 | { } /* end */ |
| 13763 | }; |
| 13764 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13765 | /* |
| 13766 | * generic initialization of ADC, input mixers and output mixers |
| 13767 | */ |
| 13768 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 13769 | /* |
| 13770 | * Unmute ADC0 and set the default input to mic-in |
| 13771 | */ |
| 13772 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13773 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13774 | |
| 13775 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 13776 | * the analog-loopback mixer widget |
| 13777 | */ |
| 13778 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13779 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13780 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13781 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13782 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13783 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13784 | |
| 13785 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13786 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13787 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13788 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13789 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13790 | |
| 13791 | /* |
| 13792 | * Set up output mixers (0x02 - 0x05) |
| 13793 | */ |
| 13794 | /* set vol=0 to output mixers */ |
| 13795 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13796 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13797 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13798 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13799 | |
| 13800 | /* set up input amps for analog loopback */ |
| 13801 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13805 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13806 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13807 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13808 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13809 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13810 | |
| 13811 | { } |
| 13812 | }; |
| 13813 | |
| 13814 | /* |
| 13815 | * 3-stack pin configuration: |
| 13816 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 13817 | */ |
| 13818 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 13819 | /* |
| 13820 | * Set pin mode and muting |
| 13821 | */ |
| 13822 | /* set front pin widgets 0x14 for output */ |
| 13823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13825 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13826 | |
| 13827 | /* Mic (rear) pin: input vref at 80% */ |
| 13828 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13829 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13830 | /* Front Mic pin: input vref at 80% */ |
| 13831 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13832 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13833 | /* Line In pin: input */ |
| 13834 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13835 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13836 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13837 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13838 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13839 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13840 | /* CD pin widget for input */ |
| 13841 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13842 | |
| 13843 | { } |
| 13844 | }; |
| 13845 | |
| 13846 | /* |
| 13847 | * 6-stack pin configuration: |
| 13848 | */ |
| 13849 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 13850 | /* |
| 13851 | * Set pin mode and muting |
| 13852 | */ |
| 13853 | /* set front pin widgets 0x14 for output */ |
| 13854 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13855 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13856 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13857 | |
| 13858 | /* Rear Pin: output 1 (0x0d) */ |
| 13859 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13861 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13862 | /* CLFE Pin: output 2 (0x0e) */ |
| 13863 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13864 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13865 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 13866 | /* Side Pin: output 3 (0x0f) */ |
| 13867 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13868 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13869 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 13870 | |
| 13871 | /* Mic (rear) pin: input vref at 80% */ |
| 13872 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13873 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13874 | /* Front Mic pin: input vref at 80% */ |
| 13875 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13876 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13877 | /* Line In pin: input */ |
| 13878 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13879 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13880 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13881 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13882 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13883 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13884 | /* CD pin widget for input */ |
| 13885 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13886 | |
| 13887 | { } |
| 13888 | }; |
| 13889 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13890 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 13891 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13892 | { } |
| 13893 | }; |
| 13894 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13895 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 13896 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13897 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13898 | { } |
| 13899 | }; |
| 13900 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13901 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 13902 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13904 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 13905 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13906 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13907 | {} |
| 13908 | }; |
| 13909 | |
| 13910 | /* toggle speaker-output according to the hp-jack state */ |
| 13911 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 13912 | { |
| 13913 | unsigned int present; |
| 13914 | unsigned char bits; |
| 13915 | |
| 13916 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13917 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13918 | bits = present ? HDA_AMP_MUTE : 0; |
| 13919 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13920 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13921 | } |
| 13922 | |
| 13923 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 13924 | { |
| 13925 | unsigned int present; |
| 13926 | unsigned char bits; |
| 13927 | |
| 13928 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13929 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13930 | bits = present ? HDA_AMP_MUTE : 0; |
| 13931 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 13932 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13933 | } |
| 13934 | |
| 13935 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 13936 | { |
| 13937 | alc861vd_lenovo_hp_automute(codec); |
| 13938 | alc861vd_lenovo_mic_automute(codec); |
| 13939 | } |
| 13940 | |
| 13941 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 13942 | unsigned int res) |
| 13943 | { |
| 13944 | switch (res >> 26) { |
| 13945 | case ALC880_HP_EVENT: |
| 13946 | alc861vd_lenovo_hp_automute(codec); |
| 13947 | break; |
| 13948 | case ALC880_MIC_EVENT: |
| 13949 | alc861vd_lenovo_mic_automute(codec); |
| 13950 | break; |
| 13951 | } |
| 13952 | } |
| 13953 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13954 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 13955 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13956 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13957 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13958 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13959 | |
| 13960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13961 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13962 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13963 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13965 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13966 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13967 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13968 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13969 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13973 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13975 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13976 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13977 | |
| 13978 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13980 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 13981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13982 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13983 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13984 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13985 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13986 | |
| 13987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13989 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13990 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13991 | |
| 13992 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13993 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13994 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13995 | |
| 13996 | { } /* end */ |
| 13997 | }; |
| 13998 | |
| 13999 | /* toggle speaker-output according to the hp-jack state */ |
| 14000 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 14001 | { |
| 14002 | unsigned int present; |
| 14003 | |
| 14004 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14005 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14006 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14007 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14008 | } |
| 14009 | |
| 14010 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 14011 | { |
| 14012 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14013 | alc861vd_dallas_automute(codec); |
| 14014 | } |
| 14015 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14016 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14017 | #define alc861vd_loopbacks alc880_loopbacks |
| 14018 | #endif |
| 14019 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14020 | /* pcm configuration: identiacal with ALC880 */ |
| 14021 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14022 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14023 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14024 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14025 | |
| 14026 | /* |
| 14027 | * configuration and preset |
| 14028 | */ |
| 14029 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14030 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14031 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14032 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14033 | [ALC861VD_3ST] = "3stack", |
| 14034 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14035 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14036 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14037 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14038 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14039 | [ALC861VD_AUTO] = "auto", |
| 14040 | }; |
| 14041 | |
| 14042 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14043 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14044 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14045 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14046 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14047 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14048 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14049 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14050 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14051 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14052 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14053 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14054 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14055 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14056 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 14057 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Takashi Iwai | be321a89 | 2008-07-07 16:04:04 +0200 | [diff] [blame] | 14058 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14059 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14060 | {} |
| 14061 | }; |
| 14062 | |
| 14063 | static struct alc_config_preset alc861vd_presets[] = { |
| 14064 | [ALC660VD_3ST] = { |
| 14065 | .mixers = { alc861vd_3st_mixer }, |
| 14066 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14067 | alc861vd_3stack_init_verbs }, |
| 14068 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14069 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14070 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14071 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14072 | .input_mux = &alc861vd_capture_source, |
| 14073 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14074 | [ALC660VD_3ST_DIG] = { |
| 14075 | .mixers = { alc861vd_3st_mixer }, |
| 14076 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14077 | alc861vd_3stack_init_verbs }, |
| 14078 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14079 | .dac_nids = alc660vd_dac_nids, |
| 14080 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14081 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14082 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14083 | .input_mux = &alc861vd_capture_source, |
| 14084 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14085 | [ALC861VD_3ST] = { |
| 14086 | .mixers = { alc861vd_3st_mixer }, |
| 14087 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14088 | alc861vd_3stack_init_verbs }, |
| 14089 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14090 | .dac_nids = alc861vd_dac_nids, |
| 14091 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14092 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14093 | .input_mux = &alc861vd_capture_source, |
| 14094 | }, |
| 14095 | [ALC861VD_3ST_DIG] = { |
| 14096 | .mixers = { alc861vd_3st_mixer }, |
| 14097 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14098 | alc861vd_3stack_init_verbs }, |
| 14099 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14100 | .dac_nids = alc861vd_dac_nids, |
| 14101 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14102 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14103 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14104 | .input_mux = &alc861vd_capture_source, |
| 14105 | }, |
| 14106 | [ALC861VD_6ST_DIG] = { |
| 14107 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14108 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14109 | alc861vd_6stack_init_verbs }, |
| 14110 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14111 | .dac_nids = alc861vd_dac_nids, |
| 14112 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14113 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14114 | .channel_mode = alc861vd_6stack_modes, |
| 14115 | .input_mux = &alc861vd_capture_source, |
| 14116 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14117 | [ALC861VD_LENOVO] = { |
| 14118 | .mixers = { alc861vd_lenovo_mixer }, |
| 14119 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14120 | alc861vd_3stack_init_verbs, |
| 14121 | alc861vd_eapd_verbs, |
| 14122 | alc861vd_lenovo_unsol_verbs }, |
| 14123 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14124 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14125 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14126 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14127 | .input_mux = &alc861vd_capture_source, |
| 14128 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14129 | .init_hook = alc861vd_lenovo_automute, |
| 14130 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14131 | [ALC861VD_DALLAS] = { |
| 14132 | .mixers = { alc861vd_dallas_mixer }, |
| 14133 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14134 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14135 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14136 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14137 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14138 | .input_mux = &alc861vd_dallas_capture_source, |
| 14139 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14140 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14141 | }, |
| 14142 | [ALC861VD_HP] = { |
| 14143 | .mixers = { alc861vd_hp_mixer }, |
| 14144 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14145 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14146 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14147 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14148 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14149 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14150 | .input_mux = &alc861vd_hp_capture_source, |
| 14151 | .unsol_event = alc861vd_dallas_unsol_event, |
| 14152 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14153 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14154 | [ALC660VD_ASUS_V1S] = { |
| 14155 | .mixers = { alc861vd_lenovo_mixer }, |
| 14156 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14157 | alc861vd_3stack_init_verbs, |
| 14158 | alc861vd_eapd_verbs, |
| 14159 | alc861vd_lenovo_unsol_verbs }, |
| 14160 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14161 | .dac_nids = alc660vd_dac_nids, |
| 14162 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14163 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14164 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14165 | .input_mux = &alc861vd_capture_source, |
| 14166 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 14167 | .init_hook = alc861vd_lenovo_automute, |
| 14168 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14169 | }; |
| 14170 | |
| 14171 | /* |
| 14172 | * BIOS auto configuration |
| 14173 | */ |
| 14174 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14175 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14176 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14177 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14178 | } |
| 14179 | |
| 14180 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14181 | { |
| 14182 | struct alc_spec *spec = codec->spec; |
| 14183 | int i; |
| 14184 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14185 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14186 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14187 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14188 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14189 | if (nid) |
| 14190 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14191 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14192 | } |
| 14193 | } |
| 14194 | |
| 14195 | |
| 14196 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14197 | { |
| 14198 | struct alc_spec *spec = codec->spec; |
| 14199 | hda_nid_t pin; |
| 14200 | |
| 14201 | pin = spec->autocfg.hp_pins[0]; |
| 14202 | if (pin) /* connect to front and use dac 0 */ |
| 14203 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14204 | pin = spec->autocfg.speaker_pins[0]; |
| 14205 | if (pin) |
| 14206 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14207 | } |
| 14208 | |
| 14209 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14210 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14211 | |
| 14212 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14213 | { |
| 14214 | struct alc_spec *spec = codec->spec; |
| 14215 | int i; |
| 14216 | |
| 14217 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14218 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14219 | if (alc861vd_is_input_pin(nid)) { |
| 14220 | snd_hda_codec_write(codec, nid, 0, |
| 14221 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14222 | i <= AUTO_PIN_FRONT_MIC ? |
| 14223 | PIN_VREF80 : PIN_IN); |
| 14224 | if (nid != ALC861VD_PIN_CD_NID) |
| 14225 | snd_hda_codec_write(codec, nid, 0, |
| 14226 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14227 | AMP_OUT_MUTE); |
| 14228 | } |
| 14229 | } |
| 14230 | } |
| 14231 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14232 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14233 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14234 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14235 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14236 | |
| 14237 | /* add playback controls from the parsed DAC table */ |
| 14238 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14239 | * different NIDs for mute/unmute switch and volume control */ |
| 14240 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14241 | const struct auto_pin_cfg *cfg) |
| 14242 | { |
| 14243 | char name[32]; |
| 14244 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14245 | hda_nid_t nid_v, nid_s; |
| 14246 | int i, err; |
| 14247 | |
| 14248 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14249 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14250 | continue; |
| 14251 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14252 | alc880_dac_to_idx( |
| 14253 | spec->multiout.dac_nids[i])); |
| 14254 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14255 | alc880_dac_to_idx( |
| 14256 | spec->multiout.dac_nids[i])); |
| 14257 | |
| 14258 | if (i == 2) { |
| 14259 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14260 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14261 | "Center Playback Volume", |
| 14262 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14263 | HDA_OUTPUT)); |
| 14264 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14265 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14266 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14267 | "LFE Playback Volume", |
| 14268 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14269 | HDA_OUTPUT)); |
| 14270 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14271 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14272 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14273 | "Center Playback Switch", |
| 14274 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14275 | HDA_INPUT)); |
| 14276 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14277 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14278 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14279 | "LFE Playback Switch", |
| 14280 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14281 | HDA_INPUT)); |
| 14282 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14283 | return err; |
| 14284 | } else { |
| 14285 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14286 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14287 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14288 | HDA_OUTPUT)); |
| 14289 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14290 | return err; |
| 14291 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14292 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14293 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14294 | HDA_INPUT)); |
| 14295 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14296 | return err; |
| 14297 | } |
| 14298 | } |
| 14299 | return 0; |
| 14300 | } |
| 14301 | |
| 14302 | /* add playback controls for speaker and HP outputs */ |
| 14303 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14304 | * different NIDs for mute/unmute switch and volume control */ |
| 14305 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14306 | hda_nid_t pin, const char *pfx) |
| 14307 | { |
| 14308 | hda_nid_t nid_v, nid_s; |
| 14309 | int err; |
| 14310 | char name[32]; |
| 14311 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14312 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14313 | return 0; |
| 14314 | |
| 14315 | if (alc880_is_fixed_pin(pin)) { |
| 14316 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14317 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14318 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14319 | spec->multiout.hp_nid = nid_v; |
| 14320 | else |
| 14321 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14322 | /* control HP volume/switch on the output mixer amp */ |
| 14323 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14324 | alc880_fixed_pin_idx(pin)); |
| 14325 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14326 | alc880_fixed_pin_idx(pin)); |
| 14327 | |
| 14328 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14329 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14330 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14331 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14332 | return err; |
| 14333 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14334 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14335 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14336 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14337 | return err; |
| 14338 | } else if (alc880_is_multi_pin(pin)) { |
| 14339 | /* set manual connection */ |
| 14340 | /* we have only a switch on HP-out PIN */ |
| 14341 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14342 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14343 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14344 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14345 | return err; |
| 14346 | } |
| 14347 | return 0; |
| 14348 | } |
| 14349 | |
| 14350 | /* parse the BIOS configuration and set up the alc_spec |
| 14351 | * return 1 if successful, 0 if the proper config is not found, |
| 14352 | * or a negative error code |
| 14353 | * Based on ALC880 version - had to change it to override |
| 14354 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 14355 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 14356 | { |
| 14357 | struct alc_spec *spec = codec->spec; |
| 14358 | int err; |
| 14359 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 14360 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14361 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14362 | alc861vd_ignore); |
| 14363 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14364 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14365 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14366 | return 0; /* can't find valid BIOS pin config */ |
| 14367 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14368 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14369 | if (err < 0) |
| 14370 | return err; |
| 14371 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14372 | if (err < 0) |
| 14373 | return err; |
| 14374 | err = alc861vd_auto_create_extra_out(spec, |
| 14375 | spec->autocfg.speaker_pins[0], |
| 14376 | "Speaker"); |
| 14377 | if (err < 0) |
| 14378 | return err; |
| 14379 | err = alc861vd_auto_create_extra_out(spec, |
| 14380 | spec->autocfg.hp_pins[0], |
| 14381 | "Headphone"); |
| 14382 | if (err < 0) |
| 14383 | return err; |
| 14384 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14385 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14386 | return err; |
| 14387 | |
| 14388 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14389 | |
| 14390 | if (spec->autocfg.dig_out_pin) |
| 14391 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 14392 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14393 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14394 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14395 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14396 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14397 | |
| 14398 | spec->num_mux_defs = 1; |
| 14399 | spec->input_mux = &spec->private_imux; |
| 14400 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 14401 | err = alc_auto_add_mic_boost(codec); |
| 14402 | if (err < 0) |
| 14403 | return err; |
| 14404 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 14405 | store_pin_configs(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14406 | return 1; |
| 14407 | } |
| 14408 | |
| 14409 | /* additional initialization for auto-configuration model */ |
| 14410 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 14411 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14412 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14413 | alc861vd_auto_init_multi_out(codec); |
| 14414 | alc861vd_auto_init_hp_out(codec); |
| 14415 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14416 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14417 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14418 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14419 | } |
| 14420 | |
| 14421 | static int patch_alc861vd(struct hda_codec *codec) |
| 14422 | { |
| 14423 | struct alc_spec *spec; |
| 14424 | int err, board_config; |
| 14425 | |
| 14426 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14427 | if (spec == NULL) |
| 14428 | return -ENOMEM; |
| 14429 | |
| 14430 | codec->spec = spec; |
| 14431 | |
| 14432 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 14433 | alc861vd_models, |
| 14434 | alc861vd_cfg_tbl); |
| 14435 | |
| 14436 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 14437 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 14438 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 14439 | board_config = ALC861VD_AUTO; |
| 14440 | } |
| 14441 | |
| 14442 | if (board_config == ALC861VD_AUTO) { |
| 14443 | /* automatic parse from the BIOS config */ |
| 14444 | err = alc861vd_parse_auto_config(codec); |
| 14445 | if (err < 0) { |
| 14446 | alc_free(codec); |
| 14447 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14448 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14449 | printk(KERN_INFO |
| 14450 | "hda_codec: Cannot set up configuration " |
| 14451 | "from BIOS. Using base mode...\n"); |
| 14452 | board_config = ALC861VD_3ST; |
| 14453 | } |
| 14454 | } |
| 14455 | |
| 14456 | if (board_config != ALC861VD_AUTO) |
| 14457 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 14458 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14459 | if (codec->vendor_id == 0x10ec0660) { |
| 14460 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 14461 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14462 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14463 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 14464 | } else { |
| 14465 | spec->stream_name_analog = "ALC861VD Analog"; |
| 14466 | spec->stream_name_digital = "ALC861VD Digital"; |
| 14467 | } |
| 14468 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14469 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 14470 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 14471 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14472 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 14473 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 14474 | |
| 14475 | spec->adc_nids = alc861vd_adc_nids; |
| 14476 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14477 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 14478 | spec->is_mix_capture = 1; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14479 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14480 | set_capture_mixer(spec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14481 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14482 | spec->vmaster_nid = 0x02; |
| 14483 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14484 | codec->patch_ops = alc_patch_ops; |
| 14485 | |
| 14486 | if (board_config == ALC861VD_AUTO) |
| 14487 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14488 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14489 | if (!spec->loopback.amplist) |
| 14490 | spec->loopback.amplist = alc861vd_loopbacks; |
| 14491 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14492 | |
| 14493 | return 0; |
| 14494 | } |
| 14495 | |
| 14496 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14497 | * ALC662 support |
| 14498 | * |
| 14499 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 14500 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 14501 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 14502 | * 6-channel independent captures. |
| 14503 | * |
| 14504 | * In addition, an independent DAC for the multi-playback (not used in this |
| 14505 | * driver yet). |
| 14506 | */ |
| 14507 | #define ALC662_DIGOUT_NID 0x06 |
| 14508 | #define ALC662_DIGIN_NID 0x0a |
| 14509 | |
| 14510 | static hda_nid_t alc662_dac_nids[4] = { |
| 14511 | /* front, rear, clfe, rear_surr */ |
| 14512 | 0x02, 0x03, 0x04 |
| 14513 | }; |
| 14514 | |
| 14515 | static hda_nid_t alc662_adc_nids[1] = { |
| 14516 | /* ADC1-2 */ |
| 14517 | 0x09, |
| 14518 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14519 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 14520 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14521 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14522 | /* input MUX */ |
| 14523 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14524 | static struct hda_input_mux alc662_capture_source = { |
| 14525 | .num_items = 4, |
| 14526 | .items = { |
| 14527 | { "Mic", 0x0 }, |
| 14528 | { "Front Mic", 0x1 }, |
| 14529 | { "Line", 0x2 }, |
| 14530 | { "CD", 0x4 }, |
| 14531 | }, |
| 14532 | }; |
| 14533 | |
| 14534 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 14535 | .num_items = 2, |
| 14536 | .items = { |
| 14537 | { "Mic", 0x1 }, |
| 14538 | { "Line", 0x2 }, |
| 14539 | }, |
| 14540 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14541 | |
| 14542 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 14543 | .num_items = 2, |
| 14544 | .items = { |
| 14545 | { "i-Mic", 0x1 }, |
| 14546 | { "e-Mic", 0x0 }, |
| 14547 | }, |
| 14548 | }; |
| 14549 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14550 | static struct hda_input_mux alc663_capture_source = { |
| 14551 | .num_items = 3, |
| 14552 | .items = { |
| 14553 | { "Mic", 0x0 }, |
| 14554 | { "Front Mic", 0x1 }, |
| 14555 | { "Line", 0x2 }, |
| 14556 | }, |
| 14557 | }; |
| 14558 | |
| 14559 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 14560 | .num_items = 2, |
| 14561 | .items = { |
| 14562 | { "Ext-Mic", 0x0 }, |
| 14563 | { "D-Mic", 0x9 }, |
| 14564 | }, |
| 14565 | }; |
| 14566 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14567 | /* |
| 14568 | * 2ch mode |
| 14569 | */ |
| 14570 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 14571 | { 2, NULL } |
| 14572 | }; |
| 14573 | |
| 14574 | /* |
| 14575 | * 2ch mode |
| 14576 | */ |
| 14577 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 14578 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 14579 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14580 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 14581 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 14582 | { } /* end */ |
| 14583 | }; |
| 14584 | |
| 14585 | /* |
| 14586 | * 6ch mode |
| 14587 | */ |
| 14588 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 14589 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14590 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14591 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 14592 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14593 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 14594 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14595 | { } /* end */ |
| 14596 | }; |
| 14597 | |
| 14598 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 14599 | { 2, alc662_3ST_ch2_init }, |
| 14600 | { 6, alc662_3ST_ch6_init }, |
| 14601 | }; |
| 14602 | |
| 14603 | /* |
| 14604 | * 2ch mode |
| 14605 | */ |
| 14606 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 14607 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14608 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14609 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14610 | { } /* end */ |
| 14611 | }; |
| 14612 | |
| 14613 | /* |
| 14614 | * 6ch mode |
| 14615 | */ |
| 14616 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 14617 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14618 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14619 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14620 | { } /* end */ |
| 14621 | }; |
| 14622 | |
| 14623 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 14624 | { 2, alc662_sixstack_ch6_init }, |
| 14625 | { 6, alc662_sixstack_ch8_init }, |
| 14626 | }; |
| 14627 | |
| 14628 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14629 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14630 | */ |
| 14631 | |
| 14632 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 14633 | /* output mixer control */ |
| 14634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14635 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14636 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14637 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14638 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14639 | 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] | 14640 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14641 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14643 | |
| 14644 | /*Input mixer control */ |
| 14645 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 14646 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 14647 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 14648 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 14649 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 14650 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 14651 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 14652 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14653 | { } /* end */ |
| 14654 | }; |
| 14655 | |
| 14656 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 14657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14658 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14659 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14660 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14661 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14662 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14663 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14664 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14665 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14666 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14667 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14668 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14669 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14670 | { } /* end */ |
| 14671 | }; |
| 14672 | |
| 14673 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 14674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14675 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14676 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 14677 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14678 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14679 | 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] | 14680 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 14681 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14682 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14683 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14684 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14685 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14686 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14689 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14690 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14691 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 14692 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14693 | { } /* end */ |
| 14694 | }; |
| 14695 | |
| 14696 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 14697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14698 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14699 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14700 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14701 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14702 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14703 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14705 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14706 | { } /* end */ |
| 14707 | }; |
| 14708 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14709 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14710 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14711 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 14712 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14713 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14714 | |
| 14715 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 14716 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14717 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14718 | |
| 14719 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 14720 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14721 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14722 | { } /* end */ |
| 14723 | }; |
| 14724 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14725 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 14726 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14727 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14728 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14729 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 14730 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 14731 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 14732 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 14733 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 14734 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14735 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14736 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14737 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14740 | { } /* end */ |
| 14741 | }; |
| 14742 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14743 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 14744 | .ops = &snd_hda_bind_vol, |
| 14745 | .values = { |
| 14746 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14747 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 14748 | 0 |
| 14749 | }, |
| 14750 | }; |
| 14751 | |
| 14752 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 14753 | .ops = &snd_hda_bind_sw, |
| 14754 | .values = { |
| 14755 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14756 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14757 | 0 |
| 14758 | }, |
| 14759 | }; |
| 14760 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14761 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14762 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14763 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 14764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14766 | { } /* end */ |
| 14767 | }; |
| 14768 | |
| 14769 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 14770 | .ops = &snd_hda_bind_sw, |
| 14771 | .values = { |
| 14772 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14773 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14774 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 14775 | 0 |
| 14776 | }, |
| 14777 | }; |
| 14778 | |
| 14779 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 14780 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14781 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 14782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14784 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14785 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14786 | |
| 14787 | { } /* end */ |
| 14788 | }; |
| 14789 | |
| 14790 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 14791 | .ops = &snd_hda_bind_sw, |
| 14792 | .values = { |
| 14793 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14794 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 14795 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 14796 | 0 |
| 14797 | }, |
| 14798 | }; |
| 14799 | |
| 14800 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 14801 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14802 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 14803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14805 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14806 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14807 | { } /* end */ |
| 14808 | }; |
| 14809 | |
| 14810 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14811 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14812 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14816 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14817 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14818 | { } /* end */ |
| 14819 | }; |
| 14820 | |
| 14821 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 14822 | .ops = &snd_hda_bind_vol, |
| 14823 | .values = { |
| 14824 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 14825 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 14826 | 0 |
| 14827 | }, |
| 14828 | }; |
| 14829 | |
| 14830 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 14831 | .ops = &snd_hda_bind_sw, |
| 14832 | .values = { |
| 14833 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14834 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 14835 | 0 |
| 14836 | }, |
| 14837 | }; |
| 14838 | |
| 14839 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 14840 | HDA_BIND_VOL("Master Playback Volume", |
| 14841 | &alc663_asus_two_bind_master_vol), |
| 14842 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14843 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 14847 | { } /* end */ |
| 14848 | }; |
| 14849 | |
| 14850 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 14851 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 14852 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 14853 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14857 | { } /* end */ |
| 14858 | }; |
| 14859 | |
| 14860 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 14861 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14862 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14864 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14866 | |
| 14867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14869 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14870 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14871 | { } /* end */ |
| 14872 | }; |
| 14873 | |
| 14874 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 14875 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14876 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14878 | |
| 14879 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14880 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14881 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14882 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14883 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14884 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14885 | { } /* end */ |
| 14886 | }; |
| 14887 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14888 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 14889 | { |
| 14890 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14891 | .name = "Channel Mode", |
| 14892 | .info = alc_ch_mode_info, |
| 14893 | .get = alc_ch_mode_get, |
| 14894 | .put = alc_ch_mode_put, |
| 14895 | }, |
| 14896 | { } /* end */ |
| 14897 | }; |
| 14898 | |
| 14899 | static struct hda_verb alc662_init_verbs[] = { |
| 14900 | /* ADC: mute amp left and right */ |
| 14901 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14902 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14903 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 14904 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14906 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14907 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14910 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14915 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14916 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14917 | |
| 14918 | /* Front Pin: output 0 (0x0c) */ |
| 14919 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14920 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14921 | |
| 14922 | /* Rear Pin: output 1 (0x0d) */ |
| 14923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14925 | |
| 14926 | /* CLFE Pin: output 2 (0x0e) */ |
| 14927 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14929 | |
| 14930 | /* Mic (rear) pin: input vref at 80% */ |
| 14931 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14932 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14933 | /* Front Mic pin: input vref at 80% */ |
| 14934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14935 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14936 | /* Line In pin: input */ |
| 14937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14939 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14943 | /* CD pin widget for input */ |
| 14944 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14945 | |
| 14946 | /* FIXME: use matrix-type input source selection */ |
| 14947 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 14948 | /* Input mixer */ |
| 14949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14952 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14953 | |
| 14954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14957 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14958 | |
| 14959 | /* always trun on EAPD */ |
| 14960 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14961 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14962 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14963 | { } |
| 14964 | }; |
| 14965 | |
| 14966 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 14967 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 14968 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14969 | {} |
| 14970 | }; |
| 14971 | |
| 14972 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 14973 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14974 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14975 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14976 | }; |
| 14977 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14978 | /* Set Unsolicited Event*/ |
| 14979 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 14980 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14981 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14982 | {} |
| 14983 | }; |
| 14984 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14985 | /* |
| 14986 | * generic initialization of ADC, input mixers and output mixers |
| 14987 | */ |
| 14988 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 14989 | /* |
| 14990 | * Unmute ADC and set the default input to mic-in |
| 14991 | */ |
| 14992 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14993 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14994 | |
| 14995 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 14996 | * mixer widget |
| 14997 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 14998 | * panel mic (mic 2) |
| 14999 | */ |
| 15000 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15001 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15002 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15003 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15006 | |
| 15007 | /* |
| 15008 | * Set up output mixers (0x0c - 0x0f) |
| 15009 | */ |
| 15010 | /* set vol=0 to output mixers */ |
| 15011 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15012 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15013 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15014 | |
| 15015 | /* set up input amps for analog loopback */ |
| 15016 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15019 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15020 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15022 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15023 | |
| 15024 | |
| 15025 | /* FIXME: use matrix-type input source selection */ |
| 15026 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15027 | /* Input mixer */ |
| 15028 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15029 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15030 | { } |
| 15031 | }; |
| 15032 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15033 | /* additional verbs for ALC663 */ |
| 15034 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15035 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15036 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15037 | { } |
| 15038 | }; |
| 15039 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15040 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15041 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15042 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15043 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15044 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15045 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15048 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15049 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15050 | {} |
| 15051 | }; |
| 15052 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15053 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15054 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15055 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15056 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15060 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15061 | {} |
| 15062 | }; |
| 15063 | |
| 15064 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15065 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15066 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15067 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15068 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15071 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15072 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15073 | {} |
| 15074 | }; |
| 15075 | |
| 15076 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15078 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15079 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15080 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15082 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15083 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15084 | {} |
| 15085 | }; |
| 15086 | |
| 15087 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15088 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15089 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15090 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15091 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15092 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15093 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15094 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15097 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15098 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15099 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15100 | {} |
| 15101 | }; |
| 15102 | |
| 15103 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15104 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15105 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15107 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15113 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15114 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15115 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15116 | {} |
| 15117 | }; |
| 15118 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15119 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15120 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15121 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15122 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15123 | |
| 15124 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15125 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15126 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15127 | |
| 15128 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15129 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15130 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15131 | {} |
| 15132 | }; |
| 15133 | |
| 15134 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15135 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15136 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15137 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15138 | |
| 15139 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15140 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15141 | {} |
| 15142 | }; |
| 15143 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15144 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15146 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15147 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15148 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15149 | {} |
| 15150 | }; |
| 15151 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15152 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15153 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15154 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15155 | { } /* end */ |
| 15156 | }; |
| 15157 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15158 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15159 | { |
| 15160 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15161 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15162 | |
| 15163 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15164 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15165 | bits = present ? HDA_AMP_MUTE : 0; |
| 15166 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15167 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15168 | } |
| 15169 | |
| 15170 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15171 | { |
| 15172 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15173 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15174 | |
| 15175 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15176 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15177 | bits = present ? HDA_AMP_MUTE : 0; |
| 15178 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15179 | HDA_AMP_MUTE, bits); |
| 15180 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15181 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15182 | } |
| 15183 | |
| 15184 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15185 | unsigned int res) |
| 15186 | { |
| 15187 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15188 | alc662_lenovo_101e_all_automute(codec); |
| 15189 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15190 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15191 | } |
| 15192 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15193 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15194 | { |
| 15195 | unsigned int present; |
| 15196 | |
| 15197 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15198 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15199 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15200 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15201 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15202 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15203 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15204 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15205 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15206 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15207 | } |
| 15208 | |
| 15209 | /* unsolicited event for HP jack sensing */ |
| 15210 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15211 | unsigned int res) |
| 15212 | { |
| 15213 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15214 | alc262_hippo1_automute( codec ); |
| 15215 | |
| 15216 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15217 | alc662_eeepc_mic_automute(codec); |
| 15218 | } |
| 15219 | |
| 15220 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15221 | { |
| 15222 | alc262_hippo1_automute( codec ); |
| 15223 | alc662_eeepc_mic_automute(codec); |
| 15224 | } |
| 15225 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15226 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 15227 | { |
| 15228 | unsigned int mute; |
| 15229 | unsigned int present; |
| 15230 | |
| 15231 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 15232 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15233 | AC_VERB_GET_PIN_SENSE, 0); |
| 15234 | present = (present & 0x80000000) != 0; |
| 15235 | if (present) { |
| 15236 | /* mute internal speaker */ |
| 15237 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15238 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15239 | } else { |
| 15240 | /* unmute internal speaker if necessary */ |
| 15241 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 15242 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15243 | HDA_AMP_MUTE, mute); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15244 | } |
| 15245 | } |
| 15246 | |
| 15247 | /* unsolicited event for HP jack sensing */ |
| 15248 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 15249 | unsigned int res) |
| 15250 | { |
| 15251 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15252 | alc662_eeepc_ep20_automute(codec); |
| 15253 | } |
| 15254 | |
| 15255 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15256 | { |
| 15257 | alc662_eeepc_ep20_automute(codec); |
| 15258 | } |
| 15259 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15260 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15261 | { |
| 15262 | unsigned int present; |
| 15263 | unsigned char bits; |
| 15264 | |
| 15265 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15266 | AC_VERB_GET_PIN_SENSE, 0) |
| 15267 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15268 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15269 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15270 | AMP_IN_MUTE(0), bits); |
| 15271 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15272 | AMP_IN_MUTE(0), bits); |
| 15273 | } |
| 15274 | |
| 15275 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15276 | { |
| 15277 | unsigned int present; |
| 15278 | unsigned char bits; |
| 15279 | |
| 15280 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15281 | AC_VERB_GET_PIN_SENSE, 0) |
| 15282 | & AC_PINSENSE_PRESENCE; |
| 15283 | bits = present ? HDA_AMP_MUTE : 0; |
| 15284 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15285 | AMP_IN_MUTE(0), bits); |
| 15286 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15287 | AMP_IN_MUTE(0), bits); |
| 15288 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15289 | AMP_IN_MUTE(0), bits); |
| 15290 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15291 | AMP_IN_MUTE(0), bits); |
| 15292 | } |
| 15293 | |
| 15294 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15295 | { |
| 15296 | unsigned int present; |
| 15297 | unsigned char bits; |
| 15298 | |
| 15299 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15300 | AC_VERB_GET_PIN_SENSE, 0) |
| 15301 | & AC_PINSENSE_PRESENCE; |
| 15302 | bits = present ? HDA_AMP_MUTE : 0; |
| 15303 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15304 | AMP_IN_MUTE(0), bits); |
| 15305 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15306 | AMP_IN_MUTE(0), bits); |
| 15307 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15308 | AMP_IN_MUTE(0), bits); |
| 15309 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15310 | AMP_IN_MUTE(0), bits); |
| 15311 | } |
| 15312 | |
| 15313 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 15314 | { |
| 15315 | unsigned int present; |
| 15316 | unsigned char bits; |
| 15317 | |
| 15318 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15319 | AC_VERB_GET_PIN_SENSE, 0) |
| 15320 | & AC_PINSENSE_PRESENCE; |
| 15321 | bits = present ? 0 : PIN_OUT; |
| 15322 | snd_hda_codec_write(codec, 0x14, 0, |
| 15323 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 15324 | } |
| 15325 | |
| 15326 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 15327 | { |
| 15328 | unsigned int present1, present2; |
| 15329 | |
| 15330 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 15331 | AC_VERB_GET_PIN_SENSE, 0) |
| 15332 | & AC_PINSENSE_PRESENCE; |
| 15333 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15334 | AC_VERB_GET_PIN_SENSE, 0) |
| 15335 | & AC_PINSENSE_PRESENCE; |
| 15336 | |
| 15337 | if (present1 || present2) { |
| 15338 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15339 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 15340 | } else { |
| 15341 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 15342 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 15343 | } |
| 15344 | } |
| 15345 | |
| 15346 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 15347 | { |
| 15348 | unsigned int present1, present2; |
| 15349 | |
| 15350 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 15351 | AC_VERB_GET_PIN_SENSE, 0) |
| 15352 | & AC_PINSENSE_PRESENCE; |
| 15353 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 15354 | AC_VERB_GET_PIN_SENSE, 0) |
| 15355 | & AC_PINSENSE_PRESENCE; |
| 15356 | |
| 15357 | if (present1 || present2) { |
| 15358 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15359 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15360 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15361 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 15362 | } else { |
| 15363 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15364 | AMP_IN_MUTE(0), 0); |
| 15365 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15366 | AMP_IN_MUTE(0), 0); |
| 15367 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15368 | } |
| 15369 | |
| 15370 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 15371 | { |
| 15372 | unsigned int present; |
| 15373 | |
| 15374 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15375 | AC_VERB_GET_PIN_SENSE, 0) |
| 15376 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15377 | 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] | 15378 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15379 | 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] | 15380 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15381 | 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] | 15382 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15383 | 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] | 15384 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15385 | } |
| 15386 | |
| 15387 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 15388 | unsigned int res) |
| 15389 | { |
| 15390 | switch (res >> 26) { |
| 15391 | case ALC880_HP_EVENT: |
| 15392 | alc663_m51va_speaker_automute(codec); |
| 15393 | break; |
| 15394 | case ALC880_MIC_EVENT: |
| 15395 | alc663_m51va_mic_automute(codec); |
| 15396 | break; |
| 15397 | } |
| 15398 | } |
| 15399 | |
| 15400 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 15401 | { |
| 15402 | alc663_m51va_speaker_automute(codec); |
| 15403 | alc663_m51va_mic_automute(codec); |
| 15404 | } |
| 15405 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15406 | /* ***************** Mode1 ******************************/ |
| 15407 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 15408 | unsigned int res) |
| 15409 | { |
| 15410 | switch (res >> 26) { |
| 15411 | case ALC880_HP_EVENT: |
| 15412 | alc663_m51va_speaker_automute(codec); |
| 15413 | break; |
| 15414 | case ALC880_MIC_EVENT: |
| 15415 | alc662_eeepc_mic_automute(codec); |
| 15416 | break; |
| 15417 | } |
| 15418 | } |
| 15419 | |
| 15420 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 15421 | { |
| 15422 | alc663_m51va_speaker_automute(codec); |
| 15423 | alc662_eeepc_mic_automute(codec); |
| 15424 | } |
| 15425 | /* ***************** Mode2 ******************************/ |
| 15426 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 15427 | unsigned int res) |
| 15428 | { |
| 15429 | switch (res >> 26) { |
| 15430 | case ALC880_HP_EVENT: |
| 15431 | alc662_f5z_speaker_automute(codec); |
| 15432 | break; |
| 15433 | case ALC880_MIC_EVENT: |
| 15434 | alc662_eeepc_mic_automute(codec); |
| 15435 | break; |
| 15436 | } |
| 15437 | } |
| 15438 | |
| 15439 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 15440 | { |
| 15441 | alc662_f5z_speaker_automute(codec); |
| 15442 | alc662_eeepc_mic_automute(codec); |
| 15443 | } |
| 15444 | /* ***************** Mode3 ******************************/ |
| 15445 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 15446 | unsigned int res) |
| 15447 | { |
| 15448 | switch (res >> 26) { |
| 15449 | case ALC880_HP_EVENT: |
| 15450 | alc663_two_hp_m1_speaker_automute(codec); |
| 15451 | break; |
| 15452 | case ALC880_MIC_EVENT: |
| 15453 | alc662_eeepc_mic_automute(codec); |
| 15454 | break; |
| 15455 | } |
| 15456 | } |
| 15457 | |
| 15458 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 15459 | { |
| 15460 | alc663_two_hp_m1_speaker_automute(codec); |
| 15461 | alc662_eeepc_mic_automute(codec); |
| 15462 | } |
| 15463 | /* ***************** Mode4 ******************************/ |
| 15464 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 15465 | unsigned int res) |
| 15466 | { |
| 15467 | switch (res >> 26) { |
| 15468 | case ALC880_HP_EVENT: |
| 15469 | alc663_21jd_two_speaker_automute(codec); |
| 15470 | break; |
| 15471 | case ALC880_MIC_EVENT: |
| 15472 | alc662_eeepc_mic_automute(codec); |
| 15473 | break; |
| 15474 | } |
| 15475 | } |
| 15476 | |
| 15477 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 15478 | { |
| 15479 | alc663_21jd_two_speaker_automute(codec); |
| 15480 | alc662_eeepc_mic_automute(codec); |
| 15481 | } |
| 15482 | /* ***************** Mode5 ******************************/ |
| 15483 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 15484 | unsigned int res) |
| 15485 | { |
| 15486 | switch (res >> 26) { |
| 15487 | case ALC880_HP_EVENT: |
| 15488 | alc663_15jd_two_speaker_automute(codec); |
| 15489 | break; |
| 15490 | case ALC880_MIC_EVENT: |
| 15491 | alc662_eeepc_mic_automute(codec); |
| 15492 | break; |
| 15493 | } |
| 15494 | } |
| 15495 | |
| 15496 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 15497 | { |
| 15498 | alc663_15jd_two_speaker_automute(codec); |
| 15499 | alc662_eeepc_mic_automute(codec); |
| 15500 | } |
| 15501 | /* ***************** Mode6 ******************************/ |
| 15502 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 15503 | unsigned int res) |
| 15504 | { |
| 15505 | switch (res >> 26) { |
| 15506 | case ALC880_HP_EVENT: |
| 15507 | alc663_two_hp_m2_speaker_automute(codec); |
| 15508 | break; |
| 15509 | case ALC880_MIC_EVENT: |
| 15510 | alc662_eeepc_mic_automute(codec); |
| 15511 | break; |
| 15512 | } |
| 15513 | } |
| 15514 | |
| 15515 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 15516 | { |
| 15517 | alc663_two_hp_m2_speaker_automute(codec); |
| 15518 | alc662_eeepc_mic_automute(codec); |
| 15519 | } |
| 15520 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15521 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 15522 | { |
| 15523 | unsigned int present; |
| 15524 | unsigned char bits; |
| 15525 | |
| 15526 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15527 | AC_VERB_GET_PIN_SENSE, 0) |
| 15528 | & AC_PINSENSE_PRESENCE; |
| 15529 | bits = present ? HDA_AMP_MUTE : 0; |
| 15530 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15531 | HDA_AMP_MUTE, bits); |
| 15532 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15533 | HDA_AMP_MUTE, bits); |
| 15534 | } |
| 15535 | |
| 15536 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 15537 | { |
| 15538 | unsigned int present; |
| 15539 | unsigned char bits; |
| 15540 | |
| 15541 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15542 | AC_VERB_GET_PIN_SENSE, 0) |
| 15543 | & AC_PINSENSE_PRESENCE; |
| 15544 | bits = present ? HDA_AMP_MUTE : 0; |
| 15545 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15546 | HDA_AMP_MUTE, bits); |
| 15547 | } |
| 15548 | |
| 15549 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 15550 | unsigned int res) |
| 15551 | { |
| 15552 | switch (res >> 26) { |
| 15553 | case ALC880_HP_EVENT: |
| 15554 | alc663_g71v_hp_automute(codec); |
| 15555 | break; |
| 15556 | case ALC880_FRONT_EVENT: |
| 15557 | alc663_g71v_front_automute(codec); |
| 15558 | break; |
| 15559 | case ALC880_MIC_EVENT: |
| 15560 | alc662_eeepc_mic_automute(codec); |
| 15561 | break; |
| 15562 | } |
| 15563 | } |
| 15564 | |
| 15565 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 15566 | { |
| 15567 | alc663_g71v_front_automute(codec); |
| 15568 | alc663_g71v_hp_automute(codec); |
| 15569 | alc662_eeepc_mic_automute(codec); |
| 15570 | } |
| 15571 | |
| 15572 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 15573 | unsigned int res) |
| 15574 | { |
| 15575 | switch (res >> 26) { |
| 15576 | case ALC880_HP_EVENT: |
| 15577 | alc663_m51va_speaker_automute(codec); |
| 15578 | break; |
| 15579 | case ALC880_MIC_EVENT: |
| 15580 | alc662_eeepc_mic_automute(codec); |
| 15581 | break; |
| 15582 | } |
| 15583 | } |
| 15584 | |
| 15585 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 15586 | { |
| 15587 | alc663_m51va_speaker_automute(codec); |
| 15588 | alc662_eeepc_mic_automute(codec); |
| 15589 | } |
| 15590 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15591 | /* bind hp and internal speaker mute (with plug check) */ |
| 15592 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, |
| 15593 | struct snd_ctl_elem_value *ucontrol) |
| 15594 | { |
| 15595 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 15596 | long *valp = ucontrol->value.integer.value; |
| 15597 | int change; |
| 15598 | |
| 15599 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, |
| 15600 | HDA_AMP_MUTE, |
| 15601 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 15602 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, |
| 15603 | HDA_AMP_MUTE, |
| 15604 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 15605 | if (change) |
| 15606 | alc262_hippo1_automute(codec); |
| 15607 | return change; |
| 15608 | } |
| 15609 | |
| 15610 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 15611 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15612 | { |
| 15613 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15614 | .name = "Master Playback Switch", |
| 15615 | .info = snd_hda_mixer_amp_switch_info, |
| 15616 | .get = snd_hda_mixer_amp_switch_get, |
| 15617 | .put = alc662_ecs_master_sw_put, |
| 15618 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15619 | }, |
| 15620 | |
| 15621 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 15622 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15623 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15624 | |
| 15625 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15626 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15627 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15628 | { } /* end */ |
| 15629 | }; |
| 15630 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15631 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15632 | #define alc662_loopbacks alc880_loopbacks |
| 15633 | #endif |
| 15634 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15635 | |
| 15636 | /* pcm configuration: identiacal with ALC880 */ |
| 15637 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 15638 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 15639 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 15640 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 15641 | |
| 15642 | /* |
| 15643 | * configuration and preset |
| 15644 | */ |
| 15645 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 15646 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 15647 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 15648 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 15649 | [ALC662_5ST_DIG] = "6stack-dig", |
| 15650 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 15651 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15652 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15653 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15654 | [ALC663_ASUS_M51VA] = "m51va", |
| 15655 | [ALC663_ASUS_G71V] = "g71v", |
| 15656 | [ALC663_ASUS_H13] = "h13", |
| 15657 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15658 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 15659 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 15660 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 15661 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 15662 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 15663 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15664 | [ALC662_AUTO] = "auto", |
| 15665 | }; |
| 15666 | |
| 15667 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15668 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 15669 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 15670 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15671 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15672 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15673 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 15674 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), |
| 15675 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 15676 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 15677 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 15678 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15679 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 15680 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 15681 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 15682 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15683 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
| 15684 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 15685 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 15686 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
| 15687 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 15688 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15689 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
| 15690 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 15691 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
| 15692 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 15693 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 15694 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
| 15695 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 15696 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 15697 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
| 15698 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
| 15699 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 15700 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
| 15701 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 15702 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 15703 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 15704 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 15705 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 15706 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15707 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15708 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
| 15709 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 15710 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 15711 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15712 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 15713 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 15714 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15715 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 15716 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 15717 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15718 | {} |
| 15719 | }; |
| 15720 | |
| 15721 | static struct alc_config_preset alc662_presets[] = { |
| 15722 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15723 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15724 | .init_verbs = { alc662_init_verbs }, |
| 15725 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15726 | .dac_nids = alc662_dac_nids, |
| 15727 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15728 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15729 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15730 | .channel_mode = alc662_3ST_2ch_modes, |
| 15731 | .input_mux = &alc662_capture_source, |
| 15732 | }, |
| 15733 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15734 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15735 | .init_verbs = { alc662_init_verbs }, |
| 15736 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15737 | .dac_nids = alc662_dac_nids, |
| 15738 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15739 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15740 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15741 | .channel_mode = alc662_3ST_6ch_modes, |
| 15742 | .need_dac_fix = 1, |
| 15743 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15744 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15745 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15746 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15747 | .init_verbs = { alc662_init_verbs }, |
| 15748 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15749 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15750 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15751 | .channel_mode = alc662_3ST_6ch_modes, |
| 15752 | .need_dac_fix = 1, |
| 15753 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15754 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15755 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15756 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15757 | .init_verbs = { alc662_init_verbs }, |
| 15758 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15759 | .dac_nids = alc662_dac_nids, |
| 15760 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15761 | .dig_in_nid = ALC662_DIGIN_NID, |
| 15762 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 15763 | .channel_mode = alc662_5stack_modes, |
| 15764 | .input_mux = &alc662_capture_source, |
| 15765 | }, |
| 15766 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15767 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15768 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 15769 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15770 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15771 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15772 | .channel_mode = alc662_3ST_2ch_modes, |
| 15773 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15774 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 15775 | .init_hook = alc662_lenovo_101e_all_automute, |
| 15776 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15777 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15778 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15779 | .init_verbs = { alc662_init_verbs, |
| 15780 | alc662_eeepc_sue_init_verbs }, |
| 15781 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15782 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15783 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15784 | .channel_mode = alc662_3ST_2ch_modes, |
| 15785 | .input_mux = &alc662_eeepc_capture_source, |
| 15786 | .unsol_event = alc662_eeepc_unsol_event, |
| 15787 | .init_hook = alc662_eeepc_inithook, |
| 15788 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15789 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15790 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15791 | alc662_chmode_mixer }, |
| 15792 | .init_verbs = { alc662_init_verbs, |
| 15793 | alc662_eeepc_ep20_sue_init_verbs }, |
| 15794 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15795 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15796 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15797 | .channel_mode = alc662_3ST_6ch_modes, |
| 15798 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 15799 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 15800 | .init_hook = alc662_eeepc_ep20_inithook, |
| 15801 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15802 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15803 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15804 | .init_verbs = { alc662_init_verbs, |
| 15805 | alc662_ecs_init_verbs }, |
| 15806 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15807 | .dac_nids = alc662_dac_nids, |
| 15808 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15809 | .channel_mode = alc662_3ST_2ch_modes, |
| 15810 | .input_mux = &alc662_eeepc_capture_source, |
| 15811 | .unsol_event = alc662_eeepc_unsol_event, |
| 15812 | .init_hook = alc662_eeepc_inithook, |
| 15813 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15814 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15815 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15816 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15817 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15818 | .dac_nids = alc662_dac_nids, |
| 15819 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15820 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15821 | .channel_mode = alc662_3ST_2ch_modes, |
| 15822 | .input_mux = &alc663_m51va_capture_source, |
| 15823 | .unsol_event = alc663_m51va_unsol_event, |
| 15824 | .init_hook = alc663_m51va_inithook, |
| 15825 | }, |
| 15826 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15827 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15828 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 15829 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15830 | .dac_nids = alc662_dac_nids, |
| 15831 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15832 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15833 | .channel_mode = alc662_3ST_2ch_modes, |
| 15834 | .input_mux = &alc662_eeepc_capture_source, |
| 15835 | .unsol_event = alc663_g71v_unsol_event, |
| 15836 | .init_hook = alc663_g71v_inithook, |
| 15837 | }, |
| 15838 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15839 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15840 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 15841 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15842 | .dac_nids = alc662_dac_nids, |
| 15843 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15844 | .channel_mode = alc662_3ST_2ch_modes, |
| 15845 | .input_mux = &alc663_m51va_capture_source, |
| 15846 | .unsol_event = alc663_m51va_unsol_event, |
| 15847 | .init_hook = alc663_m51va_inithook, |
| 15848 | }, |
| 15849 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15850 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15851 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 15852 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15853 | .dac_nids = alc662_dac_nids, |
| 15854 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15855 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 15856 | .channel_mode = alc662_3ST_6ch_modes, |
| 15857 | .input_mux = &alc663_capture_source, |
| 15858 | .unsol_event = alc663_g50v_unsol_event, |
| 15859 | .init_hook = alc663_g50v_inithook, |
| 15860 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15861 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15862 | .mixers = { alc663_m51va_mixer }, |
| 15863 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15864 | .init_verbs = { alc662_init_verbs, |
| 15865 | alc663_21jd_amic_init_verbs }, |
| 15866 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15867 | .hp_nid = 0x03, |
| 15868 | .dac_nids = alc662_dac_nids, |
| 15869 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15870 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15871 | .channel_mode = alc662_3ST_2ch_modes, |
| 15872 | .input_mux = &alc662_eeepc_capture_source, |
| 15873 | .unsol_event = alc663_mode1_unsol_event, |
| 15874 | .init_hook = alc663_mode1_inithook, |
| 15875 | }, |
| 15876 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15877 | .mixers = { alc662_1bjd_mixer }, |
| 15878 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15879 | .init_verbs = { alc662_init_verbs, |
| 15880 | alc662_1bjd_amic_init_verbs }, |
| 15881 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15882 | .dac_nids = alc662_dac_nids, |
| 15883 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15884 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15885 | .channel_mode = alc662_3ST_2ch_modes, |
| 15886 | .input_mux = &alc662_eeepc_capture_source, |
| 15887 | .unsol_event = alc662_mode2_unsol_event, |
| 15888 | .init_hook = alc662_mode2_inithook, |
| 15889 | }, |
| 15890 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15891 | .mixers = { alc663_two_hp_m1_mixer }, |
| 15892 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15893 | .init_verbs = { alc662_init_verbs, |
| 15894 | alc663_two_hp_amic_m1_init_verbs }, |
| 15895 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15896 | .hp_nid = 0x03, |
| 15897 | .dac_nids = alc662_dac_nids, |
| 15898 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15899 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15900 | .channel_mode = alc662_3ST_2ch_modes, |
| 15901 | .input_mux = &alc662_eeepc_capture_source, |
| 15902 | .unsol_event = alc663_mode3_unsol_event, |
| 15903 | .init_hook = alc663_mode3_inithook, |
| 15904 | }, |
| 15905 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15906 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 15907 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15908 | .init_verbs = { alc662_init_verbs, |
| 15909 | alc663_21jd_amic_init_verbs}, |
| 15910 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15911 | .hp_nid = 0x03, |
| 15912 | .dac_nids = alc662_dac_nids, |
| 15913 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15914 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15915 | .channel_mode = alc662_3ST_2ch_modes, |
| 15916 | .input_mux = &alc662_eeepc_capture_source, |
| 15917 | .unsol_event = alc663_mode4_unsol_event, |
| 15918 | .init_hook = alc663_mode4_inithook, |
| 15919 | }, |
| 15920 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15921 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 15922 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15923 | .init_verbs = { alc662_init_verbs, |
| 15924 | alc663_15jd_amic_init_verbs }, |
| 15925 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15926 | .hp_nid = 0x03, |
| 15927 | .dac_nids = alc662_dac_nids, |
| 15928 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15929 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15930 | .channel_mode = alc662_3ST_2ch_modes, |
| 15931 | .input_mux = &alc662_eeepc_capture_source, |
| 15932 | .unsol_event = alc663_mode5_unsol_event, |
| 15933 | .init_hook = alc663_mode5_inithook, |
| 15934 | }, |
| 15935 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15936 | .mixers = { alc663_two_hp_m2_mixer }, |
| 15937 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15938 | .init_verbs = { alc662_init_verbs, |
| 15939 | alc663_two_hp_amic_m2_init_verbs }, |
| 15940 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 15941 | .hp_nid = 0x03, |
| 15942 | .dac_nids = alc662_dac_nids, |
| 15943 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 15944 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 15945 | .channel_mode = alc662_3ST_2ch_modes, |
| 15946 | .input_mux = &alc662_eeepc_capture_source, |
| 15947 | .unsol_event = alc663_mode6_unsol_event, |
| 15948 | .init_hook = alc663_mode6_inithook, |
| 15949 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15950 | }; |
| 15951 | |
| 15952 | |
| 15953 | /* |
| 15954 | * BIOS auto configuration |
| 15955 | */ |
| 15956 | |
| 15957 | /* add playback controls from the parsed DAC table */ |
| 15958 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15959 | const struct auto_pin_cfg *cfg) |
| 15960 | { |
| 15961 | char name[32]; |
| 15962 | static const char *chname[4] = { |
| 15963 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15964 | }; |
| 15965 | hda_nid_t nid; |
| 15966 | int i, err; |
| 15967 | |
| 15968 | for (i = 0; i < cfg->line_outs; i++) { |
| 15969 | if (!spec->multiout.dac_nids[i]) |
| 15970 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15971 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15972 | if (i == 2) { |
| 15973 | /* Center/LFE */ |
| 15974 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15975 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15976 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 15977 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15978 | if (err < 0) |
| 15979 | return err; |
| 15980 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15981 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15982 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 15983 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15984 | if (err < 0) |
| 15985 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15986 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15987 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15988 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15989 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15990 | if (err < 0) |
| 15991 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15992 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15993 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 15994 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15995 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15996 | if (err < 0) |
| 15997 | return err; |
| 15998 | } else { |
| 15999 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16000 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16001 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16002 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16003 | if (err < 0) |
| 16004 | return err; |
| 16005 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16006 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16007 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16008 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16009 | if (err < 0) |
| 16010 | return err; |
| 16011 | } |
| 16012 | } |
| 16013 | return 0; |
| 16014 | } |
| 16015 | |
| 16016 | /* add playback controls for speaker and HP outputs */ |
| 16017 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16018 | const char *pfx) |
| 16019 | { |
| 16020 | hda_nid_t nid; |
| 16021 | int err; |
| 16022 | char name[32]; |
| 16023 | |
| 16024 | if (!pin) |
| 16025 | return 0; |
| 16026 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16027 | if (pin == 0x17) { |
| 16028 | /* ALC663 has a mono output pin on 0x17 */ |
| 16029 | sprintf(name, "%s Playback Switch", pfx); |
| 16030 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16031 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16032 | return err; |
| 16033 | } |
| 16034 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16035 | if (alc880_is_fixed_pin(pin)) { |
| 16036 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16037 | /* printk("DAC nid=%x\n",nid); */ |
| 16038 | /* specify the DAC as the extra output */ |
| 16039 | if (!spec->multiout.hp_nid) |
| 16040 | spec->multiout.hp_nid = nid; |
| 16041 | else |
| 16042 | spec->multiout.extra_out_nid[0] = nid; |
| 16043 | /* control HP volume/switch on the output mixer amp */ |
| 16044 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16045 | sprintf(name, "%s Playback Volume", pfx); |
| 16046 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16047 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16048 | if (err < 0) |
| 16049 | return err; |
| 16050 | sprintf(name, "%s Playback Switch", pfx); |
| 16051 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16052 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16053 | if (err < 0) |
| 16054 | return err; |
| 16055 | } else if (alc880_is_multi_pin(pin)) { |
| 16056 | /* set manual connection */ |
| 16057 | /* we have only a switch on HP-out PIN */ |
| 16058 | sprintf(name, "%s Playback Switch", pfx); |
| 16059 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16060 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16061 | if (err < 0) |
| 16062 | return err; |
| 16063 | } |
| 16064 | return 0; |
| 16065 | } |
| 16066 | |
| 16067 | /* create playback/capture controls for input pins */ |
| 16068 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 16069 | const struct auto_pin_cfg *cfg) |
| 16070 | { |
| 16071 | struct hda_input_mux *imux = &spec->private_imux; |
| 16072 | int i, err, idx; |
| 16073 | |
| 16074 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16075 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 16076 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 16077 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16078 | auto_pin_cfg_labels[i], |
| 16079 | idx, 0x0b); |
| 16080 | if (err < 0) |
| 16081 | return err; |
| 16082 | imux->items[imux->num_items].label = |
| 16083 | auto_pin_cfg_labels[i]; |
| 16084 | imux->items[imux->num_items].index = |
| 16085 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 16086 | imux->num_items++; |
| 16087 | } |
| 16088 | } |
| 16089 | return 0; |
| 16090 | } |
| 16091 | |
| 16092 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16093 | hda_nid_t nid, int pin_type, |
| 16094 | int dac_idx) |
| 16095 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16096 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16097 | /* need the manual connection? */ |
| 16098 | if (alc880_is_multi_pin(nid)) { |
| 16099 | struct alc_spec *spec = codec->spec; |
| 16100 | int idx = alc880_multi_pin_idx(nid); |
| 16101 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16102 | AC_VERB_SET_CONNECT_SEL, |
| 16103 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16104 | } |
| 16105 | } |
| 16106 | |
| 16107 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16108 | { |
| 16109 | struct alc_spec *spec = codec->spec; |
| 16110 | int i; |
| 16111 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16112 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16113 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16114 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16115 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16116 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16117 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16118 | i); |
| 16119 | } |
| 16120 | } |
| 16121 | |
| 16122 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16123 | { |
| 16124 | struct alc_spec *spec = codec->spec; |
| 16125 | hda_nid_t pin; |
| 16126 | |
| 16127 | pin = spec->autocfg.hp_pins[0]; |
| 16128 | if (pin) /* connect to front */ |
| 16129 | /* use dac 0 */ |
| 16130 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16131 | pin = spec->autocfg.speaker_pins[0]; |
| 16132 | if (pin) |
| 16133 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16134 | } |
| 16135 | |
| 16136 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 16137 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16138 | |
| 16139 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16140 | { |
| 16141 | struct alc_spec *spec = codec->spec; |
| 16142 | int i; |
| 16143 | |
| 16144 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16145 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 16146 | if (alc662_is_input_pin(nid)) { |
| 16147 | snd_hda_codec_write(codec, nid, 0, |
| 16148 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16149 | (i <= AUTO_PIN_FRONT_MIC ? |
| 16150 | PIN_VREF80 : PIN_IN)); |
| 16151 | if (nid != ALC662_PIN_CD_NID) |
| 16152 | snd_hda_codec_write(codec, nid, 0, |
| 16153 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16154 | AMP_OUT_MUTE); |
| 16155 | } |
| 16156 | } |
| 16157 | } |
| 16158 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16159 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16160 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16161 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16162 | { |
| 16163 | struct alc_spec *spec = codec->spec; |
| 16164 | int err; |
| 16165 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16166 | |
| 16167 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16168 | alc662_ignore); |
| 16169 | if (err < 0) |
| 16170 | return err; |
| 16171 | if (!spec->autocfg.line_outs) |
| 16172 | return 0; /* can't find valid BIOS pin config */ |
| 16173 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16174 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16175 | if (err < 0) |
| 16176 | return err; |
| 16177 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16178 | if (err < 0) |
| 16179 | return err; |
| 16180 | err = alc662_auto_create_extra_out(spec, |
| 16181 | spec->autocfg.speaker_pins[0], |
| 16182 | "Speaker"); |
| 16183 | if (err < 0) |
| 16184 | return err; |
| 16185 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16186 | "Headphone"); |
| 16187 | if (err < 0) |
| 16188 | return err; |
| 16189 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 16190 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16191 | return err; |
| 16192 | |
| 16193 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16194 | |
| 16195 | if (spec->autocfg.dig_out_pin) |
| 16196 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16197 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16198 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16199 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16200 | |
| 16201 | spec->num_mux_defs = 1; |
| 16202 | spec->input_mux = &spec->private_imux; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16203 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16204 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16205 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16206 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16207 | |
| 16208 | err = alc_auto_add_mic_boost(codec); |
| 16209 | if (err < 0) |
| 16210 | return err; |
| 16211 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 16212 | store_pin_configs(codec); |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16213 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16214 | } |
| 16215 | |
| 16216 | /* additional initialization for auto-configuration model */ |
| 16217 | static void alc662_auto_init(struct hda_codec *codec) |
| 16218 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16219 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16220 | alc662_auto_init_multi_out(codec); |
| 16221 | alc662_auto_init_hp_out(codec); |
| 16222 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16223 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16224 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16225 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16226 | } |
| 16227 | |
| 16228 | static int patch_alc662(struct hda_codec *codec) |
| 16229 | { |
| 16230 | struct alc_spec *spec; |
| 16231 | int err, board_config; |
| 16232 | |
| 16233 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16234 | if (!spec) |
| 16235 | return -ENOMEM; |
| 16236 | |
| 16237 | codec->spec = spec; |
| 16238 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 16239 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 16240 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16241 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 16242 | alc662_models, |
| 16243 | alc662_cfg_tbl); |
| 16244 | if (board_config < 0) { |
| 16245 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 16246 | "trying auto-probe from BIOS...\n"); |
| 16247 | board_config = ALC662_AUTO; |
| 16248 | } |
| 16249 | |
| 16250 | if (board_config == ALC662_AUTO) { |
| 16251 | /* automatic parse from the BIOS config */ |
| 16252 | err = alc662_parse_auto_config(codec); |
| 16253 | if (err < 0) { |
| 16254 | alc_free(codec); |
| 16255 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16256 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16257 | printk(KERN_INFO |
| 16258 | "hda_codec: Cannot set up configuration " |
| 16259 | "from BIOS. Using base mode...\n"); |
| 16260 | board_config = ALC662_3ST_2ch_DIG; |
| 16261 | } |
| 16262 | } |
| 16263 | |
| 16264 | if (board_config != ALC662_AUTO) |
| 16265 | setup_preset(spec, &alc662_presets[board_config]); |
| 16266 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16267 | if (codec->vendor_id == 0x10ec0663) { |
| 16268 | spec->stream_name_analog = "ALC663 Analog"; |
| 16269 | spec->stream_name_digital = "ALC663 Digital"; |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16270 | } else if (codec->vendor_id == 0x10ec0272) { |
| 16271 | spec->stream_name_analog = "ALC272 Analog"; |
| 16272 | spec->stream_name_digital = "ALC272 Digital"; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16273 | } else { |
| 16274 | spec->stream_name_analog = "ALC662 Analog"; |
| 16275 | spec->stream_name_digital = "ALC662 Digital"; |
| 16276 | } |
| 16277 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16278 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 16279 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 16280 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16281 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 16282 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 16283 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16284 | spec->adc_nids = alc662_adc_nids; |
| 16285 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 16286 | spec->capsrc_nids = alc662_capsrc_nids; |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 16287 | spec->is_mix_capture = 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16288 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16289 | if (!spec->cap_mixer) |
| 16290 | set_capture_mixer(spec); |
| 16291 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16292 | spec->vmaster_nid = 0x02; |
| 16293 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16294 | codec->patch_ops = alc_patch_ops; |
| 16295 | if (board_config == ALC662_AUTO) |
| 16296 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16297 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16298 | if (!spec->loopback.amplist) |
| 16299 | spec->loopback.amplist = alc662_loopbacks; |
| 16300 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16301 | |
| 16302 | return 0; |
| 16303 | } |
| 16304 | |
| 16305 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16306 | * patch entries |
| 16307 | */ |
| 16308 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 16309 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16310 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16311 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 16312 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16313 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 16314 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16315 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16316 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16317 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 16318 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 16319 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16320 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 16321 | .patch = patch_alc883 }, |
| 16322 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 16323 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16324 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16325 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16326 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16327 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 16328 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
| 16329 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 16330 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 16331 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16332 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | a385a52 | 2008-10-15 11:20:21 +0200 | [diff] [blame] | 16333 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16334 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 16335 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 16336 | .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 16337 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16338 | {} /* terminator */ |
| 16339 | }; |