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" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.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, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 134 | ALC269_ASUS_EEEPC_P703, |
| 135 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 136 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 137 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 138 | ALC269_AUTO, |
| 139 | ALC269_MODEL_LAST /* last tag */ |
| 140 | }; |
| 141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | /* ALC861 models */ |
| 143 | enum { |
| 144 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 145 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | ALC861_3ST_DIG, |
| 147 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 148 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 149 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 150 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 151 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 152 | ALC861_AUTO, |
| 153 | ALC861_MODEL_LAST, |
| 154 | }; |
| 155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | /* ALC861-VD models */ |
| 157 | enum { |
| 158 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 159 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 160 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_3ST, |
| 162 | ALC861VD_3ST_DIG, |
| 163 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 164 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 165 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 166 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 167 | ALC861VD_AUTO, |
| 168 | ALC861VD_MODEL_LAST, |
| 169 | }; |
| 170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | /* ALC662 models */ |
| 172 | enum { |
| 173 | ALC662_3ST_2ch_DIG, |
| 174 | ALC662_3ST_6ch_DIG, |
| 175 | ALC662_3ST_6ch, |
| 176 | ALC662_5ST_DIG, |
| 177 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 179 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 180 | ALC663_ASUS_M51VA, |
| 181 | ALC663_ASUS_G71V, |
| 182 | ALC663_ASUS_H13, |
| 183 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 184 | ALC662_ECS, |
| 185 | ALC663_ASUS_MODE1, |
| 186 | ALC662_ASUS_MODE2, |
| 187 | ALC663_ASUS_MODE3, |
| 188 | ALC663_ASUS_MODE4, |
| 189 | ALC663_ASUS_MODE5, |
| 190 | ALC663_ASUS_MODE6, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 191 | ALC272_DELL, |
| 192 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 193 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 194 | ALC662_AUTO, |
| 195 | ALC662_MODEL_LAST, |
| 196 | }; |
| 197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 198 | /* ALC882 models */ |
| 199 | enum { |
| 200 | ALC882_3ST_DIG, |
| 201 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 202 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 203 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC882_TARGA, |
| 205 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 206 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 207 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 208 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 209 | ALC885_MB5, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 210 | ALC885_IMAC24, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 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, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 217 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 218 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 219 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 220 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 221 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 222 | ALC888_ACER_ASPIRE_8930G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 223 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 224 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 225 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 226 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 227 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 228 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 229 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 230 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 231 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 232 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 233 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 234 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 235 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 236 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 237 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 238 | ALC889A_INTEL, |
| 239 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 240 | ALC888_ASUS_M90V, |
| 241 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 242 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 243 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 244 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 245 | ALC882_AUTO, |
| 246 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 247 | }; |
| 248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 249 | /* for GPIO Poll */ |
| 250 | #define GPIO_MASK 0x03 |
| 251 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 252 | /* extra amp-initialization sequence types */ |
| 253 | enum { |
| 254 | ALC_INIT_NONE, |
| 255 | ALC_INIT_DEFAULT, |
| 256 | ALC_INIT_GPIO1, |
| 257 | ALC_INIT_GPIO2, |
| 258 | ALC_INIT_GPIO3, |
| 259 | }; |
| 260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | struct alc_spec { |
| 262 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 263 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 265 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 266 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 268 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 269 | * don't forget NULL |
| 270 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 271 | */ |
| 272 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 274 | char stream_name_analog[16]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | struct hda_pcm_stream *stream_analog_playback; |
| 276 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 277 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 278 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 280 | char stream_name_digital[16]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | struct hda_pcm_stream *stream_digital_playback; |
| 282 | struct hda_pcm_stream *stream_digital_capture; |
| 283 | |
| 284 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 285 | struct hda_multi_out multiout; /* playback set-up |
| 286 | * max_channels, dacs must be set |
| 287 | * dig_out_nid and hp_nid are optional |
| 288 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 289 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 290 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 291 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
| 293 | /* capture */ |
| 294 | unsigned int num_adc_nids; |
| 295 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 296 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 297 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | |
| 299 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 300 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | const struct hda_input_mux *input_mux; |
| 302 | unsigned int cur_mux[3]; |
| 303 | |
| 304 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 305 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 307 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 308 | int const_channel_count; |
| 309 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | |
| 311 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 312 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 313 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 314 | /* dynamic controls, init_verbs and input_mux */ |
| 315 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 316 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 317 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 318 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 319 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 320 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 321 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 322 | /* hooks */ |
| 323 | void (*init_hook)(struct hda_codec *codec); |
| 324 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 325 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 326 | /* for pin sensing */ |
| 327 | unsigned int sense_updated: 1; |
| 328 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 329 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 330 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 331 | /* other flags */ |
| 332 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 333 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 334 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 335 | /* for virtual master */ |
| 336 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 337 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 338 | struct hda_loopback_check loopback; |
| 339 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 340 | |
| 341 | /* for PLL fix */ |
| 342 | hda_nid_t pll_nid; |
| 343 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 344 | }; |
| 345 | |
| 346 | /* |
| 347 | * configuration template - to be copied to the spec instance |
| 348 | */ |
| 349 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 350 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 351 | * with spec |
| 352 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 353 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 354 | const struct hda_verb *init_verbs[5]; |
| 355 | unsigned int num_dacs; |
| 356 | hda_nid_t *dac_nids; |
| 357 | hda_nid_t dig_out_nid; /* optional */ |
| 358 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 359 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 360 | unsigned int num_adc_nids; |
| 361 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 362 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 363 | hda_nid_t dig_in_nid; |
| 364 | unsigned int num_channel_mode; |
| 365 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 366 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 367 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 368 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 369 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 370 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 371 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 373 | struct hda_amp_list *loopbacks; |
| 374 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | }; |
| 376 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | |
| 378 | /* |
| 379 | * input MUX handling |
| 380 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 381 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 382 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | { |
| 384 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 385 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 386 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 387 | if (mux_idx >= spec->num_mux_defs) |
| 388 | mux_idx = 0; |
| 389 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 392 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 393 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | { |
| 395 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 396 | struct alc_spec *spec = codec->spec; |
| 397 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 398 | |
| 399 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 400 | return 0; |
| 401 | } |
| 402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 403 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 404 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | { |
| 406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 407 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 408 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 410 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 411 | hda_nid_t nid = spec->capsrc_nids ? |
| 412 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 413 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 415 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 416 | imux = &spec->input_mux[mux_idx]; |
| 417 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 418 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 419 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 420 | /* Matrix-mixer style (e.g. ALC882) */ |
| 421 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 422 | unsigned int i, idx; |
| 423 | |
| 424 | idx = ucontrol->value.enumerated.item[0]; |
| 425 | if (idx >= imux->num_items) |
| 426 | idx = imux->num_items - 1; |
| 427 | if (*cur_val == idx) |
| 428 | return 0; |
| 429 | for (i = 0; i < imux->num_items; i++) { |
| 430 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 431 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 432 | imux->items[i].index, |
| 433 | HDA_AMP_MUTE, v); |
| 434 | } |
| 435 | *cur_val = idx; |
| 436 | return 1; |
| 437 | } else { |
| 438 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 439 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 440 | &spec->cur_mux[adc_idx]); |
| 441 | } |
| 442 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 443 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | /* |
| 445 | * channel mode setting |
| 446 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | { |
| 450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 451 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 452 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 453 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 456 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 457 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | { |
| 459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 460 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 461 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 462 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 463 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 467 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | { |
| 469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 470 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 471 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 472 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 473 | &spec->ext_channel_count); |
| 474 | if (err >= 0 && !spec->const_channel_count) { |
| 475 | spec->multiout.max_channels = spec->ext_channel_count; |
| 476 | if (spec->need_dac_fix) |
| 477 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 478 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 479 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | } |
| 481 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | * 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] | 484 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | * being part of a format specifier. Maximum allowed length of a value is |
| 486 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 487 | * |
| 488 | * Note: some retasking pin complexes seem to ignore requests for input |
| 489 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 490 | * are requested. Therefore order this list so that this behaviour will not |
| 491 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 492 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 493 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 494 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 495 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 496 | "Mic 50pc bias", "Mic 80pc bias", |
| 497 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | }; |
| 499 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 500 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 501 | }; |
| 502 | /* 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] | 503 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 504 | * addition, "input" pins may or may not process the mic bias option |
| 505 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 506 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 507 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 509 | #define ALC_PIN_DIR_IN 0x00 |
| 510 | #define ALC_PIN_DIR_OUT 0x01 |
| 511 | #define ALC_PIN_DIR_INOUT 0x02 |
| 512 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 513 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 515 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 516 | * For each direction the minimum and maximum values are given. |
| 517 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 518 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 520 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 521 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 522 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 523 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 524 | }; |
| 525 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 526 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 527 | #define alc_pin_mode_n_items(_dir) \ |
| 528 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 529 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 531 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 532 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | unsigned int item_num = uinfo->value.enumerated.item; |
| 534 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 535 | |
| 536 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 539 | |
| 540 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 541 | item_num = alc_pin_mode_min(dir); |
| 542 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 543 | return 0; |
| 544 | } |
| 545 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 547 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 548 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 549 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 550 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 551 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 553 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 554 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 555 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 556 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 557 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | /* Find enumerated value for current pinctl setting */ |
| 559 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | 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] | 561 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | *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] | 563 | return 0; |
| 564 | } |
| 565 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 566 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 567 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 568 | { |
| 569 | signed int change; |
| 570 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 571 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 572 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 573 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 575 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 576 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 578 | 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] | 579 | val = alc_pin_mode_min(dir); |
| 580 | |
| 581 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 582 | if (change) { |
| 583 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 584 | snd_hda_codec_write_cache(codec, nid, 0, |
| 585 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 586 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 588 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 589 | * for the requested pin mode. Enum values of 2 or less are |
| 590 | * input modes. |
| 591 | * |
| 592 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 593 | * reduces noise slightly (particularly on input) so we'll |
| 594 | * do it. However, having both input and output buffers |
| 595 | * enabled simultaneously doesn't seem to be problematic if |
| 596 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 597 | */ |
| 598 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 599 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 600 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 601 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 602 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 603 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 604 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 605 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 606 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 607 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 608 | } |
| 609 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 610 | return change; |
| 611 | } |
| 612 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 613 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 614 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 615 | .info = alc_pin_mode_info, \ |
| 616 | .get = alc_pin_mode_get, \ |
| 617 | .put = alc_pin_mode_put, \ |
| 618 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 619 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 620 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 621 | * together using a mask with more than one bit set. This control is |
| 622 | * currently used only by the ALC260 test model. At this stage they are not |
| 623 | * needed for any "production" models. |
| 624 | */ |
| 625 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 626 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 627 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 628 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 629 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 630 | { |
| 631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 632 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 633 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 634 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 635 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 636 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 637 | |
| 638 | *valp = (val & mask) != 0; |
| 639 | return 0; |
| 640 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 641 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 642 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 643 | { |
| 644 | signed int change; |
| 645 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 646 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 647 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 648 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 650 | AC_VERB_GET_GPIO_DATA, |
| 651 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 652 | |
| 653 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 654 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 655 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 656 | gpio_data &= ~mask; |
| 657 | else |
| 658 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 659 | snd_hda_codec_write_cache(codec, nid, 0, |
| 660 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 661 | |
| 662 | return change; |
| 663 | } |
| 664 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 665 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 666 | .info = alc_gpio_data_info, \ |
| 667 | .get = alc_gpio_data_get, \ |
| 668 | .put = alc_gpio_data_put, \ |
| 669 | .private_value = nid | (mask<<16) } |
| 670 | #endif /* CONFIG_SND_DEBUG */ |
| 671 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 672 | /* A switch control to allow the enabling of the digital IO pins on the |
| 673 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 674 | * to provide something in the test model allowing digital outputs to be |
| 675 | * identified if present. If models are found which can utilise these |
| 676 | * outputs a more complete mixer control can be devised for those models if |
| 677 | * necessary. |
| 678 | */ |
| 679 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 680 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 681 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 682 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 683 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 684 | { |
| 685 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 686 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 687 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 688 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 689 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 690 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 691 | |
| 692 | *valp = (val & mask) != 0; |
| 693 | return 0; |
| 694 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 695 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 696 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 697 | { |
| 698 | signed int change; |
| 699 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 700 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 701 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 702 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 704 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 706 | |
| 707 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 708 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 709 | if (val==0) |
| 710 | ctrl_data &= ~mask; |
| 711 | else |
| 712 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 713 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 714 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 715 | |
| 716 | return change; |
| 717 | } |
| 718 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 719 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 720 | .info = alc_spdif_ctrl_info, \ |
| 721 | .get = alc_spdif_ctrl_get, \ |
| 722 | .put = alc_spdif_ctrl_put, \ |
| 723 | .private_value = nid | (mask<<16) } |
| 724 | #endif /* CONFIG_SND_DEBUG */ |
| 725 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 726 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 727 | * Again, this is only used in the ALC26x test models to help identify when |
| 728 | * the EAPD line must be asserted for features to work. |
| 729 | */ |
| 730 | #ifdef CONFIG_SND_DEBUG |
| 731 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 732 | |
| 733 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 734 | struct snd_ctl_elem_value *ucontrol) |
| 735 | { |
| 736 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 737 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 738 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 739 | long *valp = ucontrol->value.integer.value; |
| 740 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 741 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 742 | |
| 743 | *valp = (val & mask) != 0; |
| 744 | return 0; |
| 745 | } |
| 746 | |
| 747 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 748 | struct snd_ctl_elem_value *ucontrol) |
| 749 | { |
| 750 | int change; |
| 751 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 752 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 753 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 754 | long val = *ucontrol->value.integer.value; |
| 755 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 756 | AC_VERB_GET_EAPD_BTLENABLE, |
| 757 | 0x00); |
| 758 | |
| 759 | /* Set/unset the masked control bit(s) as needed */ |
| 760 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 761 | if (!val) |
| 762 | ctrl_data &= ~mask; |
| 763 | else |
| 764 | ctrl_data |= mask; |
| 765 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 766 | ctrl_data); |
| 767 | |
| 768 | return change; |
| 769 | } |
| 770 | |
| 771 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 772 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 773 | .info = alc_eapd_ctrl_info, \ |
| 774 | .get = alc_eapd_ctrl_get, \ |
| 775 | .put = alc_eapd_ctrl_put, \ |
| 776 | .private_value = nid | (mask<<16) } |
| 777 | #endif /* CONFIG_SND_DEBUG */ |
| 778 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 779 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 780 | * set up the input pin config (depending on the given auto-pin type) |
| 781 | */ |
| 782 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 783 | int auto_pin_type) |
| 784 | { |
| 785 | unsigned int val = PIN_IN; |
| 786 | |
| 787 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 788 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 789 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 790 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 791 | if (pincap & AC_PINCAP_VREF_80) |
| 792 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 793 | else if (pincap & AC_PINCAP_VREF_50) |
| 794 | val = PIN_VREF50; |
| 795 | else if (pincap & AC_PINCAP_VREF_100) |
| 796 | val = PIN_VREF100; |
| 797 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 798 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 799 | } |
| 800 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 801 | } |
| 802 | |
| 803 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 804 | */ |
| 805 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 806 | { |
| 807 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 808 | return; |
| 809 | spec->mixers[spec->num_mixers++] = mix; |
| 810 | } |
| 811 | |
| 812 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 813 | { |
| 814 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 815 | return; |
| 816 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 817 | } |
| 818 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 819 | #ifdef CONFIG_PROC_FS |
| 820 | /* |
| 821 | * hook for proc |
| 822 | */ |
| 823 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 824 | struct hda_codec *codec, hda_nid_t nid) |
| 825 | { |
| 826 | int coeff; |
| 827 | |
| 828 | if (nid != 0x20) |
| 829 | return; |
| 830 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 831 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 832 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 833 | AC_VERB_GET_COEF_INDEX, 0); |
| 834 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 835 | } |
| 836 | #else |
| 837 | #define print_realtek_coef NULL |
| 838 | #endif |
| 839 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 840 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 841 | * set up from the preset table |
| 842 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 843 | static void setup_preset(struct alc_spec *spec, |
| 844 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 845 | { |
| 846 | int i; |
| 847 | |
| 848 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 849 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 850 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 851 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 852 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 853 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 854 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 855 | spec->channel_mode = preset->channel_mode; |
| 856 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 857 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 858 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 860 | if (preset->const_channel_count) |
| 861 | spec->multiout.max_channels = preset->const_channel_count; |
| 862 | else |
| 863 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 864 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 865 | |
| 866 | spec->multiout.num_dacs = preset->num_dacs; |
| 867 | spec->multiout.dac_nids = preset->dac_nids; |
| 868 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 869 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 870 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 871 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 872 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 873 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 874 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 875 | spec->input_mux = preset->input_mux; |
| 876 | |
| 877 | spec->num_adc_nids = preset->num_adc_nids; |
| 878 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 879 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 880 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 881 | |
| 882 | spec->unsol_event = preset->unsol_event; |
| 883 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 884 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 885 | spec->loopback.amplist = preset->loopbacks; |
| 886 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 887 | } |
| 888 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 889 | /* Enable GPIO mask and set output */ |
| 890 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 891 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 892 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 893 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 894 | { } |
| 895 | }; |
| 896 | |
| 897 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 898 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 899 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 900 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 901 | { } |
| 902 | }; |
| 903 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 904 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 905 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 906 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 907 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 908 | { } |
| 909 | }; |
| 910 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 911 | /* |
| 912 | * Fix hardware PLL issue |
| 913 | * On some codecs, the analog PLL gating control must be off while |
| 914 | * the default value is 1. |
| 915 | */ |
| 916 | static void alc_fix_pll(struct hda_codec *codec) |
| 917 | { |
| 918 | struct alc_spec *spec = codec->spec; |
| 919 | unsigned int val; |
| 920 | |
| 921 | if (!spec->pll_nid) |
| 922 | return; |
| 923 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 924 | spec->pll_coef_idx); |
| 925 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 926 | AC_VERB_GET_PROC_COEF, 0); |
| 927 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 928 | spec->pll_coef_idx); |
| 929 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 930 | val & ~(1 << spec->pll_coef_bit)); |
| 931 | } |
| 932 | |
| 933 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 934 | unsigned int coef_idx, unsigned int coef_bit) |
| 935 | { |
| 936 | struct alc_spec *spec = codec->spec; |
| 937 | spec->pll_nid = nid; |
| 938 | spec->pll_coef_idx = coef_idx; |
| 939 | spec->pll_coef_bit = coef_bit; |
| 940 | alc_fix_pll(codec); |
| 941 | } |
| 942 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 943 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 944 | { |
| 945 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 946 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 947 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 948 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 949 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 950 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 951 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 952 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 953 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 954 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 955 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 956 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 957 | nid = spec->autocfg.speaker_pins[i]; |
| 958 | if (!nid) |
| 959 | break; |
| 960 | snd_hda_codec_write(codec, nid, 0, |
| 961 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 962 | spec->jack_present ? 0 : PIN_OUT); |
| 963 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 964 | } |
| 965 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 966 | #if 0 /* it's broken in some cases -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 967 | static void alc_mic_automute(struct hda_codec *codec) |
| 968 | { |
| 969 | struct alc_spec *spec = codec->spec; |
| 970 | unsigned int present; |
| 971 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 972 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 973 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 974 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 975 | |
| 976 | capsrc_idx_mic = mic_nid - 0x18; |
| 977 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 978 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 979 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 980 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 981 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 982 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 983 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 984 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 985 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 986 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 987 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 988 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 989 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 990 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | /* unsolicited event for HP jack sensing */ |
| 992 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 993 | { |
| 994 | if (codec->vendor_id == 0x10ec0880) |
| 995 | res >>= 28; |
| 996 | else |
| 997 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 998 | switch (res) { |
| 999 | case ALC880_HP_EVENT: |
| 1000 | alc_automute_pin(codec); |
| 1001 | break; |
| 1002 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1003 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1004 | break; |
| 1005 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | static void alc_inithook(struct hda_codec *codec) |
| 1009 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1010 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1011 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1012 | } |
| 1013 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1014 | /* additional initialization for ALC888 variants */ |
| 1015 | static void alc888_coef_init(struct hda_codec *codec) |
| 1016 | { |
| 1017 | unsigned int tmp; |
| 1018 | |
| 1019 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1020 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1021 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
Takashi Iwai | 37db623 | 2009-03-05 09:40:16 +0100 | [diff] [blame] | 1022 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1023 | /* alc888S-VC */ |
| 1024 | snd_hda_codec_read(codec, 0x20, 0, |
| 1025 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1026 | else |
| 1027 | /* alc888-VB */ |
| 1028 | snd_hda_codec_read(codec, 0x20, 0, |
| 1029 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1030 | } |
| 1031 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1032 | static void alc889_coef_init(struct hda_codec *codec) |
| 1033 | { |
| 1034 | unsigned int tmp; |
| 1035 | |
| 1036 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1037 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1038 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1039 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1040 | } |
| 1041 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1042 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1043 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1044 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1045 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1046 | switch (type) { |
| 1047 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1048 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1049 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1050 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1051 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1052 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1053 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1054 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1055 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1056 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1057 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1058 | case 0x10ec0260: |
| 1059 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1060 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1061 | snd_hda_codec_write(codec, 0x10, 0, |
| 1062 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1063 | break; |
| 1064 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1065 | case 0x10ec0267: |
| 1066 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1067 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1068 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1069 | case 0x10ec0660: |
| 1070 | case 0x10ec0662: |
| 1071 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1072 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1073 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1074 | snd_hda_codec_write(codec, 0x14, 0, |
| 1075 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1076 | snd_hda_codec_write(codec, 0x15, 0, |
| 1077 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1078 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1079 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1080 | switch (codec->vendor_id) { |
| 1081 | case 0x10ec0260: |
| 1082 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1083 | AC_VERB_SET_COEF_INDEX, 7); |
| 1084 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1085 | AC_VERB_GET_PROC_COEF, 0); |
| 1086 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1087 | AC_VERB_SET_COEF_INDEX, 7); |
| 1088 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1089 | AC_VERB_SET_PROC_COEF, |
| 1090 | tmp | 0x2010); |
| 1091 | break; |
| 1092 | case 0x10ec0262: |
| 1093 | case 0x10ec0880: |
| 1094 | case 0x10ec0882: |
| 1095 | case 0x10ec0883: |
| 1096 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1097 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1098 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1099 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1100 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1101 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1103 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1104 | case 0x10ec0267: |
| 1105 | case 0x10ec0268: |
| 1106 | snd_hda_codec_write(codec, 0x20, 0, |
| 1107 | AC_VERB_SET_COEF_INDEX, 7); |
| 1108 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1109 | AC_VERB_GET_PROC_COEF, 0); |
| 1110 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1111 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | snd_hda_codec_write(codec, 0x20, 0, |
| 1113 | AC_VERB_SET_PROC_COEF, |
| 1114 | tmp | 0x3000); |
| 1115 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1116 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1117 | break; |
| 1118 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1119 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1120 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1121 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1122 | { |
| 1123 | struct alc_spec *spec = codec->spec; |
| 1124 | |
| 1125 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1127 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1128 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1129 | if (spec->autocfg.line_out_pins[0] && |
| 1130 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1131 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1132 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1133 | else |
| 1134 | return; |
| 1135 | } |
| 1136 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1137 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1138 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1139 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1140 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1141 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1142 | spec->unsol_event = alc_sku_unsol_event; |
| 1143 | } |
| 1144 | |
| 1145 | /* check subsystem ID and set up device-specific initialization; |
| 1146 | * return 1 if initialized, 0 if invalid SSID |
| 1147 | */ |
| 1148 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1149 | * 31 ~ 16 : Manufacture ID |
| 1150 | * 15 ~ 8 : SKU ID |
| 1151 | * 7 ~ 0 : Assembly ID |
| 1152 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1153 | */ |
| 1154 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1155 | hda_nid_t porta, hda_nid_t porte, |
| 1156 | hda_nid_t portd) |
| 1157 | { |
| 1158 | unsigned int ass, tmp, i; |
| 1159 | unsigned nid; |
| 1160 | struct alc_spec *spec = codec->spec; |
| 1161 | |
| 1162 | ass = codec->subsystem_id & 0xffff; |
| 1163 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1164 | goto do_sku; |
| 1165 | |
| 1166 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1167 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1168 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1169 | * 29~21 : reserve |
| 1170 | * 20 : PCBEEP input |
| 1171 | * 19~16 : Check sum (15:1) |
| 1172 | * 15~1 : Custom |
| 1173 | * 0 : override |
| 1174 | */ |
| 1175 | nid = 0x1d; |
| 1176 | if (codec->vendor_id == 0x10ec0260) |
| 1177 | nid = 0x17; |
| 1178 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1179 | snd_printd("realtek: No valid SSID, " |
| 1180 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1181 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1182 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1183 | return 0; |
| 1184 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1185 | return 0; |
| 1186 | |
| 1187 | /* check sum */ |
| 1188 | tmp = 0; |
| 1189 | for (i = 1; i < 16; i++) { |
| 1190 | if ((ass >> i) & 1) |
| 1191 | tmp++; |
| 1192 | } |
| 1193 | if (((ass >> 16) & 0xf) != tmp) |
| 1194 | return 0; |
| 1195 | do_sku: |
| 1196 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1197 | ass & 0xffff, codec->vendor_id); |
| 1198 | /* |
| 1199 | * 0 : override |
| 1200 | * 1 : Swap Jack |
| 1201 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1202 | * 3~5 : External Amplifier control |
| 1203 | * 7~6 : Reserved |
| 1204 | */ |
| 1205 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1206 | switch (tmp) { |
| 1207 | case 1: |
| 1208 | spec->init_amp = ALC_INIT_GPIO1; |
| 1209 | break; |
| 1210 | case 3: |
| 1211 | spec->init_amp = ALC_INIT_GPIO2; |
| 1212 | break; |
| 1213 | case 7: |
| 1214 | spec->init_amp = ALC_INIT_GPIO3; |
| 1215 | break; |
| 1216 | case 5: |
| 1217 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1218 | break; |
| 1219 | } |
| 1220 | |
| 1221 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1222 | * when the external headphone out jack is plugged" |
| 1223 | */ |
| 1224 | if (!(ass & 0x8000)) |
| 1225 | return 1; |
| 1226 | /* |
| 1227 | * 10~8 : Jack location |
| 1228 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1229 | * 14~13: Resvered |
| 1230 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1231 | * when the external headphone out jack is plugged" |
| 1232 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1233 | if (!spec->autocfg.hp_pins[0]) { |
| 1234 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1235 | if (tmp == 0) |
| 1236 | spec->autocfg.hp_pins[0] = porta; |
| 1237 | else if (tmp == 1) |
| 1238 | spec->autocfg.hp_pins[0] = porte; |
| 1239 | else if (tmp == 2) |
| 1240 | spec->autocfg.hp_pins[0] = portd; |
| 1241 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1242 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1243 | } |
| 1244 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1245 | alc_init_auto_hp(codec); |
| 1246 | return 1; |
| 1247 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1248 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1249 | static void alc_ssid_check(struct hda_codec *codec, |
| 1250 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1251 | { |
| 1252 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1253 | struct alc_spec *spec = codec->spec; |
| 1254 | snd_printd("realtek: " |
| 1255 | "Enable default setup for auto mode as fallback\n"); |
| 1256 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1257 | alc_init_auto_hp(codec); |
| 1258 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1259 | } |
| 1260 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1261 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1262 | * Fix-up pin default configurations |
| 1263 | */ |
| 1264 | |
| 1265 | struct alc_pincfg { |
| 1266 | hda_nid_t nid; |
| 1267 | u32 val; |
| 1268 | }; |
| 1269 | |
| 1270 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1271 | const struct snd_pci_quirk *quirk, |
| 1272 | const struct alc_pincfg **pinfix) |
| 1273 | { |
| 1274 | const struct alc_pincfg *cfg; |
| 1275 | |
| 1276 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1277 | if (!quirk) |
| 1278 | return; |
| 1279 | |
| 1280 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1281 | for (; cfg->nid; cfg++) |
| 1282 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1283 | } |
| 1284 | |
| 1285 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1286 | * ALC888 |
| 1287 | */ |
| 1288 | |
| 1289 | /* |
| 1290 | * 2ch mode |
| 1291 | */ |
| 1292 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1293 | /* Mic-in jack as mic in */ |
| 1294 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1295 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1296 | /* Line-in jack as Line in */ |
| 1297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1299 | /* Line-Out as Front */ |
| 1300 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1301 | { } /* end */ |
| 1302 | }; |
| 1303 | |
| 1304 | /* |
| 1305 | * 4ch mode |
| 1306 | */ |
| 1307 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1308 | /* Mic-in jack as mic in */ |
| 1309 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1310 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1311 | /* Line-in jack as Surround */ |
| 1312 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1313 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1314 | /* Line-Out as Front */ |
| 1315 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1316 | { } /* end */ |
| 1317 | }; |
| 1318 | |
| 1319 | /* |
| 1320 | * 6ch mode |
| 1321 | */ |
| 1322 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1323 | /* Mic-in jack as CLFE */ |
| 1324 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1325 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1326 | /* Line-in jack as Surround */ |
| 1327 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1328 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1329 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1330 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1331 | { } /* end */ |
| 1332 | }; |
| 1333 | |
| 1334 | /* |
| 1335 | * 8ch mode |
| 1336 | */ |
| 1337 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1338 | /* Mic-in jack as CLFE */ |
| 1339 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1340 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1341 | /* Line-in jack as Surround */ |
| 1342 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1343 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1344 | /* Line-Out as Side */ |
| 1345 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1346 | { } /* end */ |
| 1347 | }; |
| 1348 | |
| 1349 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1350 | { 2, alc888_4ST_ch2_intel_init }, |
| 1351 | { 4, alc888_4ST_ch4_intel_init }, |
| 1352 | { 6, alc888_4ST_ch6_intel_init }, |
| 1353 | { 8, alc888_4ST_ch8_intel_init }, |
| 1354 | }; |
| 1355 | |
| 1356 | /* |
| 1357 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1358 | */ |
| 1359 | |
| 1360 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1361 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1362 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1363 | /* Connect Internal HP to Front */ |
| 1364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1365 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1366 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1367 | /* Connect Bass HP to Front */ |
| 1368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1371 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1372 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1373 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1374 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1375 | /* Connect Mic jack to CLFE */ |
| 1376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1378 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1379 | /* Connect Line-in jack to Surround */ |
| 1380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1382 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1383 | /* Connect HP out jack to Front */ |
| 1384 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1385 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1386 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1387 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1388 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1389 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1390 | {} |
| 1391 | }; |
| 1392 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1393 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1394 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1395 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1396 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1397 | hda_nid_t nid; |
| 1398 | int i; |
| 1399 | |
| 1400 | spec->jack_present = 0; |
| 1401 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1402 | nid = spec->autocfg.hp_pins[i]; |
| 1403 | if (!nid) |
| 1404 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1405 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1406 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1407 | snd_hda_codec_read(codec, nid, 0, |
| 1408 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1409 | val = snd_hda_codec_read(codec, nid, 0, |
| 1410 | AC_VERB_GET_PIN_SENSE, 0); |
| 1411 | if (val & AC_PINSENSE_PRESENCE) { |
| 1412 | spec->jack_present = 1; |
| 1413 | break; |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1418 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1419 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1420 | nid = spec->autocfg.speaker_pins[i]; |
| 1421 | if (!nid) |
| 1422 | break; |
| 1423 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1424 | HDA_AMP_MUTE, mute); |
| 1425 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1426 | } |
| 1427 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1428 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1429 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1430 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1431 | if (codec->vendor_id == 0x10ec0880) |
| 1432 | res >>= 28; |
| 1433 | else |
| 1434 | res >>= 26; |
| 1435 | if (res == ALC880_HP_EVENT) |
| 1436 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1437 | } |
| 1438 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 1439 | static void alc889_automute_init(struct hda_codec *codec) |
| 1440 | { |
| 1441 | struct alc_spec *spec = codec->spec; |
| 1442 | |
| 1443 | spec->autocfg.hp_pins[0] = 0x15; |
| 1444 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1445 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1446 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1447 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1448 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 1449 | alc_automute_amp(codec); |
| 1450 | } |
| 1451 | |
| 1452 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1453 | { |
| 1454 | alc889_coef_init(codec); |
| 1455 | alc889_automute_init(codec); |
| 1456 | } |
| 1457 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1458 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1459 | { |
| 1460 | struct alc_spec *spec = codec->spec; |
| 1461 | |
| 1462 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1463 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1464 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1465 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1466 | alc_automute_amp(codec); |
| 1467 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1468 | |
| 1469 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1470 | * ALC888 Acer Aspire 4930G model |
| 1471 | */ |
| 1472 | |
| 1473 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1474 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1475 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1476 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1477 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1478 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1479 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1480 | /* Connect Internal HP to front */ |
| 1481 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1482 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1483 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1484 | /* Connect HP out to front */ |
| 1485 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1486 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1487 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1488 | { } |
| 1489 | }; |
| 1490 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1491 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1492 | * ALC888 Acer Aspire 6530G model |
| 1493 | */ |
| 1494 | |
| 1495 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1496 | /* Bias voltage on for external mic port */ |
| 1497 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1498 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1499 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1500 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1501 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1502 | /* Enable unsolicited event for HP jack */ |
| 1503 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1504 | /* Enable speaker output */ |
| 1505 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1507 | /* Enable headphone output */ |
| 1508 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1510 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1511 | { } |
| 1512 | }; |
| 1513 | |
| 1514 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1515 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1516 | */ |
| 1517 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1518 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1519 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1520 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1521 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1522 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1523 | /* Enable unsolicited event for HP jack */ |
| 1524 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1525 | /* Connect Internal Front to Front */ |
| 1526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1528 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1529 | /* Connect Internal Rear to Rear */ |
| 1530 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1531 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1532 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1533 | /* Connect Internal CLFE to CLFE */ |
| 1534 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1535 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1536 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1537 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1538 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1540 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1541 | /* Enable all DACs */ |
| 1542 | /* DAC DISABLE/MUTE 1? */ |
| 1543 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1544 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1545 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1546 | /* DAC DISABLE/MUTE 2? */ |
| 1547 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1548 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1549 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1550 | /* Enable amplifiers */ |
| 1551 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1552 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1553 | /* DMIC fix |
| 1554 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1555 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1556 | * makes the signal become a difference/sum signal instead of standard |
| 1557 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1558 | * codec replicate the sum signal to both channels, turning it into a |
| 1559 | * normal mono mic. |
| 1560 | */ |
| 1561 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1562 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1563 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1564 | { } |
| 1565 | }; |
| 1566 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1567 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1568 | /* Front mic only available on one ADC */ |
| 1569 | { |
| 1570 | .num_items = 4, |
| 1571 | .items = { |
| 1572 | { "Mic", 0x0 }, |
| 1573 | { "Line", 0x2 }, |
| 1574 | { "CD", 0x4 }, |
| 1575 | { "Front Mic", 0xb }, |
| 1576 | }, |
| 1577 | }, |
| 1578 | { |
| 1579 | .num_items = 3, |
| 1580 | .items = { |
| 1581 | { "Mic", 0x0 }, |
| 1582 | { "Line", 0x2 }, |
| 1583 | { "CD", 0x4 }, |
| 1584 | }, |
| 1585 | } |
| 1586 | }; |
| 1587 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1588 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1589 | /* Interal mic only available on one ADC */ |
| 1590 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1591 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1592 | .items = { |
| 1593 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1594 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1595 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1596 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1597 | { "Int Mic", 0xb }, |
| 1598 | }, |
| 1599 | }, |
| 1600 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1601 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1602 | .items = { |
| 1603 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1604 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1605 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1606 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1607 | }, |
| 1608 | } |
| 1609 | }; |
| 1610 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1611 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1612 | /* Digital mic only available on first "ADC" */ |
| 1613 | { |
| 1614 | .num_items = 5, |
| 1615 | .items = { |
| 1616 | { "Mic", 0x0 }, |
| 1617 | { "Line", 0x2 }, |
| 1618 | { "CD", 0x4 }, |
| 1619 | { "Front Mic", 0xb }, |
| 1620 | { "Input Mix", 0xa }, |
| 1621 | }, |
| 1622 | }, |
| 1623 | { |
| 1624 | .num_items = 4, |
| 1625 | .items = { |
| 1626 | { "Mic", 0x0 }, |
| 1627 | { "Line", 0x2 }, |
| 1628 | { "CD", 0x4 }, |
| 1629 | { "Input Mix", 0xa }, |
| 1630 | }, |
| 1631 | }, |
| 1632 | { |
| 1633 | .num_items = 4, |
| 1634 | .items = { |
| 1635 | { "Mic", 0x0 }, |
| 1636 | { "Line", 0x2 }, |
| 1637 | { "CD", 0x4 }, |
| 1638 | { "Input Mix", 0xa }, |
| 1639 | }, |
| 1640 | } |
| 1641 | }; |
| 1642 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1643 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1644 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1645 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1646 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1647 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1648 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1649 | HDA_OUTPUT), |
| 1650 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1651 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1652 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1653 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1654 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1658 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1660 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1661 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1662 | { } /* end */ |
| 1663 | }; |
| 1664 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1665 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1666 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1667 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1668 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1669 | spec->autocfg.hp_pins[0] = 0x15; |
| 1670 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1671 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1672 | } |
| 1673 | |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1674 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) |
| 1675 | { |
| 1676 | struct alc_spec *spec = codec->spec; |
| 1677 | |
| 1678 | spec->autocfg.hp_pins[0] = 0x15; |
| 1679 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1680 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1681 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1682 | alc_automute_amp(codec); |
| 1683 | } |
| 1684 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1685 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1686 | { |
| 1687 | struct alc_spec *spec = codec->spec; |
| 1688 | |
| 1689 | spec->autocfg.hp_pins[0] = 0x15; |
| 1690 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1691 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1692 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1693 | alc_automute_amp(codec); |
| 1694 | } |
| 1695 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1696 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1697 | * ALC880 3-stack model |
| 1698 | * |
| 1699 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1700 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1701 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1702 | */ |
| 1703 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1704 | static hda_nid_t alc880_dac_nids[4] = { |
| 1705 | /* front, rear, clfe, rear_surr */ |
| 1706 | 0x02, 0x05, 0x04, 0x03 |
| 1707 | }; |
| 1708 | |
| 1709 | static hda_nid_t alc880_adc_nids[3] = { |
| 1710 | /* ADC0-2 */ |
| 1711 | 0x07, 0x08, 0x09, |
| 1712 | }; |
| 1713 | |
| 1714 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1715 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1716 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1717 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1718 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1719 | /* ADC1-2 */ |
| 1720 | 0x08, 0x09, |
| 1721 | }; |
| 1722 | |
| 1723 | #define ALC880_DIGOUT_NID 0x06 |
| 1724 | #define ALC880_DIGIN_NID 0x0a |
| 1725 | |
| 1726 | static struct hda_input_mux alc880_capture_source = { |
| 1727 | .num_items = 4, |
| 1728 | .items = { |
| 1729 | { "Mic", 0x0 }, |
| 1730 | { "Front Mic", 0x3 }, |
| 1731 | { "Line", 0x2 }, |
| 1732 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1733 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1734 | }; |
| 1735 | |
| 1736 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1737 | /* 2ch mode */ |
| 1738 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1739 | /* set line-in to input, mute it */ |
| 1740 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1741 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1742 | /* set mic-in to input vref 80%, mute it */ |
| 1743 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1744 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1745 | { } /* end */ |
| 1746 | }; |
| 1747 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1748 | /* 6ch mode */ |
| 1749 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1750 | /* set line-in to output, unmute it */ |
| 1751 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1752 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1753 | /* set mic-in to output, unmute it */ |
| 1754 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1755 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1756 | { } /* end */ |
| 1757 | }; |
| 1758 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1759 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1760 | { 2, alc880_threestack_ch2_init }, |
| 1761 | { 6, alc880_threestack_ch6_init }, |
| 1762 | }; |
| 1763 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1764 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1766 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1767 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1768 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1769 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1770 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1771 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1772 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1773 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1774 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1775 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1776 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1777 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1778 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1779 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1781 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1782 | { |
| 1783 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1784 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1785 | .info = alc_ch_mode_info, |
| 1786 | .get = alc_ch_mode_get, |
| 1787 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1788 | }, |
| 1789 | { } /* end */ |
| 1790 | }; |
| 1791 | |
| 1792 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1793 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1794 | struct snd_ctl_elem_info *uinfo) |
| 1795 | { |
| 1796 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1797 | struct alc_spec *spec = codec->spec; |
| 1798 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1799 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1800 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1801 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1802 | HDA_INPUT); |
| 1803 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1804 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1805 | return err; |
| 1806 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1807 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1808 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1809 | unsigned int size, unsigned int __user *tlv) |
| 1810 | { |
| 1811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1812 | struct alc_spec *spec = codec->spec; |
| 1813 | int err; |
| 1814 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1815 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1816 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1817 | HDA_INPUT); |
| 1818 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1819 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1820 | return err; |
| 1821 | } |
| 1822 | |
| 1823 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1824 | struct snd_ctl_elem_value *ucontrol); |
| 1825 | |
| 1826 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1827 | struct snd_ctl_elem_value *ucontrol, |
| 1828 | getput_call_t func) |
| 1829 | { |
| 1830 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1831 | struct alc_spec *spec = codec->spec; |
| 1832 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1833 | int err; |
| 1834 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1835 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1836 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1837 | 3, 0, HDA_INPUT); |
| 1838 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1839 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1840 | return err; |
| 1841 | } |
| 1842 | |
| 1843 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1844 | struct snd_ctl_elem_value *ucontrol) |
| 1845 | { |
| 1846 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1847 | snd_hda_mixer_amp_volume_get); |
| 1848 | } |
| 1849 | |
| 1850 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1851 | struct snd_ctl_elem_value *ucontrol) |
| 1852 | { |
| 1853 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1854 | snd_hda_mixer_amp_volume_put); |
| 1855 | } |
| 1856 | |
| 1857 | /* capture mixer elements */ |
| 1858 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1859 | |
| 1860 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1861 | struct snd_ctl_elem_value *ucontrol) |
| 1862 | { |
| 1863 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1864 | snd_hda_mixer_amp_switch_get); |
| 1865 | } |
| 1866 | |
| 1867 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1868 | struct snd_ctl_elem_value *ucontrol) |
| 1869 | { |
| 1870 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1871 | snd_hda_mixer_amp_switch_put); |
| 1872 | } |
| 1873 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1874 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1875 | { \ |
| 1876 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1877 | .name = "Capture Switch", \ |
| 1878 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1879 | .count = num, \ |
| 1880 | .info = alc_cap_sw_info, \ |
| 1881 | .get = alc_cap_sw_get, \ |
| 1882 | .put = alc_cap_sw_put, \ |
| 1883 | }, \ |
| 1884 | { \ |
| 1885 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1886 | .name = "Capture Volume", \ |
| 1887 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1888 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1889 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1890 | .count = num, \ |
| 1891 | .info = alc_cap_vol_info, \ |
| 1892 | .get = alc_cap_vol_get, \ |
| 1893 | .put = alc_cap_vol_put, \ |
| 1894 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1895 | } |
| 1896 | |
| 1897 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1898 | { \ |
| 1899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1900 | /* .name = "Capture Source", */ \ |
| 1901 | .name = "Input Source", \ |
| 1902 | .count = num, \ |
| 1903 | .info = alc_mux_enum_info, \ |
| 1904 | .get = alc_mux_enum_get, \ |
| 1905 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1906 | } |
| 1907 | |
| 1908 | #define DEFINE_CAPMIX(num) \ |
| 1909 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1910 | _DEFINE_CAPMIX(num), \ |
| 1911 | _DEFINE_CAPSRC(num), \ |
| 1912 | { } /* end */ \ |
| 1913 | } |
| 1914 | |
| 1915 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1916 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1917 | _DEFINE_CAPMIX(num), \ |
| 1918 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1919 | } |
| 1920 | |
| 1921 | /* up to three ADCs */ |
| 1922 | DEFINE_CAPMIX(1); |
| 1923 | DEFINE_CAPMIX(2); |
| 1924 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1925 | DEFINE_CAPMIX_NOSRC(1); |
| 1926 | DEFINE_CAPMIX_NOSRC(2); |
| 1927 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1928 | |
| 1929 | /* |
| 1930 | * ALC880 5-stack model |
| 1931 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1932 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1933 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1934 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1935 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1936 | */ |
| 1937 | |
| 1938 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1939 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1940 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1941 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1942 | { } /* end */ |
| 1943 | }; |
| 1944 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1945 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1946 | /* 6ch mode */ |
| 1947 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1948 | /* set line-in to input, mute it */ |
| 1949 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1950 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1951 | { } /* end */ |
| 1952 | }; |
| 1953 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1954 | /* 8ch mode */ |
| 1955 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1956 | /* set line-in to output, unmute it */ |
| 1957 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1958 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1959 | { } /* end */ |
| 1960 | }; |
| 1961 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1962 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1963 | { 6, alc880_fivestack_ch6_init }, |
| 1964 | { 8, alc880_fivestack_ch8_init }, |
| 1965 | }; |
| 1966 | |
| 1967 | |
| 1968 | /* |
| 1969 | * ALC880 6-stack model |
| 1970 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1971 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1972 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1973 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1974 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1975 | */ |
| 1976 | |
| 1977 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1978 | /* front, rear, clfe, rear_surr */ |
| 1979 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1980 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1981 | |
| 1982 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1983 | .num_items = 4, |
| 1984 | .items = { |
| 1985 | { "Mic", 0x0 }, |
| 1986 | { "Front Mic", 0x1 }, |
| 1987 | { "Line", 0x2 }, |
| 1988 | { "CD", 0x4 }, |
| 1989 | }, |
| 1990 | }; |
| 1991 | |
| 1992 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1993 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1994 | { 8, NULL }, |
| 1995 | }; |
| 1996 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1997 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1998 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1999 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2000 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2001 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2002 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2003 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2004 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2005 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2006 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2007 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2008 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2009 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2011 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2014 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2015 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2016 | { |
| 2017 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2018 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2019 | .info = alc_ch_mode_info, |
| 2020 | .get = alc_ch_mode_get, |
| 2021 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2022 | }, |
| 2023 | { } /* end */ |
| 2024 | }; |
| 2025 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2026 | |
| 2027 | /* |
| 2028 | * ALC880 W810 model |
| 2029 | * |
| 2030 | * W810 has rear IO for: |
| 2031 | * Front (DAC 02) |
| 2032 | * Surround (DAC 03) |
| 2033 | * Center/LFE (DAC 04) |
| 2034 | * Digital out (06) |
| 2035 | * |
| 2036 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2037 | * 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] | 2038 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2039 | * There is a variable resistor to control the speaker or headphone |
| 2040 | * volume. This is a hardware-only device without a software API. |
| 2041 | * |
| 2042 | * Plugging headphones in will disable the internal speakers. This is |
| 2043 | * implemented in hardware, not via the driver using jack sense. In |
| 2044 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2045 | * disable both the speakers and headphones. |
| 2046 | * |
| 2047 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2048 | * These may not do anything useful with this driver yet, because I |
| 2049 | * haven't setup any initialization verbs for these yet... |
| 2050 | */ |
| 2051 | |
| 2052 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2053 | /* front, rear/surround, clfe */ |
| 2054 | 0x02, 0x03, 0x04 |
| 2055 | }; |
| 2056 | |
| 2057 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2058 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2059 | { 6, NULL } |
| 2060 | }; |
| 2061 | |
| 2062 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2063 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2065 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2066 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2067 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2068 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2069 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2070 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2071 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2072 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2073 | { } /* end */ |
| 2074 | }; |
| 2075 | |
| 2076 | |
| 2077 | /* |
| 2078 | * Z710V model |
| 2079 | * |
| 2080 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2081 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2082 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2083 | */ |
| 2084 | |
| 2085 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2086 | 0x02 |
| 2087 | }; |
| 2088 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2089 | |
| 2090 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2091 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2092 | { 2, NULL } |
| 2093 | }; |
| 2094 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2095 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2096 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2097 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2098 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2099 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2100 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2101 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2102 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2103 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2104 | { } /* end */ |
| 2105 | }; |
| 2106 | |
| 2107 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2108 | /* |
| 2109 | * ALC880 F1734 model |
| 2110 | * |
| 2111 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2112 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2113 | */ |
| 2114 | |
| 2115 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2116 | 0x03 |
| 2117 | }; |
| 2118 | #define ALC880_F1734_HP_DAC 0x02 |
| 2119 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2120 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2121 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2122 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2123 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2124 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2127 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2128 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2129 | { } /* end */ |
| 2130 | }; |
| 2131 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2132 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2133 | .num_items = 2, |
| 2134 | .items = { |
| 2135 | { "Mic", 0x1 }, |
| 2136 | { "CD", 0x4 }, |
| 2137 | }, |
| 2138 | }; |
| 2139 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2140 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2141 | /* |
| 2142 | * ALC880 ASUS model |
| 2143 | * |
| 2144 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2145 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2146 | * Mic = 0x18, Line = 0x1a |
| 2147 | */ |
| 2148 | |
| 2149 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2150 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2151 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2152 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2153 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2154 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2155 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2156 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2157 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2158 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2159 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2160 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2161 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2162 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2163 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2164 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2165 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2167 | { |
| 2168 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2169 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2170 | .info = alc_ch_mode_info, |
| 2171 | .get = alc_ch_mode_get, |
| 2172 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2173 | }, |
| 2174 | { } /* end */ |
| 2175 | }; |
| 2176 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2177 | /* |
| 2178 | * ALC880 ASUS W1V model |
| 2179 | * |
| 2180 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2181 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2182 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2183 | */ |
| 2184 | |
| 2185 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2186 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2187 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2188 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2189 | { } /* end */ |
| 2190 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2191 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2192 | /* TCL S700 */ |
| 2193 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2194 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2195 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2196 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2197 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2201 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2202 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2203 | { } /* end */ |
| 2204 | }; |
| 2205 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2206 | /* Uniwill */ |
| 2207 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2208 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2209 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2210 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2211 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2212 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2213 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2214 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2215 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2217 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2219 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2220 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2223 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2224 | { |
| 2225 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2226 | .name = "Channel Mode", |
| 2227 | .info = alc_ch_mode_info, |
| 2228 | .get = alc_ch_mode_get, |
| 2229 | .put = alc_ch_mode_put, |
| 2230 | }, |
| 2231 | { } /* end */ |
| 2232 | }; |
| 2233 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2234 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2235 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2236 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2237 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2238 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2240 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2241 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2242 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2243 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2244 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2245 | { } /* end */ |
| 2246 | }; |
| 2247 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2248 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2249 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2250 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2251 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2252 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2254 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2255 | { } /* end */ |
| 2256 | }; |
| 2257 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2258 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2259 | * virtual master controls |
| 2260 | */ |
| 2261 | |
| 2262 | /* |
| 2263 | * slave controls for virtual master |
| 2264 | */ |
| 2265 | static const char *alc_slave_vols[] = { |
| 2266 | "Front Playback Volume", |
| 2267 | "Surround Playback Volume", |
| 2268 | "Center Playback Volume", |
| 2269 | "LFE Playback Volume", |
| 2270 | "Side Playback Volume", |
| 2271 | "Headphone Playback Volume", |
| 2272 | "Speaker Playback Volume", |
| 2273 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2274 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2275 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2276 | NULL, |
| 2277 | }; |
| 2278 | |
| 2279 | static const char *alc_slave_sws[] = { |
| 2280 | "Front Playback Switch", |
| 2281 | "Surround Playback Switch", |
| 2282 | "Center Playback Switch", |
| 2283 | "LFE Playback Switch", |
| 2284 | "Side Playback Switch", |
| 2285 | "Headphone Playback Switch", |
| 2286 | "Speaker Playback Switch", |
| 2287 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2288 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2289 | NULL, |
| 2290 | }; |
| 2291 | |
| 2292 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2293 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2294 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2295 | |
| 2296 | static void alc_free_kctls(struct hda_codec *codec); |
| 2297 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2298 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2299 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2300 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2301 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2302 | { } /* end */ |
| 2303 | }; |
| 2304 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | static int alc_build_controls(struct hda_codec *codec) |
| 2306 | { |
| 2307 | struct alc_spec *spec = codec->spec; |
| 2308 | int err; |
| 2309 | int i; |
| 2310 | |
| 2311 | for (i = 0; i < spec->num_mixers; i++) { |
| 2312 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2313 | if (err < 0) |
| 2314 | return err; |
| 2315 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2316 | if (spec->cap_mixer) { |
| 2317 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2318 | if (err < 0) |
| 2319 | return err; |
| 2320 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2321 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2322 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2323 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2324 | if (err < 0) |
| 2325 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2326 | if (!spec->no_analog) { |
| 2327 | err = snd_hda_create_spdif_share_sw(codec, |
| 2328 | &spec->multiout); |
| 2329 | if (err < 0) |
| 2330 | return err; |
| 2331 | spec->multiout.share_spdif = 1; |
| 2332 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2333 | } |
| 2334 | if (spec->dig_in_nid) { |
| 2335 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2336 | if (err < 0) |
| 2337 | return err; |
| 2338 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2339 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2340 | /* create beep controls if needed */ |
| 2341 | if (spec->beep_amp) { |
| 2342 | struct snd_kcontrol_new *knew; |
| 2343 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2344 | struct snd_kcontrol *kctl; |
| 2345 | kctl = snd_ctl_new1(knew, codec); |
| 2346 | if (!kctl) |
| 2347 | return -ENOMEM; |
| 2348 | kctl->private_value = spec->beep_amp; |
| 2349 | err = snd_hda_ctl_add(codec, kctl); |
| 2350 | if (err < 0) |
| 2351 | return err; |
| 2352 | } |
| 2353 | } |
| 2354 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2355 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2356 | if (!spec->no_analog && |
| 2357 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2358 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2359 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2360 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2361 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2362 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2363 | if (err < 0) |
| 2364 | return err; |
| 2365 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2366 | if (!spec->no_analog && |
| 2367 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2368 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2369 | NULL, alc_slave_sws); |
| 2370 | if (err < 0) |
| 2371 | return err; |
| 2372 | } |
| 2373 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2374 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2375 | return 0; |
| 2376 | } |
| 2377 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2379 | /* |
| 2380 | * initialize the codec volumes, etc |
| 2381 | */ |
| 2382 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2383 | /* |
| 2384 | * generic initialization of ADC, input mixers and output mixers |
| 2385 | */ |
| 2386 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2387 | /* |
| 2388 | * Unmute ADC0-2 and set the default input to mic-in |
| 2389 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2390 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2391 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2392 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2393 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2394 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2395 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2396 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2397 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2398 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2399 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2400 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2401 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2402 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2403 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2404 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2405 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2406 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2407 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2408 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2409 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2411 | /* |
| 2412 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2413 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2414 | /* set vol=0 to output mixers */ |
| 2415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2416 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2417 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2418 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2419 | /* set up input amps for analog loopback */ |
| 2420 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2421 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2422 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2423 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2424 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2425 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2426 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2427 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2429 | |
| 2430 | { } |
| 2431 | }; |
| 2432 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2433 | /* |
| 2434 | * 3-stack pin configuration: |
| 2435 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2436 | */ |
| 2437 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2438 | /* |
| 2439 | * preset connection lists of input pins |
| 2440 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2441 | */ |
| 2442 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2443 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2444 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2445 | |
| 2446 | /* |
| 2447 | * Set pin mode and muting |
| 2448 | */ |
| 2449 | /* set front pin widgets 0x14 for output */ |
| 2450 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2451 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2452 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2453 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2454 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2455 | /* Mic2 (as headphone out) for HP output */ |
| 2456 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2457 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2458 | /* Line In pin widget for input */ |
| 2459 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2460 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2461 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2462 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2463 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2464 | /* CD pin widget for input */ |
| 2465 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2466 | |
| 2467 | { } |
| 2468 | }; |
| 2469 | |
| 2470 | /* |
| 2471 | * 5-stack pin configuration: |
| 2472 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2473 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2474 | */ |
| 2475 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2476 | /* |
| 2477 | * preset connection lists of input pins |
| 2478 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2479 | */ |
| 2480 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2481 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2482 | |
| 2483 | /* |
| 2484 | * Set pin mode and muting |
| 2485 | */ |
| 2486 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2487 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2488 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2489 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2490 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2491 | /* unmute pins for output (no gain on this amp) */ |
| 2492 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2494 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2495 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2496 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2498 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2499 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2500 | /* Mic2 (as headphone out) for HP output */ |
| 2501 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2502 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2503 | /* Line In pin widget for input */ |
| 2504 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2505 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2506 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2507 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2508 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2509 | /* CD pin widget for input */ |
| 2510 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | |
| 2512 | { } |
| 2513 | }; |
| 2514 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2515 | /* |
| 2516 | * W810 pin configuration: |
| 2517 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2518 | */ |
| 2519 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2520 | /* hphone/speaker input selector: front DAC */ |
| 2521 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2522 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2524 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2525 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2526 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2527 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2528 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2529 | |
| 2530 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2531 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2532 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2533 | { } |
| 2534 | }; |
| 2535 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2536 | /* |
| 2537 | * Z71V pin configuration: |
| 2538 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2539 | */ |
| 2540 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2541 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2542 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2543 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2545 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2546 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2547 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2548 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2549 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2550 | |
| 2551 | { } |
| 2552 | }; |
| 2553 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2554 | /* |
| 2555 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2556 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2557 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2558 | */ |
| 2559 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2560 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2561 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2562 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2563 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2566 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2567 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2568 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2569 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2570 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2571 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2572 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2573 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2574 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2575 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2576 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2577 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2578 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2579 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2580 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2581 | { } |
| 2582 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2583 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2584 | /* |
| 2585 | * Uniwill pin configuration: |
| 2586 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2587 | * line = 0x1a |
| 2588 | */ |
| 2589 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2590 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2591 | |
| 2592 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2593 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2594 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2595 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2596 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2597 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2598 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2599 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2602 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2603 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2604 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2605 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2606 | |
| 2607 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2608 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2609 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2610 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2611 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2612 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2613 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2614 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2615 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2616 | |
| 2617 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2618 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2619 | |
| 2620 | { } |
| 2621 | }; |
| 2622 | |
| 2623 | /* |
| 2624 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2625 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2626 | */ |
| 2627 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2628 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2629 | |
| 2630 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2631 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2632 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2633 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2634 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2635 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2636 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2637 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2638 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2639 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2640 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2641 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2642 | |
| 2643 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2644 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2645 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2646 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2647 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2648 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2649 | |
| 2650 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2651 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2652 | |
| 2653 | { } |
| 2654 | }; |
| 2655 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2656 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2657 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2658 | { } |
| 2659 | }; |
| 2660 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2661 | /* auto-toggle front mic */ |
| 2662 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2663 | { |
| 2664 | unsigned int present; |
| 2665 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2666 | |
| 2667 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2668 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2669 | bits = present ? HDA_AMP_MUTE : 0; |
| 2670 | 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] | 2671 | } |
| 2672 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2673 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2674 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2675 | struct alc_spec *spec = codec->spec; |
| 2676 | |
| 2677 | spec->autocfg.hp_pins[0] = 0x14; |
| 2678 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2679 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2680 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2681 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2682 | } |
| 2683 | |
| 2684 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2685 | unsigned int res) |
| 2686 | { |
| 2687 | /* Looks like the unsol event is incompatible with the standard |
| 2688 | * definition. 4bit tag is placed at 28 bit! |
| 2689 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2690 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2691 | case ALC880_MIC_EVENT: |
| 2692 | alc880_uniwill_mic_automute(codec); |
| 2693 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2694 | default: |
| 2695 | alc_automute_amp_unsol_event(codec, res); |
| 2696 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2697 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2698 | } |
| 2699 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2700 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2701 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2702 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2703 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2704 | spec->autocfg.hp_pins[0] = 0x14; |
| 2705 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2706 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2707 | } |
| 2708 | |
| 2709 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2710 | { |
| 2711 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2712 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2713 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2714 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2715 | present &= HDA_AMP_VOLMASK; |
| 2716 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2717 | HDA_AMP_VOLMASK, present); |
| 2718 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2719 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2720 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2721 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2722 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2723 | unsigned int res) |
| 2724 | { |
| 2725 | /* Looks like the unsol event is incompatible with the standard |
| 2726 | * definition. 4bit tag is placed at 28 bit! |
| 2727 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2728 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2729 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2730 | else |
| 2731 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2732 | } |
| 2733 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2734 | /* |
| 2735 | * F1734 pin configuration: |
| 2736 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2737 | */ |
| 2738 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2739 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2740 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2741 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2742 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2743 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2744 | |
| 2745 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2746 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2747 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2749 | |
| 2750 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2752 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2754 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2755 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2756 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2757 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2758 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2759 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2760 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2761 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2762 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2763 | { } |
| 2764 | }; |
| 2765 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2766 | /* |
| 2767 | * ASUS pin configuration: |
| 2768 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2769 | */ |
| 2770 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2771 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2772 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2773 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2774 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2775 | |
| 2776 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2777 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2778 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2779 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2780 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2781 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2782 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2783 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2784 | |
| 2785 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2787 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2788 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2789 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2790 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2791 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2792 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2793 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2794 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2795 | { } |
| 2796 | }; |
| 2797 | |
| 2798 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2799 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2800 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2801 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2802 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2803 | /* Clevo m520g init */ |
| 2804 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2805 | /* headphone output */ |
| 2806 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2807 | /* line-out */ |
| 2808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2809 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2810 | /* Line-in */ |
| 2811 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2812 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2813 | /* CD */ |
| 2814 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2815 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2816 | /* Mic1 (rear panel) */ |
| 2817 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2818 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2819 | /* Mic2 (front panel) */ |
| 2820 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2821 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2822 | /* headphone */ |
| 2823 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2824 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2825 | /* change to EAPD mode */ |
| 2826 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2827 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2828 | |
| 2829 | { } |
| 2830 | }; |
| 2831 | |
| 2832 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2833 | /* change to EAPD mode */ |
| 2834 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2835 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2836 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2837 | /* Headphone output */ |
| 2838 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2839 | /* Front output*/ |
| 2840 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2841 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2842 | |
| 2843 | /* Line In pin widget for input */ |
| 2844 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2845 | /* CD pin widget for input */ |
| 2846 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2847 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2848 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2849 | |
| 2850 | /* change to EAPD mode */ |
| 2851 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2852 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2853 | |
| 2854 | { } |
| 2855 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2856 | |
| 2857 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2858 | * LG m1 express dual |
| 2859 | * |
| 2860 | * Pin assignment: |
| 2861 | * Rear Line-In/Out (blue): 0x14 |
| 2862 | * Build-in Mic-In: 0x15 |
| 2863 | * Speaker-out: 0x17 |
| 2864 | * HP-Out (green): 0x1b |
| 2865 | * Mic-In/Out (red): 0x19 |
| 2866 | * SPDIF-Out: 0x1e |
| 2867 | */ |
| 2868 | |
| 2869 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2870 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2871 | 0x05, 0x02, 0x03 |
| 2872 | }; |
| 2873 | |
| 2874 | /* seems analog CD is not working */ |
| 2875 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2876 | .num_items = 3, |
| 2877 | .items = { |
| 2878 | { "Mic", 0x1 }, |
| 2879 | { "Line", 0x5 }, |
| 2880 | { "Internal Mic", 0x6 }, |
| 2881 | }, |
| 2882 | }; |
| 2883 | |
| 2884 | /* 2,4,6 channel modes */ |
| 2885 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2886 | /* set line-in and mic-in to input */ |
| 2887 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2888 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2889 | { } |
| 2890 | }; |
| 2891 | |
| 2892 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2893 | /* set line-in to out and mic-in to input */ |
| 2894 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2895 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2896 | { } |
| 2897 | }; |
| 2898 | |
| 2899 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2900 | /* set line-in and mic-in to output */ |
| 2901 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2902 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2903 | { } |
| 2904 | }; |
| 2905 | |
| 2906 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2907 | { 2, alc880_lg_ch2_init }, |
| 2908 | { 4, alc880_lg_ch4_init }, |
| 2909 | { 6, alc880_lg_ch6_init }, |
| 2910 | }; |
| 2911 | |
| 2912 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2913 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2914 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2915 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2916 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2917 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2918 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2919 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2920 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2921 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2922 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2923 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2924 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2925 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2926 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2927 | { |
| 2928 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2929 | .name = "Channel Mode", |
| 2930 | .info = alc_ch_mode_info, |
| 2931 | .get = alc_ch_mode_get, |
| 2932 | .put = alc_ch_mode_put, |
| 2933 | }, |
| 2934 | { } /* end */ |
| 2935 | }; |
| 2936 | |
| 2937 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2938 | /* set capture source to mic-in */ |
| 2939 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2940 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2941 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2942 | /* mute all amp mixer inputs */ |
| 2943 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2944 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2945 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2946 | /* line-in to input */ |
| 2947 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2948 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2949 | /* built-in mic */ |
| 2950 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2951 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2952 | /* speaker-out */ |
| 2953 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2954 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2955 | /* mic-in to input */ |
| 2956 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2957 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2958 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2959 | /* HP-out */ |
| 2960 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2961 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2962 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2963 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2964 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2965 | { } |
| 2966 | }; |
| 2967 | |
| 2968 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2969 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2970 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2971 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2972 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2973 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2974 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2975 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2976 | } |
| 2977 | |
| 2978 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2979 | * LG LW20 |
| 2980 | * |
| 2981 | * Pin assignment: |
| 2982 | * Speaker-out: 0x14 |
| 2983 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2984 | * Built-in Mic-In: 0x19 |
| 2985 | * Line-In: 0x1b |
| 2986 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2987 | * SPDIF-Out: 0x1e |
| 2988 | */ |
| 2989 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2990 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2991 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2992 | .items = { |
| 2993 | { "Mic", 0x0 }, |
| 2994 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2995 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2996 | }, |
| 2997 | }; |
| 2998 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2999 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3000 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3001 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3002 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3003 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3004 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3005 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3006 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3007 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3008 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3009 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3011 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3014 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3015 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3016 | { |
| 3017 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3018 | .name = "Channel Mode", |
| 3019 | .info = alc_ch_mode_info, |
| 3020 | .get = alc_ch_mode_get, |
| 3021 | .put = alc_ch_mode_put, |
| 3022 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3023 | { } /* end */ |
| 3024 | }; |
| 3025 | |
| 3026 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3027 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3028 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3029 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3030 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3031 | /* set capture source to mic-in */ |
| 3032 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3033 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3034 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3035 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3036 | /* speaker-out */ |
| 3037 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3038 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3039 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3040 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3041 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3042 | /* mic-in to input */ |
| 3043 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3044 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3045 | /* built-in mic */ |
| 3046 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3047 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3048 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3049 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3050 | { } |
| 3051 | }; |
| 3052 | |
| 3053 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3054 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3055 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3056 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3057 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3058 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3059 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3060 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3061 | } |
| 3062 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3063 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3064 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3065 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3066 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3067 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3068 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3069 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3070 | { } /* end */ |
| 3071 | }; |
| 3072 | |
| 3073 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3074 | .num_items = 2, |
| 3075 | .items = { |
| 3076 | { "Mic", 0x0 }, |
| 3077 | { "Internal Mic", 0x1 }, |
| 3078 | }, |
| 3079 | }; |
| 3080 | |
| 3081 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3082 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3083 | |
| 3084 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3085 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3086 | |
| 3087 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3088 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3089 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3090 | /* Mic2 (as headphone out) for HP output */ |
| 3091 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3092 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3093 | /* Internal Speaker */ |
| 3094 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3095 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3096 | |
| 3097 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3098 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3099 | |
| 3100 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3101 | { } |
| 3102 | }; |
| 3103 | |
| 3104 | /* toggle speaker-output according to the hp-jack state */ |
| 3105 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3106 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3107 | struct alc_spec *spec = codec->spec; |
| 3108 | alc_automute_amp(codec); |
| 3109 | /* toggle EAPD */ |
| 3110 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3111 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3112 | else |
| 3113 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3114 | } |
| 3115 | |
| 3116 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3117 | unsigned int res) |
| 3118 | { |
| 3119 | /* Looks like the unsol event is incompatible with the standard |
| 3120 | * definition. 4bit tag is placed at 28 bit! |
| 3121 | */ |
| 3122 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3123 | alc880_medion_rim_automute(codec); |
| 3124 | } |
| 3125 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3126 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3127 | { |
| 3128 | struct alc_spec *spec = codec->spec; |
| 3129 | |
| 3130 | spec->autocfg.hp_pins[0] = 0x14; |
| 3131 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3132 | alc880_medion_rim_automute(codec); |
| 3133 | } |
| 3134 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3135 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3136 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3137 | { 0x0b, HDA_INPUT, 0 }, |
| 3138 | { 0x0b, HDA_INPUT, 1 }, |
| 3139 | { 0x0b, HDA_INPUT, 2 }, |
| 3140 | { 0x0b, HDA_INPUT, 3 }, |
| 3141 | { 0x0b, HDA_INPUT, 4 }, |
| 3142 | { } /* end */ |
| 3143 | }; |
| 3144 | |
| 3145 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3146 | { 0x0b, HDA_INPUT, 1 }, |
| 3147 | { 0x0b, HDA_INPUT, 6 }, |
| 3148 | { 0x0b, HDA_INPUT, 7 }, |
| 3149 | { } /* end */ |
| 3150 | }; |
| 3151 | #endif |
| 3152 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3153 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3154 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3155 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3156 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3157 | static int alc_init(struct hda_codec *codec) |
| 3158 | { |
| 3159 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3160 | unsigned int i; |
| 3161 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3162 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3163 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3164 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3165 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3166 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3167 | |
| 3168 | if (spec->init_hook) |
| 3169 | spec->init_hook(codec); |
| 3170 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3171 | return 0; |
| 3172 | } |
| 3173 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3174 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3175 | { |
| 3176 | struct alc_spec *spec = codec->spec; |
| 3177 | |
| 3178 | if (spec->unsol_event) |
| 3179 | spec->unsol_event(codec, res); |
| 3180 | } |
| 3181 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3182 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3183 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3184 | { |
| 3185 | struct alc_spec *spec = codec->spec; |
| 3186 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3187 | } |
| 3188 | #endif |
| 3189 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3190 | /* |
| 3191 | * Analog playback callbacks |
| 3192 | */ |
| 3193 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3194 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3195 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3196 | { |
| 3197 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3198 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3199 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3200 | } |
| 3201 | |
| 3202 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3203 | struct hda_codec *codec, |
| 3204 | unsigned int stream_tag, |
| 3205 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3206 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3207 | { |
| 3208 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3209 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3210 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3211 | } |
| 3212 | |
| 3213 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3214 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3215 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3216 | { |
| 3217 | struct alc_spec *spec = codec->spec; |
| 3218 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3219 | } |
| 3220 | |
| 3221 | /* |
| 3222 | * Digital out |
| 3223 | */ |
| 3224 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3225 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3226 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3227 | { |
| 3228 | struct alc_spec *spec = codec->spec; |
| 3229 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3230 | } |
| 3231 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3232 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3233 | struct hda_codec *codec, |
| 3234 | unsigned int stream_tag, |
| 3235 | unsigned int format, |
| 3236 | struct snd_pcm_substream *substream) |
| 3237 | { |
| 3238 | struct alc_spec *spec = codec->spec; |
| 3239 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3240 | stream_tag, format, substream); |
| 3241 | } |
| 3242 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3243 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3244 | struct hda_codec *codec, |
| 3245 | struct snd_pcm_substream *substream) |
| 3246 | { |
| 3247 | struct alc_spec *spec = codec->spec; |
| 3248 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3249 | } |
| 3250 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3251 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3252 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3253 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3254 | { |
| 3255 | struct alc_spec *spec = codec->spec; |
| 3256 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3257 | } |
| 3258 | |
| 3259 | /* |
| 3260 | * Analog capture |
| 3261 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3262 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3263 | struct hda_codec *codec, |
| 3264 | unsigned int stream_tag, |
| 3265 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3266 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3267 | { |
| 3268 | struct alc_spec *spec = codec->spec; |
| 3269 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3270 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3271 | stream_tag, 0, format); |
| 3272 | return 0; |
| 3273 | } |
| 3274 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3275 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3276 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3277 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3278 | { |
| 3279 | struct alc_spec *spec = codec->spec; |
| 3280 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3281 | snd_hda_codec_cleanup_stream(codec, |
| 3282 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3283 | return 0; |
| 3284 | } |
| 3285 | |
| 3286 | |
| 3287 | /* |
| 3288 | */ |
| 3289 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3290 | .substreams = 1, |
| 3291 | .channels_min = 2, |
| 3292 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3293 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3294 | .ops = { |
| 3295 | .open = alc880_playback_pcm_open, |
| 3296 | .prepare = alc880_playback_pcm_prepare, |
| 3297 | .cleanup = alc880_playback_pcm_cleanup |
| 3298 | }, |
| 3299 | }; |
| 3300 | |
| 3301 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3302 | .substreams = 1, |
| 3303 | .channels_min = 2, |
| 3304 | .channels_max = 2, |
| 3305 | /* NID is set in alc_build_pcms */ |
| 3306 | }; |
| 3307 | |
| 3308 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3309 | .substreams = 1, |
| 3310 | .channels_min = 2, |
| 3311 | .channels_max = 2, |
| 3312 | /* NID is set in alc_build_pcms */ |
| 3313 | }; |
| 3314 | |
| 3315 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3316 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3317 | .channels_min = 2, |
| 3318 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3319 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3320 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3321 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3322 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3323 | }, |
| 3324 | }; |
| 3325 | |
| 3326 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3327 | .substreams = 1, |
| 3328 | .channels_min = 2, |
| 3329 | .channels_max = 2, |
| 3330 | /* NID is set in alc_build_pcms */ |
| 3331 | .ops = { |
| 3332 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3333 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3334 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3335 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3336 | }, |
| 3337 | }; |
| 3338 | |
| 3339 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3340 | .substreams = 1, |
| 3341 | .channels_min = 2, |
| 3342 | .channels_max = 2, |
| 3343 | /* NID is set in alc_build_pcms */ |
| 3344 | }; |
| 3345 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3346 | /* 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] | 3347 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3348 | .substreams = 0, |
| 3349 | .channels_min = 0, |
| 3350 | .channels_max = 0, |
| 3351 | }; |
| 3352 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3353 | static int alc_build_pcms(struct hda_codec *codec) |
| 3354 | { |
| 3355 | struct alc_spec *spec = codec->spec; |
| 3356 | struct hda_pcm *info = spec->pcm_rec; |
| 3357 | int i; |
| 3358 | |
| 3359 | codec->num_pcms = 1; |
| 3360 | codec->pcm_info = info; |
| 3361 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3362 | if (spec->no_analog) |
| 3363 | goto skip_analog; |
| 3364 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3365 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3366 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3367 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3368 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3369 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3370 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3371 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3372 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3373 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3374 | } |
| 3375 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3376 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3377 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3378 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3379 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3380 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3382 | if (spec->channel_mode) { |
| 3383 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3384 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3385 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3386 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3387 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3388 | } |
| 3389 | } |
| 3390 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3391 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3392 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3393 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3394 | snprintf(spec->stream_name_digital, |
| 3395 | sizeof(spec->stream_name_digital), |
| 3396 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3397 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3398 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3399 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3400 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3401 | if (spec->dig_out_type) |
| 3402 | info->pcm_type = spec->dig_out_type; |
| 3403 | else |
| 3404 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3405 | if (spec->multiout.dig_out_nid && |
| 3406 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3407 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3408 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3409 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3410 | if (spec->dig_in_nid && |
| 3411 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3412 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3413 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3414 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3415 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3416 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3417 | } |
| 3418 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3419 | if (spec->no_analog) |
| 3420 | return 0; |
| 3421 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3422 | /* If the use of more than one ADC is requested for the current |
| 3423 | * model, configure a second analog capture-only PCM. |
| 3424 | */ |
| 3425 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3426 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3427 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3428 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3429 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3430 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3431 | if (spec->alt_dac_nid) { |
| 3432 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3433 | *spec->stream_analog_alt_playback; |
| 3434 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3435 | spec->alt_dac_nid; |
| 3436 | } else { |
| 3437 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3438 | alc_pcm_null_stream; |
| 3439 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3440 | } |
| 3441 | if (spec->num_adc_nids > 1) { |
| 3442 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3443 | *spec->stream_analog_alt_capture; |
| 3444 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3445 | spec->adc_nids[1]; |
| 3446 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3447 | spec->num_adc_nids - 1; |
| 3448 | } else { |
| 3449 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3450 | alc_pcm_null_stream; |
| 3451 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3452 | } |
| 3453 | } |
| 3454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3455 | return 0; |
| 3456 | } |
| 3457 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3458 | static void alc_free_kctls(struct hda_codec *codec) |
| 3459 | { |
| 3460 | struct alc_spec *spec = codec->spec; |
| 3461 | |
| 3462 | if (spec->kctls.list) { |
| 3463 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3464 | int i; |
| 3465 | for (i = 0; i < spec->kctls.used; i++) |
| 3466 | kfree(kctl[i].name); |
| 3467 | } |
| 3468 | snd_array_free(&spec->kctls); |
| 3469 | } |
| 3470 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3471 | static void alc_free(struct hda_codec *codec) |
| 3472 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3473 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3474 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3475 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3476 | return; |
| 3477 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3478 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3479 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3480 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3481 | } |
| 3482 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3483 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3484 | static int alc_resume(struct hda_codec *codec) |
| 3485 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3486 | codec->patch_ops.init(codec); |
| 3487 | snd_hda_codec_resume_amp(codec); |
| 3488 | snd_hda_codec_resume_cache(codec); |
| 3489 | return 0; |
| 3490 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3491 | #endif |
| 3492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3493 | /* |
| 3494 | */ |
| 3495 | static struct hda_codec_ops alc_patch_ops = { |
| 3496 | .build_controls = alc_build_controls, |
| 3497 | .build_pcms = alc_build_pcms, |
| 3498 | .init = alc_init, |
| 3499 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3500 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3501 | #ifdef SND_HDA_NEEDS_RESUME |
| 3502 | .resume = alc_resume, |
| 3503 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3504 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3505 | .check_power_status = alc_check_power_status, |
| 3506 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3507 | }; |
| 3508 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3509 | |
| 3510 | /* |
| 3511 | * Test configuration for debugging |
| 3512 | * |
| 3513 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3514 | * enum controls. |
| 3515 | */ |
| 3516 | #ifdef CONFIG_SND_DEBUG |
| 3517 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3518 | 0x02, 0x03, 0x04, 0x05 |
| 3519 | }; |
| 3520 | |
| 3521 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3522 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3523 | .items = { |
| 3524 | { "In-1", 0x0 }, |
| 3525 | { "In-2", 0x1 }, |
| 3526 | { "In-3", 0x2 }, |
| 3527 | { "In-4", 0x3 }, |
| 3528 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3529 | { "Front", 0x5 }, |
| 3530 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3531 | }, |
| 3532 | }; |
| 3533 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3534 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3535 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3536 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3537 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3538 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3539 | }; |
| 3540 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3541 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3542 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3543 | { |
| 3544 | static char *texts[] = { |
| 3545 | "N/A", "Line Out", "HP Out", |
| 3546 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3547 | }; |
| 3548 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3549 | uinfo->count = 1; |
| 3550 | uinfo->value.enumerated.items = 8; |
| 3551 | if (uinfo->value.enumerated.item >= 8) |
| 3552 | uinfo->value.enumerated.item = 7; |
| 3553 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3554 | return 0; |
| 3555 | } |
| 3556 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3557 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3558 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3559 | { |
| 3560 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3561 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3562 | unsigned int pin_ctl, item = 0; |
| 3563 | |
| 3564 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3565 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3566 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3567 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3568 | item = 2; |
| 3569 | else |
| 3570 | item = 1; |
| 3571 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3572 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3573 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3574 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3575 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3576 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3577 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3578 | } |
| 3579 | } |
| 3580 | ucontrol->value.enumerated.item[0] = item; |
| 3581 | return 0; |
| 3582 | } |
| 3583 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3584 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3585 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3586 | { |
| 3587 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3588 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3589 | static unsigned int ctls[] = { |
| 3590 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3591 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3592 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3593 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3594 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3595 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3596 | }; |
| 3597 | unsigned int old_ctl, new_ctl; |
| 3598 | |
| 3599 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3600 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3601 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3602 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3603 | int val; |
| 3604 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3605 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3606 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3607 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3608 | HDA_AMP_MUTE : 0; |
| 3609 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3610 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3611 | return 1; |
| 3612 | } |
| 3613 | return 0; |
| 3614 | } |
| 3615 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3616 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3617 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3618 | { |
| 3619 | static char *texts[] = { |
| 3620 | "Front", "Surround", "CLFE", "Side" |
| 3621 | }; |
| 3622 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3623 | uinfo->count = 1; |
| 3624 | uinfo->value.enumerated.items = 4; |
| 3625 | if (uinfo->value.enumerated.item >= 4) |
| 3626 | uinfo->value.enumerated.item = 3; |
| 3627 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3628 | return 0; |
| 3629 | } |
| 3630 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3631 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3632 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3633 | { |
| 3634 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3635 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3636 | unsigned int sel; |
| 3637 | |
| 3638 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3639 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3640 | return 0; |
| 3641 | } |
| 3642 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3643 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3644 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3645 | { |
| 3646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3647 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3648 | unsigned int sel; |
| 3649 | |
| 3650 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3651 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3652 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3653 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3654 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3655 | return 1; |
| 3656 | } |
| 3657 | return 0; |
| 3658 | } |
| 3659 | |
| 3660 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3662 | .name = xname, \ |
| 3663 | .info = alc_test_pin_ctl_info, \ |
| 3664 | .get = alc_test_pin_ctl_get, \ |
| 3665 | .put = alc_test_pin_ctl_put, \ |
| 3666 | .private_value = nid \ |
| 3667 | } |
| 3668 | |
| 3669 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3670 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3671 | .name = xname, \ |
| 3672 | .info = alc_test_pin_src_info, \ |
| 3673 | .get = alc_test_pin_src_get, \ |
| 3674 | .put = alc_test_pin_src_put, \ |
| 3675 | .private_value = nid \ |
| 3676 | } |
| 3677 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3678 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3679 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3680 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3681 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3682 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3683 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3684 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3685 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3686 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3687 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3688 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3689 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3690 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3691 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3692 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3693 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3694 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3695 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3696 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3697 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3698 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3699 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3700 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3701 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3702 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3703 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3704 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3705 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3706 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3707 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3708 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3709 | { |
| 3710 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3711 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3712 | .info = alc_ch_mode_info, |
| 3713 | .get = alc_ch_mode_get, |
| 3714 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3715 | }, |
| 3716 | { } /* end */ |
| 3717 | }; |
| 3718 | |
| 3719 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3720 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3721 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3722 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3723 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3724 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3725 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3726 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3727 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3728 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3729 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3730 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3731 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3732 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3733 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3734 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3735 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3737 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3738 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3739 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3740 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3742 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3743 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3744 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3745 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3746 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3747 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3748 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3749 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3750 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3752 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3754 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3755 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3756 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3757 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3758 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3759 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3760 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3761 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3762 | /* Analog input/passthru */ |
| 3763 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3768 | { } |
| 3769 | }; |
| 3770 | #endif |
| 3771 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3772 | /* |
| 3773 | */ |
| 3774 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3775 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3776 | [ALC880_3ST] = "3stack", |
| 3777 | [ALC880_TCL_S700] = "tcl", |
| 3778 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3779 | [ALC880_CLEVO] = "clevo", |
| 3780 | [ALC880_5ST] = "5stack", |
| 3781 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3782 | [ALC880_W810] = "w810", |
| 3783 | [ALC880_Z71V] = "z71v", |
| 3784 | [ALC880_6ST] = "6stack", |
| 3785 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3786 | [ALC880_ASUS] = "asus", |
| 3787 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3788 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3789 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3790 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3791 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3792 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3793 | [ALC880_F1734] = "F1734", |
| 3794 | [ALC880_LG] = "lg", |
| 3795 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3796 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3797 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3798 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3799 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3800 | [ALC880_AUTO] = "auto", |
| 3801 | }; |
| 3802 | |
| 3803 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3804 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3805 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3806 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3807 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3808 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3809 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3810 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3811 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3812 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3813 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3814 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3815 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3816 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3817 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3818 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3819 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3820 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3821 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3822 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3823 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3824 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3825 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3826 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3827 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3828 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3829 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3830 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3831 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3832 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3833 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3834 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3835 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3836 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3837 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3838 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3839 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3840 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3841 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3842 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3843 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3844 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3845 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3846 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3847 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3848 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3849 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3850 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3851 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3852 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3853 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3854 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3855 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3856 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3857 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3858 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3859 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3860 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3861 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3862 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3863 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3864 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3865 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3866 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3867 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3868 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3869 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3870 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3871 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3872 | /* default Intel */ |
| 3873 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3874 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3875 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3876 | {} |
| 3877 | }; |
| 3878 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3879 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3880 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3881 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3882 | static struct alc_config_preset alc880_presets[] = { |
| 3883 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3884 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3885 | .init_verbs = { alc880_volume_init_verbs, |
| 3886 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3887 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3888 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3889 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3890 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3891 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3892 | .input_mux = &alc880_capture_source, |
| 3893 | }, |
| 3894 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3895 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3896 | .init_verbs = { alc880_volume_init_verbs, |
| 3897 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3898 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3899 | .dac_nids = alc880_dac_nids, |
| 3900 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3901 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3902 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3903 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3904 | .input_mux = &alc880_capture_source, |
| 3905 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3906 | [ALC880_TCL_S700] = { |
| 3907 | .mixers = { alc880_tcl_s700_mixer }, |
| 3908 | .init_verbs = { alc880_volume_init_verbs, |
| 3909 | alc880_pin_tcl_S700_init_verbs, |
| 3910 | alc880_gpio2_init_verbs }, |
| 3911 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3912 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3913 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3914 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3915 | .hp_nid = 0x03, |
| 3916 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3917 | .channel_mode = alc880_2_jack_modes, |
| 3918 | .input_mux = &alc880_capture_source, |
| 3919 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3920 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3921 | .mixers = { alc880_three_stack_mixer, |
| 3922 | alc880_five_stack_mixer}, |
| 3923 | .init_verbs = { alc880_volume_init_verbs, |
| 3924 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3925 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3926 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3927 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3928 | .channel_mode = alc880_fivestack_modes, |
| 3929 | .input_mux = &alc880_capture_source, |
| 3930 | }, |
| 3931 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3932 | .mixers = { alc880_three_stack_mixer, |
| 3933 | alc880_five_stack_mixer }, |
| 3934 | .init_verbs = { alc880_volume_init_verbs, |
| 3935 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3936 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3937 | .dac_nids = alc880_dac_nids, |
| 3938 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3939 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3940 | .channel_mode = alc880_fivestack_modes, |
| 3941 | .input_mux = &alc880_capture_source, |
| 3942 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3943 | [ALC880_6ST] = { |
| 3944 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3945 | .init_verbs = { alc880_volume_init_verbs, |
| 3946 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3947 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3948 | .dac_nids = alc880_6st_dac_nids, |
| 3949 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3950 | .channel_mode = alc880_sixstack_modes, |
| 3951 | .input_mux = &alc880_6stack_capture_source, |
| 3952 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3953 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3954 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3955 | .init_verbs = { alc880_volume_init_verbs, |
| 3956 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3957 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3958 | .dac_nids = alc880_6st_dac_nids, |
| 3959 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3960 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3961 | .channel_mode = alc880_sixstack_modes, |
| 3962 | .input_mux = &alc880_6stack_capture_source, |
| 3963 | }, |
| 3964 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3965 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3966 | .init_verbs = { alc880_volume_init_verbs, |
| 3967 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3968 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3969 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3970 | .dac_nids = alc880_w810_dac_nids, |
| 3971 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3972 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3973 | .channel_mode = alc880_w810_modes, |
| 3974 | .input_mux = &alc880_capture_source, |
| 3975 | }, |
| 3976 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3977 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3978 | .init_verbs = { alc880_volume_init_verbs, |
| 3979 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3980 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3981 | .dac_nids = alc880_z71v_dac_nids, |
| 3982 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3983 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3984 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3985 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3986 | .input_mux = &alc880_capture_source, |
| 3987 | }, |
| 3988 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3989 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3990 | .init_verbs = { alc880_volume_init_verbs, |
| 3991 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3992 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3993 | .dac_nids = alc880_f1734_dac_nids, |
| 3994 | .hp_nid = 0x02, |
| 3995 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3996 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3997 | .input_mux = &alc880_f1734_capture_source, |
| 3998 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3999 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4000 | }, |
| 4001 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4002 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4003 | .init_verbs = { alc880_volume_init_verbs, |
| 4004 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4005 | alc880_gpio1_init_verbs }, |
| 4006 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4007 | .dac_nids = alc880_asus_dac_nids, |
| 4008 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4009 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4010 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4011 | .input_mux = &alc880_capture_source, |
| 4012 | }, |
| 4013 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4014 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4015 | .init_verbs = { alc880_volume_init_verbs, |
| 4016 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4017 | alc880_gpio1_init_verbs }, |
| 4018 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4019 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4020 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4021 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4022 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4023 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4024 | .input_mux = &alc880_capture_source, |
| 4025 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4026 | [ALC880_ASUS_DIG2] = { |
| 4027 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4028 | .init_verbs = { alc880_volume_init_verbs, |
| 4029 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4030 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4031 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4032 | .dac_nids = alc880_asus_dac_nids, |
| 4033 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4034 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4035 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4036 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4037 | .input_mux = &alc880_capture_source, |
| 4038 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4039 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4040 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4041 | .init_verbs = { alc880_volume_init_verbs, |
| 4042 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4043 | alc880_gpio1_init_verbs }, |
| 4044 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4045 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4046 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4047 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4048 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4049 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4050 | .input_mux = &alc880_capture_source, |
| 4051 | }, |
| 4052 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4053 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4054 | .init_verbs = { alc880_volume_init_verbs, |
| 4055 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4056 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4057 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4058 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4059 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4060 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4061 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4062 | .input_mux = &alc880_capture_source, |
| 4063 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4064 | [ALC880_UNIWILL] = { |
| 4065 | .mixers = { alc880_uniwill_mixer }, |
| 4066 | .init_verbs = { alc880_volume_init_verbs, |
| 4067 | alc880_uniwill_init_verbs }, |
| 4068 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4069 | .dac_nids = alc880_asus_dac_nids, |
| 4070 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4071 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4072 | .channel_mode = alc880_threestack_modes, |
| 4073 | .need_dac_fix = 1, |
| 4074 | .input_mux = &alc880_capture_source, |
| 4075 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4076 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4077 | }, |
| 4078 | [ALC880_UNIWILL_P53] = { |
| 4079 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4080 | .init_verbs = { alc880_volume_init_verbs, |
| 4081 | alc880_uniwill_p53_init_verbs }, |
| 4082 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4083 | .dac_nids = alc880_asus_dac_nids, |
| 4084 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4085 | .channel_mode = alc880_threestack_modes, |
| 4086 | .input_mux = &alc880_capture_source, |
| 4087 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4088 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4089 | }, |
| 4090 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4091 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4092 | .init_verbs = { alc880_volume_init_verbs, |
| 4093 | alc880_uniwill_p53_init_verbs, |
| 4094 | alc880_beep_init_verbs }, |
| 4095 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4096 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4097 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4098 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4099 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4100 | .input_mux = &alc880_capture_source, |
| 4101 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4102 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4103 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4104 | [ALC880_CLEVO] = { |
| 4105 | .mixers = { alc880_three_stack_mixer }, |
| 4106 | .init_verbs = { alc880_volume_init_verbs, |
| 4107 | alc880_pin_clevo_init_verbs }, |
| 4108 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4109 | .dac_nids = alc880_dac_nids, |
| 4110 | .hp_nid = 0x03, |
| 4111 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4112 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4113 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4114 | .input_mux = &alc880_capture_source, |
| 4115 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4116 | [ALC880_LG] = { |
| 4117 | .mixers = { alc880_lg_mixer }, |
| 4118 | .init_verbs = { alc880_volume_init_verbs, |
| 4119 | alc880_lg_init_verbs }, |
| 4120 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4121 | .dac_nids = alc880_lg_dac_nids, |
| 4122 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4123 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4124 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4125 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4126 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4127 | .unsol_event = alc_automute_amp_unsol_event, |
| 4128 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4129 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4130 | .loopbacks = alc880_lg_loopbacks, |
| 4131 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4132 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4133 | [ALC880_LG_LW] = { |
| 4134 | .mixers = { alc880_lg_lw_mixer }, |
| 4135 | .init_verbs = { alc880_volume_init_verbs, |
| 4136 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4137 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4138 | .dac_nids = alc880_dac_nids, |
| 4139 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4140 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4141 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4142 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4143 | .unsol_event = alc_automute_amp_unsol_event, |
| 4144 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4145 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4146 | [ALC880_MEDION_RIM] = { |
| 4147 | .mixers = { alc880_medion_rim_mixer }, |
| 4148 | .init_verbs = { alc880_volume_init_verbs, |
| 4149 | alc880_medion_rim_init_verbs, |
| 4150 | alc_gpio2_init_verbs }, |
| 4151 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4152 | .dac_nids = alc880_dac_nids, |
| 4153 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4154 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4155 | .channel_mode = alc880_2_jack_modes, |
| 4156 | .input_mux = &alc880_medion_rim_capture_source, |
| 4157 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4158 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4159 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4160 | #ifdef CONFIG_SND_DEBUG |
| 4161 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4162 | .mixers = { alc880_test_mixer }, |
| 4163 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4164 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4165 | .dac_nids = alc880_test_dac_nids, |
| 4166 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4167 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4168 | .channel_mode = alc880_test_modes, |
| 4169 | .input_mux = &alc880_test_capture_source, |
| 4170 | }, |
| 4171 | #endif |
| 4172 | }; |
| 4173 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4174 | /* |
| 4175 | * Automatic parse of I/O pins from the BIOS configuration |
| 4176 | */ |
| 4177 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4178 | enum { |
| 4179 | ALC_CTL_WIDGET_VOL, |
| 4180 | ALC_CTL_WIDGET_MUTE, |
| 4181 | ALC_CTL_BIND_MUTE, |
| 4182 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4183 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4184 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4185 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4186 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4187 | }; |
| 4188 | |
| 4189 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4190 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4191 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4192 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4193 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4194 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4195 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4196 | knew = snd_array_new(&spec->kctls); |
| 4197 | if (!knew) |
| 4198 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4199 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4200 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4201 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4202 | return -ENOMEM; |
| 4203 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4204 | return 0; |
| 4205 | } |
| 4206 | |
| 4207 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4208 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4209 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4210 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4211 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4212 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4213 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4214 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4215 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4216 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4217 | #define ALC880_PIN_CD_NID 0x1c |
| 4218 | |
| 4219 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4220 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4221 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4222 | { |
| 4223 | hda_nid_t nid; |
| 4224 | int assigned[4]; |
| 4225 | int i, j; |
| 4226 | |
| 4227 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4228 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4229 | |
| 4230 | /* check the pins hardwired to audio widget */ |
| 4231 | for (i = 0; i < cfg->line_outs; i++) { |
| 4232 | nid = cfg->line_out_pins[i]; |
| 4233 | if (alc880_is_fixed_pin(nid)) { |
| 4234 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4235 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4236 | assigned[idx] = 1; |
| 4237 | } |
| 4238 | } |
| 4239 | /* left pins can be connect to any audio widget */ |
| 4240 | for (i = 0; i < cfg->line_outs; i++) { |
| 4241 | nid = cfg->line_out_pins[i]; |
| 4242 | if (alc880_is_fixed_pin(nid)) |
| 4243 | continue; |
| 4244 | /* search for an empty channel */ |
| 4245 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4246 | if (!assigned[j]) { |
| 4247 | spec->multiout.dac_nids[i] = |
| 4248 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4249 | assigned[j] = 1; |
| 4250 | break; |
| 4251 | } |
| 4252 | } |
| 4253 | } |
| 4254 | spec->multiout.num_dacs = cfg->line_outs; |
| 4255 | return 0; |
| 4256 | } |
| 4257 | |
| 4258 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4259 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4260 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4261 | { |
| 4262 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4263 | static const char *chname[4] = { |
| 4264 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4265 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4266 | hda_nid_t nid; |
| 4267 | int i, err; |
| 4268 | |
| 4269 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4270 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4271 | continue; |
| 4272 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4273 | if (i == 2) { |
| 4274 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4275 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4276 | "Center Playback Volume", |
| 4277 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4278 | HDA_OUTPUT)); |
| 4279 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4280 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4281 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4282 | "LFE Playback Volume", |
| 4283 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4284 | HDA_OUTPUT)); |
| 4285 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4286 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4287 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4288 | "Center Playback Switch", |
| 4289 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4290 | HDA_INPUT)); |
| 4291 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4292 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4293 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4294 | "LFE Playback Switch", |
| 4295 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4296 | HDA_INPUT)); |
| 4297 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4298 | return err; |
| 4299 | } else { |
| 4300 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4301 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4302 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4303 | HDA_OUTPUT)); |
| 4304 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4305 | return err; |
| 4306 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4307 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4308 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4309 | HDA_INPUT)); |
| 4310 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4311 | return err; |
| 4312 | } |
| 4313 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4314 | return 0; |
| 4315 | } |
| 4316 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4317 | /* add playback controls for speaker and HP outputs */ |
| 4318 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4319 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4320 | { |
| 4321 | hda_nid_t nid; |
| 4322 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4323 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4324 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4325 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4326 | return 0; |
| 4327 | |
| 4328 | if (alc880_is_fixed_pin(pin)) { |
| 4329 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4330 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4331 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4332 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4333 | else |
| 4334 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4335 | /* control HP volume/switch on the output mixer amp */ |
| 4336 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4337 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4338 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4339 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4340 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4341 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4342 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4343 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4344 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4345 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4346 | return err; |
| 4347 | } else if (alc880_is_multi_pin(pin)) { |
| 4348 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4349 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4350 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4351 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4352 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4353 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4354 | return err; |
| 4355 | } |
| 4356 | return 0; |
| 4357 | } |
| 4358 | |
| 4359 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4360 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4361 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4363 | { |
| 4364 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4365 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4366 | |
| 4367 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4368 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4369 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4370 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4371 | return err; |
| 4372 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4373 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4374 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4375 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4376 | return err; |
| 4377 | return 0; |
| 4378 | } |
| 4379 | |
| 4380 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4381 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4382 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4383 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4384 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4385 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4386 | |
| 4387 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4388 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4389 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4390 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4391 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4392 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4393 | if (err < 0) |
| 4394 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4395 | imux->items[imux->num_items].label = |
| 4396 | auto_pin_cfg_labels[i]; |
| 4397 | imux->items[imux->num_items].index = |
| 4398 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4399 | imux->num_items++; |
| 4400 | } |
| 4401 | } |
| 4402 | return 0; |
| 4403 | } |
| 4404 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4405 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4406 | unsigned int pin_type) |
| 4407 | { |
| 4408 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4409 | pin_type); |
| 4410 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4411 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4412 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4413 | } |
| 4414 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4415 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4416 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4417 | int dac_idx) |
| 4418 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4419 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4420 | /* need the manual connection? */ |
| 4421 | if (alc880_is_multi_pin(nid)) { |
| 4422 | struct alc_spec *spec = codec->spec; |
| 4423 | int idx = alc880_multi_pin_idx(nid); |
| 4424 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4425 | AC_VERB_SET_CONNECT_SEL, |
| 4426 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4427 | } |
| 4428 | } |
| 4429 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4430 | static int get_pin_type(int line_out_type) |
| 4431 | { |
| 4432 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4433 | return PIN_HP; |
| 4434 | else |
| 4435 | return PIN_OUT; |
| 4436 | } |
| 4437 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4438 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4439 | { |
| 4440 | struct alc_spec *spec = codec->spec; |
| 4441 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4442 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4443 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4444 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4445 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4446 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4447 | } |
| 4448 | } |
| 4449 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4450 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4451 | { |
| 4452 | struct alc_spec *spec = codec->spec; |
| 4453 | hda_nid_t pin; |
| 4454 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4455 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4456 | if (pin) /* connect to front */ |
| 4457 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4458 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4459 | if (pin) /* connect to front */ |
| 4460 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4461 | } |
| 4462 | |
| 4463 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4464 | { |
| 4465 | struct alc_spec *spec = codec->spec; |
| 4466 | int i; |
| 4467 | |
| 4468 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4469 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4470 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4471 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4472 | if (nid != ALC880_PIN_CD_NID && |
| 4473 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4474 | snd_hda_codec_write(codec, nid, 0, |
| 4475 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4476 | AMP_OUT_MUTE); |
| 4477 | } |
| 4478 | } |
| 4479 | } |
| 4480 | |
| 4481 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4482 | /* return 1 if successful, 0 if the proper config is not found, |
| 4483 | * or a negative error code |
| 4484 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4485 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4486 | { |
| 4487 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4488 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4490 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4491 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4492 | alc880_ignore); |
| 4493 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4494 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4495 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4496 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4497 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4498 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4499 | if (err < 0) |
| 4500 | return err; |
| 4501 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4502 | if (err < 0) |
| 4503 | return err; |
| 4504 | err = alc880_auto_create_extra_out(spec, |
| 4505 | spec->autocfg.speaker_pins[0], |
| 4506 | "Speaker"); |
| 4507 | if (err < 0) |
| 4508 | return err; |
| 4509 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4510 | "Headphone"); |
| 4511 | if (err < 0) |
| 4512 | return err; |
| 4513 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4514 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4515 | return err; |
| 4516 | |
| 4517 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4518 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4519 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4520 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4521 | hda_nid_t dig_nid; |
| 4522 | err = snd_hda_get_connections(codec, |
| 4523 | spec->autocfg.dig_out_pins[i], |
| 4524 | &dig_nid, 1); |
| 4525 | if (err < 0) |
| 4526 | continue; |
| 4527 | if (!i) |
| 4528 | spec->multiout.dig_out_nid = dig_nid; |
| 4529 | else { |
| 4530 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4531 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4532 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4533 | break; |
| 4534 | } |
| 4535 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4536 | if (spec->autocfg.dig_in_pin) |
| 4537 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4538 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4539 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4540 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4541 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4542 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4543 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4544 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4545 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4546 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4547 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4548 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4549 | return 1; |
| 4550 | } |
| 4551 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4552 | /* additional initialization for auto-configuration model */ |
| 4553 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4554 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4555 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4556 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4557 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4558 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4559 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4560 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4561 | } |
| 4562 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4563 | static void set_capture_mixer(struct alc_spec *spec) |
| 4564 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4565 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4566 | { alc_capture_mixer_nosrc1, |
| 4567 | alc_capture_mixer_nosrc2, |
| 4568 | alc_capture_mixer_nosrc3 }, |
| 4569 | { alc_capture_mixer1, |
| 4570 | alc_capture_mixer2, |
| 4571 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4572 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4573 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4574 | int mux; |
| 4575 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4576 | mux = 1; |
| 4577 | else |
| 4578 | mux = 0; |
| 4579 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4580 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4581 | } |
| 4582 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4583 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4584 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4585 | |
| 4586 | /* |
| 4587 | * OK, here we have finally the patch for ALC880 |
| 4588 | */ |
| 4589 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4590 | static int patch_alc880(struct hda_codec *codec) |
| 4591 | { |
| 4592 | struct alc_spec *spec; |
| 4593 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4594 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4595 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4596 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4597 | if (spec == NULL) |
| 4598 | return -ENOMEM; |
| 4599 | |
| 4600 | codec->spec = spec; |
| 4601 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4602 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4603 | alc880_models, |
| 4604 | alc880_cfg_tbl); |
| 4605 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4606 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4607 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4608 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4609 | } |
| 4610 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4611 | if (board_config == ALC880_AUTO) { |
| 4612 | /* automatic parse from the BIOS config */ |
| 4613 | err = alc880_parse_auto_config(codec); |
| 4614 | if (err < 0) { |
| 4615 | alc_free(codec); |
| 4616 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4617 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4618 | printk(KERN_INFO |
| 4619 | "hda_codec: Cannot set up configuration " |
| 4620 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4621 | board_config = ALC880_3ST; |
| 4622 | } |
| 4623 | } |
| 4624 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4625 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4626 | if (err < 0) { |
| 4627 | alc_free(codec); |
| 4628 | return err; |
| 4629 | } |
| 4630 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4631 | if (board_config != ALC880_AUTO) |
| 4632 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4633 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4634 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4635 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4636 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4637 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4638 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4639 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4640 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4641 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4642 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4643 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4644 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4645 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4646 | if (wcap != AC_WID_AUD_IN) { |
| 4647 | spec->adc_nids = alc880_adc_nids_alt; |
| 4648 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4649 | } else { |
| 4650 | spec->adc_nids = alc880_adc_nids; |
| 4651 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4652 | } |
| 4653 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4654 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4655 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4656 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4657 | spec->vmaster_nid = 0x0c; |
| 4658 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4659 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4660 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4661 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4662 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4663 | if (!spec->loopback.amplist) |
| 4664 | spec->loopback.amplist = alc880_loopbacks; |
| 4665 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4666 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4667 | |
| 4668 | return 0; |
| 4669 | } |
| 4670 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4671 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4672 | /* |
| 4673 | * ALC260 support |
| 4674 | */ |
| 4675 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4676 | static hda_nid_t alc260_dac_nids[1] = { |
| 4677 | /* front */ |
| 4678 | 0x02, |
| 4679 | }; |
| 4680 | |
| 4681 | static hda_nid_t alc260_adc_nids[1] = { |
| 4682 | /* ADC0 */ |
| 4683 | 0x04, |
| 4684 | }; |
| 4685 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4686 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4687 | /* ADC1 */ |
| 4688 | 0x05, |
| 4689 | }; |
| 4690 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4691 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4692 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4693 | */ |
| 4694 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4695 | /* ADC0, ADC1 */ |
| 4696 | 0x04, 0x05 |
| 4697 | }; |
| 4698 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4699 | #define ALC260_DIGOUT_NID 0x03 |
| 4700 | #define ALC260_DIGIN_NID 0x06 |
| 4701 | |
| 4702 | static struct hda_input_mux alc260_capture_source = { |
| 4703 | .num_items = 4, |
| 4704 | .items = { |
| 4705 | { "Mic", 0x0 }, |
| 4706 | { "Front Mic", 0x1 }, |
| 4707 | { "Line", 0x2 }, |
| 4708 | { "CD", 0x4 }, |
| 4709 | }, |
| 4710 | }; |
| 4711 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4712 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4713 | * headphone jack and the internal CD lines since these are the only pins at |
| 4714 | * which audio can appear. For flexibility, also allow the option of |
| 4715 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4716 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4717 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4718 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4719 | { |
| 4720 | .num_items = 3, |
| 4721 | .items = { |
| 4722 | { "Mic/Line", 0x0 }, |
| 4723 | { "CD", 0x4 }, |
| 4724 | { "Headphone", 0x2 }, |
| 4725 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4726 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4727 | { |
| 4728 | .num_items = 4, |
| 4729 | .items = { |
| 4730 | { "Mic/Line", 0x0 }, |
| 4731 | { "CD", 0x4 }, |
| 4732 | { "Headphone", 0x2 }, |
| 4733 | { "Mixer", 0x5 }, |
| 4734 | }, |
| 4735 | }, |
| 4736 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4737 | }; |
| 4738 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4739 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4740 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4741 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4742 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4743 | { |
| 4744 | .num_items = 4, |
| 4745 | .items = { |
| 4746 | { "Mic", 0x0 }, |
| 4747 | { "Line", 0x2 }, |
| 4748 | { "CD", 0x4 }, |
| 4749 | { "Headphone", 0x5 }, |
| 4750 | }, |
| 4751 | }, |
| 4752 | { |
| 4753 | .num_items = 5, |
| 4754 | .items = { |
| 4755 | { "Mic", 0x0 }, |
| 4756 | { "Line", 0x2 }, |
| 4757 | { "CD", 0x4 }, |
| 4758 | { "Headphone", 0x6 }, |
| 4759 | { "Mixer", 0x5 }, |
| 4760 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4761 | }, |
| 4762 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4763 | |
| 4764 | /* Maxdata Favorit 100XS */ |
| 4765 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4766 | { |
| 4767 | .num_items = 2, |
| 4768 | .items = { |
| 4769 | { "Line/Mic", 0x0 }, |
| 4770 | { "CD", 0x4 }, |
| 4771 | }, |
| 4772 | }, |
| 4773 | { |
| 4774 | .num_items = 3, |
| 4775 | .items = { |
| 4776 | { "Line/Mic", 0x0 }, |
| 4777 | { "CD", 0x4 }, |
| 4778 | { "Mixer", 0x5 }, |
| 4779 | }, |
| 4780 | }, |
| 4781 | }; |
| 4782 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4783 | /* |
| 4784 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4785 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4786 | * element which allows changing the channel mode, so the verb list is |
| 4787 | * never used. |
| 4788 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4789 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4790 | { 2, NULL }, |
| 4791 | }; |
| 4792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4793 | |
| 4794 | /* Mixer combinations |
| 4795 | * |
| 4796 | * basic: base_output + input + pc_beep + capture |
| 4797 | * HP: base_output + input + capture_alt |
| 4798 | * HP_3013: hp_3013 + input + capture |
| 4799 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4800 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4801 | */ |
| 4802 | |
| 4803 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4804 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4805 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4806 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4807 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4808 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4809 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4810 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4811 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4812 | |
| 4813 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4814 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4815 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4817 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4820 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4821 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4822 | { } /* end */ |
| 4823 | }; |
| 4824 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4825 | /* update HP, line and mono out pins according to the master switch */ |
| 4826 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4827 | hda_nid_t hp, hda_nid_t line, |
| 4828 | hda_nid_t mono) |
| 4829 | { |
| 4830 | struct alc_spec *spec = codec->spec; |
| 4831 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4832 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4833 | 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] | 4834 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4835 | 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] | 4836 | val); |
| 4837 | /* mono (speaker) depending on the HP jack sense */ |
| 4838 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4839 | 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] | 4840 | val); |
| 4841 | } |
| 4842 | |
| 4843 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4844 | struct snd_ctl_elem_value *ucontrol) |
| 4845 | { |
| 4846 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4847 | struct alc_spec *spec = codec->spec; |
| 4848 | *ucontrol->value.integer.value = spec->master_sw; |
| 4849 | return 0; |
| 4850 | } |
| 4851 | |
| 4852 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4853 | struct snd_ctl_elem_value *ucontrol) |
| 4854 | { |
| 4855 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4856 | struct alc_spec *spec = codec->spec; |
| 4857 | int val = !!*ucontrol->value.integer.value; |
| 4858 | hda_nid_t hp, line, mono; |
| 4859 | |
| 4860 | if (val == spec->master_sw) |
| 4861 | return 0; |
| 4862 | spec->master_sw = val; |
| 4863 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4864 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4865 | mono = kcontrol->private_value & 0xff; |
| 4866 | alc260_hp_master_update(codec, hp, line, mono); |
| 4867 | return 1; |
| 4868 | } |
| 4869 | |
| 4870 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4871 | { |
| 4872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4873 | .name = "Master Playback Switch", |
| 4874 | .info = snd_ctl_boolean_mono_info, |
| 4875 | .get = alc260_hp_master_sw_get, |
| 4876 | .put = alc260_hp_master_sw_put, |
| 4877 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4878 | }, |
| 4879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4880 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4881 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4882 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4883 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4884 | HDA_OUTPUT), |
| 4885 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4886 | { } /* end */ |
| 4887 | }; |
| 4888 | |
| 4889 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4890 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4891 | {}, |
| 4892 | }; |
| 4893 | |
| 4894 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4895 | { |
| 4896 | struct alc_spec *spec = codec->spec; |
| 4897 | unsigned int present; |
| 4898 | |
| 4899 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4900 | AC_VERB_GET_PIN_SENSE, 0); |
| 4901 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4902 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4903 | } |
| 4904 | |
| 4905 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4906 | { |
| 4907 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4908 | alc260_hp_automute(codec); |
| 4909 | } |
| 4910 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4911 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4912 | { |
| 4913 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4914 | .name = "Master Playback Switch", |
| 4915 | .info = snd_ctl_boolean_mono_info, |
| 4916 | .get = alc260_hp_master_sw_get, |
| 4917 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4918 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4919 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4920 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4921 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4922 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4923 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4924 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4926 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4927 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4928 | { } /* end */ |
| 4929 | }; |
| 4930 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4931 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4932 | .ops = &snd_hda_bind_vol, |
| 4933 | .values = { |
| 4934 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4935 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4936 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4937 | 0 |
| 4938 | }, |
| 4939 | }; |
| 4940 | |
| 4941 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4942 | .ops = &snd_hda_bind_sw, |
| 4943 | .values = { |
| 4944 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4945 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4946 | 0 |
| 4947 | }, |
| 4948 | }; |
| 4949 | |
| 4950 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4951 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4952 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4953 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4954 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4955 | { } /* end */ |
| 4956 | }; |
| 4957 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4958 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4959 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4960 | {}, |
| 4961 | }; |
| 4962 | |
| 4963 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4964 | { |
| 4965 | struct alc_spec *spec = codec->spec; |
| 4966 | unsigned int present; |
| 4967 | |
| 4968 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4969 | AC_VERB_GET_PIN_SENSE, 0); |
| 4970 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4971 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4972 | } |
| 4973 | |
| 4974 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4975 | unsigned int res) |
| 4976 | { |
| 4977 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4978 | alc260_hp_3013_automute(codec); |
| 4979 | } |
| 4980 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4981 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4982 | { |
| 4983 | unsigned int present, bits; |
| 4984 | |
| 4985 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4986 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4987 | |
| 4988 | bits = present ? 0 : PIN_OUT; |
| 4989 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4990 | bits); |
| 4991 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4992 | bits); |
| 4993 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4994 | bits); |
| 4995 | } |
| 4996 | |
| 4997 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4998 | unsigned int res) |
| 4999 | { |
| 5000 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5001 | alc260_hp_3012_automute(codec); |
| 5002 | } |
| 5003 | |
| 5004 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5005 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5006 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5007 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5008 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5009 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5010 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5011 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5012 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5013 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5014 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5015 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5016 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5017 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5018 | { } /* end */ |
| 5019 | }; |
| 5020 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5021 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5022 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5023 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5024 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5025 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5026 | * revisions available in early 2006. Therefore for now allow the |
| 5027 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5028 | * that the lack of mic bias for this NID is intentional we could change the |
| 5029 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5030 | * |
| 5031 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5032 | * don't appear to make the mic bias available from the "line" jack, even |
| 5033 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5034 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5035 | * and the output jack. If this turns out to be the case for all such |
| 5036 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5037 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5038 | * |
| 5039 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5040 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5041 | * controls for such models. On models without a "mono speaker" the control |
| 5042 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5043 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5044 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5045 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5046 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5047 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5048 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5049 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5050 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5051 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5052 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5053 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5054 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5055 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5056 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5057 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5058 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5059 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5060 | { } /* end */ |
| 5061 | }; |
| 5062 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5063 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5064 | */ |
| 5065 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5066 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5067 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5068 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5069 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5070 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5071 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5072 | { } /* end */ |
| 5073 | }; |
| 5074 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5075 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5076 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5077 | */ |
| 5078 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5079 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5080 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5081 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5082 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5083 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5085 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5086 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5087 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5088 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5089 | { } /* end */ |
| 5090 | }; |
| 5091 | |
| 5092 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5093 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5094 | */ |
| 5095 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5096 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5097 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5098 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5099 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5100 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5101 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5102 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5103 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5104 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5105 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5106 | { } /* end */ |
| 5107 | }; |
| 5108 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5109 | /* |
| 5110 | * initialization verbs |
| 5111 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5112 | static struct hda_verb alc260_init_verbs[] = { |
| 5113 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5114 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5115 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5116 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5117 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5118 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5119 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5120 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5121 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5122 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5123 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5124 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5125 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5126 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5127 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5128 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5129 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5130 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5131 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5132 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5133 | /* set connection select to line in (default select for this ADC) */ |
| 5134 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5135 | /* mute capture amp left and right */ |
| 5136 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5137 | /* set connection select to line in (default select for this ADC) */ |
| 5138 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5139 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5140 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5141 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5142 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5143 | /* set vol=0 HP mixer amp left and right */ |
| 5144 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5145 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5146 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5147 | /* set vol=0 Mono mixer amp left and right */ |
| 5148 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5149 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5150 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5151 | /* unmute LINE-2 out pin */ |
| 5152 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5153 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5154 | * Line In 2 = 0x03 |
| 5155 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5156 | /* mute analog inputs */ |
| 5157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5158 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5159 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5161 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5162 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5163 | /* mute Front out path */ |
| 5164 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5165 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5166 | /* mute Headphone out path */ |
| 5167 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5168 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5169 | /* mute Mono out path */ |
| 5170 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5171 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5172 | { } |
| 5173 | }; |
| 5174 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5175 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5176 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5177 | /* Headphone and output */ |
| 5178 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5179 | /* mono output */ |
| 5180 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5181 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5182 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5183 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5184 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5185 | /* Line In pin widget for input */ |
| 5186 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5187 | /* Line-2 pin widget for output */ |
| 5188 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5189 | /* CD pin widget for input */ |
| 5190 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5191 | /* unmute amp left and right */ |
| 5192 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5193 | /* set connection select to line in (default select for this ADC) */ |
| 5194 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5195 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5196 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5197 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5198 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5199 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5200 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5201 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5202 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5203 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5204 | * Line In 2 = 0x03 |
| 5205 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5206 | /* mute analog inputs */ |
| 5207 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5208 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5210 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5211 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5212 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5213 | /* Unmute Front out path */ |
| 5214 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5215 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5216 | /* Unmute Headphone out path */ |
| 5217 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5218 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5219 | /* Unmute Mono out path */ |
| 5220 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5221 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5222 | { } |
| 5223 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5224 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5225 | |
| 5226 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5227 | /* Line out and output */ |
| 5228 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5229 | /* mono output */ |
| 5230 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5231 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5232 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5233 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5234 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5235 | /* Line In pin widget for input */ |
| 5236 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5237 | /* Headphone pin widget for output */ |
| 5238 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5239 | /* CD pin widget for input */ |
| 5240 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5241 | /* unmute amp left and right */ |
| 5242 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5243 | /* set connection select to line in (default select for this ADC) */ |
| 5244 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5245 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5246 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5247 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5248 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5249 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5250 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5251 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5252 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5253 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5254 | * Line In 2 = 0x03 |
| 5255 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5256 | /* mute analog inputs */ |
| 5257 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5258 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5259 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5260 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5261 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5262 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5263 | /* Unmute Front out path */ |
| 5264 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5266 | /* Unmute Headphone out path */ |
| 5267 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5268 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5269 | /* Unmute Mono out path */ |
| 5270 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5271 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5272 | { } |
| 5273 | }; |
| 5274 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5275 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5276 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5277 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5278 | */ |
| 5279 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5280 | /* Disable all GPIOs */ |
| 5281 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5282 | /* Internal speaker is connected to headphone pin */ |
| 5283 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5284 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5285 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5286 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5287 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5288 | /* Ensure all other unused pins are disabled and muted. */ |
| 5289 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5290 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5291 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5292 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5293 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5294 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5296 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5297 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5298 | /* Disable digital (SPDIF) pins */ |
| 5299 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5300 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5301 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5302 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5303 | * when acting as an output. |
| 5304 | */ |
| 5305 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5306 | |
| 5307 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5308 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5309 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5310 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5311 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5312 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5313 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5314 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5315 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5316 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5317 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5318 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5319 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5320 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5321 | * If the pin mode is changed by the user the pin mode control will |
| 5322 | * take care of enabling the pin's input/output buffers as needed. |
| 5323 | * Therefore there's no need to enable the input buffer at this |
| 5324 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5325 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5326 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5327 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5328 | * mixer ctrl) |
| 5329 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5330 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5331 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5332 | /* Mute capture amp left and right */ |
| 5333 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5334 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5335 | * in (on mic1 pin) |
| 5336 | */ |
| 5337 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5338 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5339 | /* Do the same for the second ADC: mute capture input amp and |
| 5340 | * set ADC connection to line in (on mic1 pin) |
| 5341 | */ |
| 5342 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5343 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5344 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5345 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5346 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5347 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5348 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5349 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5350 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5351 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5352 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5353 | {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] | 5354 | |
| 5355 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5356 | }; |
| 5357 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5358 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5359 | * similar laptops (adapted from Fujitsu init verbs). |
| 5360 | */ |
| 5361 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5362 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5363 | * the headphone jack. Turn this on and rely on the standard mute |
| 5364 | * methods whenever the user wants to turn these outputs off. |
| 5365 | */ |
| 5366 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5367 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5368 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5369 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5370 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5371 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5372 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5373 | /* Line In jack is connected to Line1 pin */ |
| 5374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5375 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5376 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5377 | /* Ensure all other unused pins are disabled and muted. */ |
| 5378 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5379 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5380 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5381 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5383 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5384 | /* Disable digital (SPDIF) pins */ |
| 5385 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5386 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5387 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5388 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5389 | * bus when acting as outputs. |
| 5390 | */ |
| 5391 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5392 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5393 | |
| 5394 | /* Start with output sum widgets muted and their output gains at min */ |
| 5395 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5396 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5398 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5399 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5400 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5401 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5402 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5403 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5404 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5405 | /* Unmute Line-out pin widget amp left and right |
| 5406 | * (no equiv mixer ctrl) |
| 5407 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5408 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5409 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5410 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5411 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5412 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5413 | * will take care of enabling the pin's input/output buffers as needed. |
| 5414 | * Therefore there's no need to enable the input buffer at this |
| 5415 | * stage. |
| 5416 | */ |
| 5417 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5418 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5419 | |
| 5420 | /* Mute capture amp left and right */ |
| 5421 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5422 | /* Set ADC connection select to match default mixer setting - mic |
| 5423 | * (on mic1 pin) |
| 5424 | */ |
| 5425 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5426 | |
| 5427 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5428 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5429 | */ |
| 5430 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5431 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5432 | |
| 5433 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5434 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5435 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5437 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5438 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5439 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5440 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5441 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5442 | |
| 5443 | { } |
| 5444 | }; |
| 5445 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5446 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5447 | * (adapted from Acer init verbs). |
| 5448 | */ |
| 5449 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5450 | /* GPIO 0 enables the output jack. |
| 5451 | * Turn this on and rely on the standard mute |
| 5452 | * methods whenever the user wants to turn these outputs off. |
| 5453 | */ |
| 5454 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5455 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5456 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5457 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5458 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5459 | /* Ensure all other unused pins are disabled and muted. */ |
| 5460 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5461 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5462 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5463 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5464 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5465 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5466 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5467 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5470 | /* Disable digital (SPDIF) pins */ |
| 5471 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5472 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5473 | |
| 5474 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5475 | * bus when acting as outputs. |
| 5476 | */ |
| 5477 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5478 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5479 | |
| 5480 | /* Start with output sum widgets muted and their output gains at min */ |
| 5481 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5482 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5483 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5484 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5485 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5486 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5487 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5488 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5489 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5490 | |
| 5491 | /* Unmute Line-out pin widget amp left and right |
| 5492 | * (no equiv mixer ctrl) |
| 5493 | */ |
| 5494 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5495 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5496 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5497 | * will take care of enabling the pin's input/output buffers as needed. |
| 5498 | * Therefore there's no need to enable the input buffer at this |
| 5499 | * stage. |
| 5500 | */ |
| 5501 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5502 | |
| 5503 | /* Mute capture amp left and right */ |
| 5504 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5505 | /* Set ADC connection select to match default mixer setting - mic |
| 5506 | * (on mic1 pin) |
| 5507 | */ |
| 5508 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5509 | |
| 5510 | /* Do similar with the second ADC: mute capture input amp and |
| 5511 | * set ADC connection to mic to match ALSA's default state. |
| 5512 | */ |
| 5513 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5514 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5515 | |
| 5516 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5517 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5518 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5519 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5520 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5521 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5522 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5523 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5524 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5525 | |
| 5526 | { } |
| 5527 | }; |
| 5528 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5529 | static struct hda_verb alc260_will_verbs[] = { |
| 5530 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5531 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5532 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5533 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5534 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5535 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5536 | {} |
| 5537 | }; |
| 5538 | |
| 5539 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5540 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5541 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5542 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5543 | |
| 5544 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5545 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5546 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5547 | |
| 5548 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5549 | {} |
| 5550 | }; |
| 5551 | |
| 5552 | /* toggle speaker-output according to the hp-jack state */ |
| 5553 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5554 | { |
| 5555 | unsigned int present; |
| 5556 | |
| 5557 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5558 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5559 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5560 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5561 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5562 | AC_VERB_SET_GPIO_DATA, 1); |
| 5563 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5564 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5565 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5566 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5567 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5568 | AC_VERB_SET_GPIO_DATA, 0); |
| 5569 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5570 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5571 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5572 | } |
| 5573 | } |
| 5574 | |
| 5575 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5576 | unsigned int res) |
| 5577 | { |
| 5578 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5579 | alc260_replacer_672v_automute(codec); |
| 5580 | } |
| 5581 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5582 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5583 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5584 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5585 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5586 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5587 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5588 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5589 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5590 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5591 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5592 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5593 | {} |
| 5594 | }; |
| 5595 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5596 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5597 | * configuration. |
| 5598 | */ |
| 5599 | #ifdef CONFIG_SND_DEBUG |
| 5600 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5601 | 0x02, |
| 5602 | }; |
| 5603 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5604 | 0x04, 0x05, |
| 5605 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5606 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5607 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5608 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5609 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5610 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5611 | { |
| 5612 | .num_items = 7, |
| 5613 | .items = { |
| 5614 | { "MIC1 pin", 0x0 }, |
| 5615 | { "MIC2 pin", 0x1 }, |
| 5616 | { "LINE1 pin", 0x2 }, |
| 5617 | { "LINE2 pin", 0x3 }, |
| 5618 | { "CD pin", 0x4 }, |
| 5619 | { "LINE-OUT pin", 0x5 }, |
| 5620 | { "HP-OUT pin", 0x6 }, |
| 5621 | }, |
| 5622 | }, |
| 5623 | { |
| 5624 | .num_items = 8, |
| 5625 | .items = { |
| 5626 | { "MIC1 pin", 0x0 }, |
| 5627 | { "MIC2 pin", 0x1 }, |
| 5628 | { "LINE1 pin", 0x2 }, |
| 5629 | { "LINE2 pin", 0x3 }, |
| 5630 | { "CD pin", 0x4 }, |
| 5631 | { "Mixer", 0x5 }, |
| 5632 | { "LINE-OUT pin", 0x6 }, |
| 5633 | { "HP-OUT pin", 0x7 }, |
| 5634 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5635 | }, |
| 5636 | }; |
| 5637 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5638 | /* Output driver widgets */ |
| 5639 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5640 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5641 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5642 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5643 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5644 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5645 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5646 | /* Modes for retasking pin widgets |
| 5647 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5648 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5649 | * mention this restriction. At this stage it's not clear whether |
| 5650 | * this behaviour is intentional or is a hardware bug in chip |
| 5651 | * revisions available at least up until early 2006. Therefore for |
| 5652 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5653 | * choices, but if it turns out that the lack of mic bias for these |
| 5654 | * NIDs is intentional we could change their modes from |
| 5655 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5656 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5657 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5658 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5659 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5660 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5661 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5662 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5663 | |
| 5664 | /* Loopback mixer controls */ |
| 5665 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5666 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5667 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5668 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5669 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5670 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5671 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5672 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5673 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5674 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5675 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5676 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5677 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5678 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5679 | |
| 5680 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5681 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5682 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5683 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5684 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5685 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5686 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5687 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5688 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5689 | */ |
| 5690 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5691 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5692 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5693 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5694 | * this output to turn on an external amplifier. |
| 5695 | */ |
| 5696 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5697 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5698 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5699 | { } /* end */ |
| 5700 | }; |
| 5701 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5702 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5703 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5704 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5705 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5706 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5707 | /* Enable retasking pins as output, initially without power amp */ |
| 5708 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5709 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5710 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5711 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5712 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5713 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5714 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5715 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5716 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5717 | * payload also sets the generation to 0, output to be in "consumer" |
| 5718 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5719 | * control. |
| 5720 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5721 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5722 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5723 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5724 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5725 | * OUT1 sum bus when acting as an output. |
| 5726 | */ |
| 5727 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5728 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5729 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5730 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5731 | |
| 5732 | /* Start with output sum widgets muted and their output gains at min */ |
| 5733 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5734 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5735 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5736 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5737 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5738 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5739 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5740 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5741 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5742 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5743 | /* Unmute retasking pin widget output buffers since the default |
| 5744 | * state appears to be output. As the pin mode is changed by the |
| 5745 | * user the pin mode control will take care of enabling the pin's |
| 5746 | * input/output buffers as needed. |
| 5747 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5748 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5749 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5751 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5752 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5753 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5754 | /* Also unmute the mono-out pin widget */ |
| 5755 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5756 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5757 | /* Mute capture amp left and right */ |
| 5758 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5759 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5760 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5761 | */ |
| 5762 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5763 | |
| 5764 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5765 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5766 | */ |
| 5767 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5768 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5769 | |
| 5770 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5771 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5772 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5773 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5774 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5775 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5776 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5777 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5778 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5779 | |
| 5780 | { } |
| 5781 | }; |
| 5782 | #endif |
| 5783 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5784 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5785 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5786 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5787 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5788 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5790 | /* |
| 5791 | * for BIOS auto-configuration |
| 5792 | */ |
| 5793 | |
| 5794 | 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] | 5795 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5796 | { |
| 5797 | hda_nid_t nid_vol; |
| 5798 | unsigned long vol_val, sw_val; |
| 5799 | char name[32]; |
| 5800 | int err; |
| 5801 | |
| 5802 | if (nid >= 0x0f && nid < 0x11) { |
| 5803 | nid_vol = nid - 0x7; |
| 5804 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5805 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5806 | } else if (nid == 0x11) { |
| 5807 | nid_vol = nid - 0x7; |
| 5808 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5809 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5810 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5811 | nid_vol = 0x08; |
| 5812 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5813 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5814 | } else |
| 5815 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5816 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5817 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5818 | /* first control for the volume widget */ |
| 5819 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5820 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5821 | if (err < 0) |
| 5822 | return err; |
| 5823 | *vol_bits |= (1 << nid_vol); |
| 5824 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5825 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5826 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5827 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5828 | return err; |
| 5829 | return 1; |
| 5830 | } |
| 5831 | |
| 5832 | /* add playback controls from the parsed DAC table */ |
| 5833 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5834 | const struct auto_pin_cfg *cfg) |
| 5835 | { |
| 5836 | hda_nid_t nid; |
| 5837 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5838 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5839 | |
| 5840 | spec->multiout.num_dacs = 1; |
| 5841 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5842 | spec->multiout.dac_nids[0] = 0x02; |
| 5843 | |
| 5844 | nid = cfg->line_out_pins[0]; |
| 5845 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5846 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5847 | if (err < 0) |
| 5848 | return err; |
| 5849 | } |
| 5850 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5851 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5852 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5853 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5854 | if (err < 0) |
| 5855 | return err; |
| 5856 | } |
| 5857 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5858 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5859 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5860 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5861 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | if (err < 0) |
| 5863 | return err; |
| 5864 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5865 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | } |
| 5867 | |
| 5868 | /* create playback/capture controls for input pins */ |
| 5869 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5870 | const struct auto_pin_cfg *cfg) |
| 5871 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5872 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5873 | int i, err, idx; |
| 5874 | |
| 5875 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5876 | if (cfg->input_pins[i] >= 0x12) { |
| 5877 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5878 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5879 | auto_pin_cfg_labels[i], idx, |
| 5880 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5881 | if (err < 0) |
| 5882 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5883 | imux->items[imux->num_items].label = |
| 5884 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5885 | imux->items[imux->num_items].index = idx; |
| 5886 | imux->num_items++; |
| 5887 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5888 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5889 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5890 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5891 | auto_pin_cfg_labels[i], idx, |
| 5892 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5893 | if (err < 0) |
| 5894 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5895 | imux->items[imux->num_items].label = |
| 5896 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5897 | imux->items[imux->num_items].index = idx; |
| 5898 | imux->num_items++; |
| 5899 | } |
| 5900 | } |
| 5901 | return 0; |
| 5902 | } |
| 5903 | |
| 5904 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5905 | hda_nid_t nid, int pin_type, |
| 5906 | int sel_idx) |
| 5907 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5908 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5909 | /* need the manual connection? */ |
| 5910 | if (nid >= 0x12) { |
| 5911 | int idx = nid - 0x12; |
| 5912 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5913 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5914 | } |
| 5915 | } |
| 5916 | |
| 5917 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5918 | { |
| 5919 | struct alc_spec *spec = codec->spec; |
| 5920 | hda_nid_t nid; |
| 5921 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5922 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5923 | if (nid) { |
| 5924 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5925 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5926 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5927 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5928 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5929 | if (nid) |
| 5930 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5931 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5932 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5933 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5934 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5935 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5936 | |
| 5937 | #define ALC260_PIN_CD_NID 0x16 |
| 5938 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5939 | { |
| 5940 | struct alc_spec *spec = codec->spec; |
| 5941 | int i; |
| 5942 | |
| 5943 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5944 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5945 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5946 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5947 | if (nid != ALC260_PIN_CD_NID && |
| 5948 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5949 | snd_hda_codec_write(codec, nid, 0, |
| 5950 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5951 | AMP_OUT_MUTE); |
| 5952 | } |
| 5953 | } |
| 5954 | } |
| 5955 | |
| 5956 | /* |
| 5957 | * generic initialization of ADC, input mixers and output mixers |
| 5958 | */ |
| 5959 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5960 | /* |
| 5961 | * Unmute ADC0-1 and set the default input to mic-in |
| 5962 | */ |
| 5963 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5964 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5965 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5966 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5967 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5968 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5969 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5970 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5971 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5972 | */ |
| 5973 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5974 | /* mute analog inputs */ |
| 5975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5976 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5977 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5980 | |
| 5981 | /* |
| 5982 | * Set up output mixers (0x08 - 0x0a) |
| 5983 | */ |
| 5984 | /* set vol=0 to output mixers */ |
| 5985 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5987 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5988 | /* set up input amps for analog loopback */ |
| 5989 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5990 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5991 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5992 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5993 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5994 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5995 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5996 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5997 | { } |
| 5998 | }; |
| 5999 | |
| 6000 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6001 | { |
| 6002 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6003 | int err; |
| 6004 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6005 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6006 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6007 | alc260_ignore); |
| 6008 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6009 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6010 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6011 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6012 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6013 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6015 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 6016 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6017 | return err; |
| 6018 | |
| 6019 | spec->multiout.max_channels = 2; |
| 6020 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6021 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6022 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6023 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6024 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6025 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6026 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6027 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6028 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6029 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6030 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6031 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6032 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6033 | return 1; |
| 6034 | } |
| 6035 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6036 | /* additional initialization for auto-configuration model */ |
| 6037 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6038 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6039 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6040 | alc260_auto_init_multi_out(codec); |
| 6041 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6042 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6043 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6044 | } |
| 6045 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6046 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6047 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6048 | { 0x07, HDA_INPUT, 0 }, |
| 6049 | { 0x07, HDA_INPUT, 1 }, |
| 6050 | { 0x07, HDA_INPUT, 2 }, |
| 6051 | { 0x07, HDA_INPUT, 3 }, |
| 6052 | { 0x07, HDA_INPUT, 4 }, |
| 6053 | { } /* end */ |
| 6054 | }; |
| 6055 | #endif |
| 6056 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6057 | /* |
| 6058 | * ALC260 configurations |
| 6059 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6060 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6061 | [ALC260_BASIC] = "basic", |
| 6062 | [ALC260_HP] = "hp", |
| 6063 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6064 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6065 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6066 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6067 | [ALC260_WILL] = "will", |
| 6068 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6069 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6070 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6071 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6072 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6073 | [ALC260_AUTO] = "auto", |
| 6074 | }; |
| 6075 | |
| 6076 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6077 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6078 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6079 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6080 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6081 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6082 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6083 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6084 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6085 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6086 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6087 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6088 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6089 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6090 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6091 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6092 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6093 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6094 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6095 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6096 | {} |
| 6097 | }; |
| 6098 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6099 | static struct alc_config_preset alc260_presets[] = { |
| 6100 | [ALC260_BASIC] = { |
| 6101 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6102 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6103 | .init_verbs = { alc260_init_verbs }, |
| 6104 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6105 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6106 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6107 | .adc_nids = alc260_adc_nids, |
| 6108 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6109 | .channel_mode = alc260_modes, |
| 6110 | .input_mux = &alc260_capture_source, |
| 6111 | }, |
| 6112 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6113 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6114 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6115 | .init_verbs = { alc260_init_verbs, |
| 6116 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6117 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6118 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6119 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6120 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6121 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6122 | .channel_mode = alc260_modes, |
| 6123 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6124 | .unsol_event = alc260_hp_unsol_event, |
| 6125 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6126 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6127 | [ALC260_HP_DC7600] = { |
| 6128 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6129 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6130 | .init_verbs = { alc260_init_verbs, |
| 6131 | alc260_hp_dc7600_verbs }, |
| 6132 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6133 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6134 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6135 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6136 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6137 | .channel_mode = alc260_modes, |
| 6138 | .input_mux = &alc260_capture_source, |
| 6139 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6140 | .init_hook = alc260_hp_3012_automute, |
| 6141 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6142 | [ALC260_HP_3013] = { |
| 6143 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6144 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6145 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6146 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6147 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6148 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6149 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6150 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6151 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6152 | .channel_mode = alc260_modes, |
| 6153 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6154 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6155 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6156 | }, |
| 6157 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6158 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6159 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6160 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6161 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6162 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6163 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6164 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6165 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6166 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6167 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6168 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6169 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6170 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6171 | .init_verbs = { alc260_acer_init_verbs }, |
| 6172 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6173 | .dac_nids = alc260_dac_nids, |
| 6174 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6175 | .adc_nids = alc260_dual_adc_nids, |
| 6176 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6177 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6178 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6179 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6180 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6181 | [ALC260_FAVORIT100] = { |
| 6182 | .mixers = { alc260_favorit100_mixer }, |
| 6183 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6184 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6185 | .dac_nids = alc260_dac_nids, |
| 6186 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6187 | .adc_nids = alc260_dual_adc_nids, |
| 6188 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6189 | .channel_mode = alc260_modes, |
| 6190 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6191 | .input_mux = alc260_favorit100_capture_sources, |
| 6192 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6193 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6194 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6195 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6196 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6197 | .dac_nids = alc260_dac_nids, |
| 6198 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6199 | .adc_nids = alc260_adc_nids, |
| 6200 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6201 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6202 | .channel_mode = alc260_modes, |
| 6203 | .input_mux = &alc260_capture_source, |
| 6204 | }, |
| 6205 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6206 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6207 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6208 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6209 | .dac_nids = alc260_dac_nids, |
| 6210 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6211 | .adc_nids = alc260_adc_nids, |
| 6212 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6213 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6214 | .channel_mode = alc260_modes, |
| 6215 | .input_mux = &alc260_capture_source, |
| 6216 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6217 | .init_hook = alc260_replacer_672v_automute, |
| 6218 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6219 | #ifdef CONFIG_SND_DEBUG |
| 6220 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6221 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6222 | .init_verbs = { alc260_test_init_verbs }, |
| 6223 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6224 | .dac_nids = alc260_test_dac_nids, |
| 6225 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6226 | .adc_nids = alc260_test_adc_nids, |
| 6227 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6228 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6229 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6230 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6231 | }, |
| 6232 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | }; |
| 6234 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6235 | static int patch_alc260(struct hda_codec *codec) |
| 6236 | { |
| 6237 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6238 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6239 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6240 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6241 | if (spec == NULL) |
| 6242 | return -ENOMEM; |
| 6243 | |
| 6244 | codec->spec = spec; |
| 6245 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6246 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6247 | alc260_models, |
| 6248 | alc260_cfg_tbl); |
| 6249 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6250 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6251 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6252 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6253 | } |
| 6254 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6255 | if (board_config == ALC260_AUTO) { |
| 6256 | /* automatic parse from the BIOS config */ |
| 6257 | err = alc260_parse_auto_config(codec); |
| 6258 | if (err < 0) { |
| 6259 | alc_free(codec); |
| 6260 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6261 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6262 | printk(KERN_INFO |
| 6263 | "hda_codec: Cannot set up configuration " |
| 6264 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6265 | board_config = ALC260_BASIC; |
| 6266 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6267 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6268 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6269 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6270 | if (err < 0) { |
| 6271 | alc_free(codec); |
| 6272 | return err; |
| 6273 | } |
| 6274 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6275 | if (board_config != ALC260_AUTO) |
| 6276 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6277 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6278 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6279 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6280 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6281 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6282 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6283 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6284 | if (!spec->adc_nids && spec->input_mux) { |
| 6285 | /* check whether NID 0x04 is valid */ |
| 6286 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6287 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6288 | /* get type */ |
| 6289 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6290 | spec->adc_nids = alc260_adc_nids_alt; |
| 6291 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6292 | } else { |
| 6293 | spec->adc_nids = alc260_adc_nids; |
| 6294 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6295 | } |
| 6296 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6297 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6298 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6299 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6300 | spec->vmaster_nid = 0x08; |
| 6301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6302 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6303 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6304 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6305 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6306 | if (!spec->loopback.amplist) |
| 6307 | spec->loopback.amplist = alc260_loopbacks; |
| 6308 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6309 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6310 | |
| 6311 | return 0; |
| 6312 | } |
| 6313 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6314 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6315 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6316 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6317 | * |
| 6318 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6319 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6320 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6321 | * 6-channel independent captures. |
| 6322 | * |
| 6323 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6324 | * driver yet). |
| 6325 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6326 | #define ALC882_DIGOUT_NID 0x06 |
| 6327 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6328 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6329 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6330 | #define ALC1200_DIGOUT_NID 0x10 |
| 6331 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6332 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6333 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6334 | { 8, NULL } |
| 6335 | }; |
| 6336 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6337 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6338 | static hda_nid_t alc882_dac_nids[4] = { |
| 6339 | /* front, rear, clfe, rear_surr */ |
| 6340 | 0x02, 0x03, 0x04, 0x05 |
| 6341 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6342 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6343 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6344 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6345 | #define alc882_adc_nids alc880_adc_nids |
| 6346 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6347 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6348 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6349 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6350 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6351 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6352 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6353 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6354 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6355 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6356 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6358 | /* input MUX */ |
| 6359 | /* FIXME: should be a matrix-type input source selection */ |
| 6360 | |
| 6361 | static struct hda_input_mux alc882_capture_source = { |
| 6362 | .num_items = 4, |
| 6363 | .items = { |
| 6364 | { "Mic", 0x0 }, |
| 6365 | { "Front Mic", 0x1 }, |
| 6366 | { "Line", 0x2 }, |
| 6367 | { "CD", 0x4 }, |
| 6368 | }, |
| 6369 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6370 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6371 | #define alc883_capture_source alc882_capture_source |
| 6372 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6373 | static struct hda_input_mux alc889_capture_source = { |
| 6374 | .num_items = 3, |
| 6375 | .items = { |
| 6376 | { "Front Mic", 0x0 }, |
| 6377 | { "Mic", 0x3 }, |
| 6378 | { "Line", 0x2 }, |
| 6379 | }, |
| 6380 | }; |
| 6381 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6382 | static struct hda_input_mux mb5_capture_source = { |
| 6383 | .num_items = 3, |
| 6384 | .items = { |
| 6385 | { "Mic", 0x1 }, |
| 6386 | { "Line", 0x2 }, |
| 6387 | { "CD", 0x4 }, |
| 6388 | }, |
| 6389 | }; |
| 6390 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6391 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6392 | .num_items = 4, |
| 6393 | .items = { |
| 6394 | { "Mic", 0x1 }, |
| 6395 | { "Front Mic", 0x0 }, |
| 6396 | { "Line", 0x2 }, |
| 6397 | { "CD", 0x4 }, |
| 6398 | }, |
| 6399 | }; |
| 6400 | |
| 6401 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6402 | .num_items = 2, |
| 6403 | .items = { |
| 6404 | { "Mic", 0x1 }, |
| 6405 | { "Line", 0x2 }, |
| 6406 | }, |
| 6407 | }; |
| 6408 | |
| 6409 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6410 | .num_items = 4, |
| 6411 | .items = { |
| 6412 | { "Mic", 0x0 }, |
| 6413 | { "iMic", 0x1 }, |
| 6414 | { "Line", 0x2 }, |
| 6415 | { "CD", 0x4 }, |
| 6416 | }, |
| 6417 | }; |
| 6418 | |
| 6419 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6420 | .num_items = 2, |
| 6421 | .items = { |
| 6422 | { "Mic", 0x0 }, |
| 6423 | { "Int Mic", 0x1 }, |
| 6424 | }, |
| 6425 | }; |
| 6426 | |
| 6427 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6428 | .num_items = 3, |
| 6429 | .items = { |
| 6430 | { "Mic", 0x0 }, |
| 6431 | { "Front Mic", 0x1 }, |
| 6432 | { "Line", 0x4 }, |
| 6433 | }, |
| 6434 | }; |
| 6435 | |
| 6436 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6437 | .num_items = 2, |
| 6438 | .items = { |
| 6439 | { "Mic", 0x0 }, |
| 6440 | { "Line", 0x2 }, |
| 6441 | }, |
| 6442 | }; |
| 6443 | |
| 6444 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6445 | .num_items = 2, |
| 6446 | .items = { |
| 6447 | { "Mic", 0x0 }, |
| 6448 | /* Front Mic (0x01) unused */ |
| 6449 | { "Line", 0x2 }, |
| 6450 | /* Line 2 (0x03) unused */ |
| 6451 | /* CD (0x04) unsused? */ |
| 6452 | }, |
| 6453 | }; |
| 6454 | |
| 6455 | /* |
| 6456 | * 2ch mode |
| 6457 | */ |
| 6458 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6459 | { 2, NULL } |
| 6460 | }; |
| 6461 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6462 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6463 | * 2ch mode |
| 6464 | */ |
| 6465 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6466 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6467 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6468 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6469 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6470 | { } /* end */ |
| 6471 | }; |
| 6472 | |
| 6473 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6474 | * 4ch mode |
| 6475 | */ |
| 6476 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6477 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6478 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6479 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6480 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6481 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6482 | { } /* end */ |
| 6483 | }; |
| 6484 | |
| 6485 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6486 | * 6ch mode |
| 6487 | */ |
| 6488 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6489 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6490 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6491 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6492 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6493 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6494 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6495 | { } /* end */ |
| 6496 | }; |
| 6497 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6498 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6499 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6500 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6501 | { 6, alc882_3ST_ch6_init }, |
| 6502 | }; |
| 6503 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6504 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6505 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6506 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6507 | * 6ch mode |
| 6508 | */ |
| 6509 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6510 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6511 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6512 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6513 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6514 | { } /* end */ |
| 6515 | }; |
| 6516 | |
| 6517 | /* |
| 6518 | * 8ch mode |
| 6519 | */ |
| 6520 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6521 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6522 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6523 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6524 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6525 | { } /* end */ |
| 6526 | }; |
| 6527 | |
| 6528 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6529 | { 6, alc882_sixstack_ch6_init }, |
| 6530 | { 8, alc882_sixstack_ch8_init }, |
| 6531 | }; |
| 6532 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6533 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6534 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6535 | */ |
| 6536 | |
| 6537 | /* |
| 6538 | * 2ch mode |
| 6539 | */ |
| 6540 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6541 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6542 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6543 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6544 | { } /* end */ |
| 6545 | }; |
| 6546 | |
| 6547 | /* |
| 6548 | * 6ch mode |
| 6549 | */ |
| 6550 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6551 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6552 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6553 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6554 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6555 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6556 | { } /* end */ |
| 6557 | }; |
| 6558 | |
| 6559 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6560 | { 2, alc885_mbp_ch2_init }, |
| 6561 | { 6, alc885_mbp_ch6_init }, |
| 6562 | }; |
| 6563 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6564 | /* |
| 6565 | * 2ch |
| 6566 | * Speakers/Woofer/HP = Front |
| 6567 | * LineIn = Input |
| 6568 | */ |
| 6569 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6570 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6571 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6572 | { } /* end */ |
| 6573 | }; |
| 6574 | |
| 6575 | /* |
| 6576 | * 6ch mode |
| 6577 | * Speakers/HP = Front |
| 6578 | * Woofer = LFE |
| 6579 | * LineIn = Surround |
| 6580 | */ |
| 6581 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6582 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6583 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6584 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6585 | { } /* end */ |
| 6586 | }; |
| 6587 | |
| 6588 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6589 | { 2, alc885_mb5_ch2_init }, |
| 6590 | { 6, alc885_mb5_ch6_init }, |
| 6591 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6592 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6593 | |
| 6594 | /* |
| 6595 | * 2ch mode |
| 6596 | */ |
| 6597 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6598 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6599 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6600 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6601 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6602 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6603 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6604 | { } /* end */ |
| 6605 | }; |
| 6606 | |
| 6607 | /* |
| 6608 | * 4ch mode |
| 6609 | */ |
| 6610 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6611 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6612 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6613 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6614 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6615 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6616 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6617 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6618 | { } /* end */ |
| 6619 | }; |
| 6620 | |
| 6621 | /* |
| 6622 | * 6ch mode |
| 6623 | */ |
| 6624 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6625 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6626 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6627 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6628 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6629 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6630 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6631 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6632 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6633 | { } /* end */ |
| 6634 | }; |
| 6635 | |
| 6636 | /* |
| 6637 | * 8ch mode |
| 6638 | */ |
| 6639 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6640 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6641 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6642 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6643 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6644 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6645 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6646 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6647 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6648 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6649 | { } /* end */ |
| 6650 | }; |
| 6651 | |
| 6652 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6653 | { 2, alc883_4ST_ch2_init }, |
| 6654 | { 4, alc883_4ST_ch4_init }, |
| 6655 | { 6, alc883_4ST_ch6_init }, |
| 6656 | { 8, alc883_4ST_ch8_init }, |
| 6657 | }; |
| 6658 | |
| 6659 | |
| 6660 | /* |
| 6661 | * 2ch mode |
| 6662 | */ |
| 6663 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6664 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6665 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6666 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6667 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6668 | { } /* end */ |
| 6669 | }; |
| 6670 | |
| 6671 | /* |
| 6672 | * 4ch mode |
| 6673 | */ |
| 6674 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6675 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6676 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6677 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6678 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6679 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6680 | { } /* end */ |
| 6681 | }; |
| 6682 | |
| 6683 | /* |
| 6684 | * 6ch mode |
| 6685 | */ |
| 6686 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6687 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6688 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6689 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6690 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6691 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6692 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6693 | { } /* end */ |
| 6694 | }; |
| 6695 | |
| 6696 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6697 | { 2, alc883_3ST_ch2_intel_init }, |
| 6698 | { 4, alc883_3ST_ch4_intel_init }, |
| 6699 | { 6, alc883_3ST_ch6_intel_init }, |
| 6700 | }; |
| 6701 | |
| 6702 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6703 | * 2ch mode |
| 6704 | */ |
| 6705 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6706 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6707 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6708 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6709 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6710 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6711 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6712 | { } /* end */ |
| 6713 | }; |
| 6714 | |
| 6715 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6716 | * 6ch mode |
| 6717 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6718 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6719 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6720 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6721 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6722 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6723 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6724 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6725 | { } /* end */ |
| 6726 | }; |
| 6727 | |
| 6728 | /* |
| 6729 | * 8ch mode |
| 6730 | */ |
| 6731 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6732 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6733 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6734 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6735 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6736 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6737 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6738 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6739 | { } /* end */ |
| 6740 | }; |
| 6741 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6742 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6743 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6744 | { 6, alc889_ch6_intel_init }, |
| 6745 | { 8, alc889_ch8_intel_init }, |
| 6746 | }; |
| 6747 | |
| 6748 | /* |
| 6749 | * 6ch mode |
| 6750 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6751 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6752 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6753 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6754 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6755 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6756 | { } /* end */ |
| 6757 | }; |
| 6758 | |
| 6759 | /* |
| 6760 | * 8ch mode |
| 6761 | */ |
| 6762 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6763 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6764 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6765 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6766 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6767 | { } /* end */ |
| 6768 | }; |
| 6769 | |
| 6770 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6771 | { 6, alc883_sixstack_ch6_init }, |
| 6772 | { 8, alc883_sixstack_ch8_init }, |
| 6773 | }; |
| 6774 | |
| 6775 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6776 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6777 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6778 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6779 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6780 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6781 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6782 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6783 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6784 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6785 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6786 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6787 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6788 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6789 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6790 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6791 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6792 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6793 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6794 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6795 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6796 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6798 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6799 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6801 | { } /* end */ |
| 6802 | }; |
| 6803 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6804 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6806 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6807 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6808 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6809 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6810 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6812 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6813 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6814 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6815 | { } /* end */ |
| 6816 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6817 | |
| 6818 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6820 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6821 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6822 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6823 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6824 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6825 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6826 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6827 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6828 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6829 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6830 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6831 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6832 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6833 | { } /* end */ |
| 6834 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6835 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6836 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6837 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6838 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6839 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6840 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6841 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6842 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6844 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6846 | { } /* end */ |
| 6847 | }; |
| 6848 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6849 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6850 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6851 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6852 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6853 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6854 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6855 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6856 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6858 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6859 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6860 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6861 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6862 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6863 | { } /* end */ |
| 6864 | }; |
| 6865 | |
| 6866 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6867 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6868 | */ |
| 6869 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6870 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6871 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6872 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6873 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6874 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6875 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6876 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6877 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6878 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6879 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6882 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6883 | { } /* end */ |
| 6884 | }; |
| 6885 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6886 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6887 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6888 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6890 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6891 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6892 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6893 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6895 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6897 | { } /* end */ |
| 6898 | }; |
| 6899 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6900 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6901 | { |
| 6902 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6903 | .name = "Channel Mode", |
| 6904 | .info = alc_ch_mode_info, |
| 6905 | .get = alc_ch_mode_get, |
| 6906 | .put = alc_ch_mode_put, |
| 6907 | }, |
| 6908 | { } /* end */ |
| 6909 | }; |
| 6910 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6911 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6912 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6916 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6917 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6920 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6923 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6924 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6926 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6927 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6928 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 6929 | /* mute analog input loopbacks */ |
| 6930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6935 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6936 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6939 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6940 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6941 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6942 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6943 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6944 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6945 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6946 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6947 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6948 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6949 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6950 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6951 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6952 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6953 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6954 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6955 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6956 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6957 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6958 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6959 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6960 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6961 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6962 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6963 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6964 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6965 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6966 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6967 | |
| 6968 | /* FIXME: use matrix-type input source selection */ |
| 6969 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6970 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6971 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6972 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6973 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6974 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6975 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6979 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6980 | /* ADC2: mute amp left and right */ |
| 6981 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6982 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6983 | /* ADC3: mute amp left and right */ |
| 6984 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6985 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6986 | |
| 6987 | { } |
| 6988 | }; |
| 6989 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6990 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 6991 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6994 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6995 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6996 | /* ADC1: mute amp left and right */ |
| 6997 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6998 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6999 | { } |
| 7000 | }; |
| 7001 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7002 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7003 | /* change to EAPD mode */ |
| 7004 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7005 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7006 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7007 | }; |
| 7008 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7009 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7010 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7011 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7012 | { } |
| 7013 | }; |
| 7014 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 7015 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7016 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7017 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7018 | {} |
| 7019 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7020 | |
| 7021 | static struct hda_verb alc885_init_verbs[] = { |
| 7022 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7026 | /* Rear mixer */ |
| 7027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7029 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7030 | /* CLFE mixer */ |
| 7031 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7032 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7034 | /* Side mixer */ |
| 7035 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7036 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7037 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7038 | |
| 7039 | /* mute analog input loopbacks */ |
| 7040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7043 | |
| 7044 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 7045 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7046 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7047 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7048 | /* Front Pin: output 0 (0x0c) */ |
| 7049 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7050 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7051 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7052 | /* Rear Pin: output 1 (0x0d) */ |
| 7053 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7054 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7055 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7056 | /* CLFE Pin: output 2 (0x0e) */ |
| 7057 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7058 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7059 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7060 | /* Side Pin: output 3 (0x0f) */ |
| 7061 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7062 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7063 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7064 | /* Mic (rear) pin: input vref at 80% */ |
| 7065 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7066 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7067 | /* Front Mic pin: input vref at 80% */ |
| 7068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7069 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7070 | /* Line In pin: input */ |
| 7071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7072 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7073 | |
| 7074 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7075 | /* Input mixer1 */ |
| 7076 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7077 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7078 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7079 | /* Input mixer2 */ |
| 7080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7082 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7083 | /* Input mixer3 */ |
| 7084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7087 | /* ADC2: mute amp left and right */ |
| 7088 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7089 | /* ADC3: mute amp left and right */ |
| 7090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7091 | |
| 7092 | { } |
| 7093 | }; |
| 7094 | |
| 7095 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7096 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7097 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7098 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7099 | { } |
| 7100 | }; |
| 7101 | |
| 7102 | |
| 7103 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7104 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7105 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7106 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7107 | { } |
| 7108 | }; |
| 7109 | |
| 7110 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7111 | #define alc883_init_verbs alc882_base_init_verbs |
| 7112 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7113 | /* Mac Pro test */ |
| 7114 | static struct snd_kcontrol_new alc882_macpro_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_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7118 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7119 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7120 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7121 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7122 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7123 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7124 | { } /* end */ |
| 7125 | }; |
| 7126 | |
| 7127 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7128 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7130 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7131 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7132 | /* Front Pin: output 0 (0x0c) */ |
| 7133 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7135 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7136 | /* Front Mic pin: input vref at 80% */ |
| 7137 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7138 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7139 | /* Speaker: output */ |
| 7140 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7141 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7142 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7143 | /* Headphone output (output 0 - 0x0c) */ |
| 7144 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7145 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7146 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7147 | |
| 7148 | /* FIXME: use matrix-type input source selection */ |
| 7149 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7150 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7151 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7152 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7153 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7154 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7155 | /* Input mixer2 */ |
| 7156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7157 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7158 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7160 | /* Input mixer3 */ |
| 7161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7162 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7165 | /* ADC1: mute amp left and right */ |
| 7166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7167 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7168 | /* ADC2: mute amp left and right */ |
| 7169 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7170 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7171 | /* ADC3: mute amp left and right */ |
| 7172 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7173 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7174 | |
| 7175 | { } |
| 7176 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7177 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7178 | /* Macbook 5,1 */ |
| 7179 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7180 | /* DACs */ |
| 7181 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7182 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7183 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7184 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7185 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7186 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7187 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7188 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7189 | /* Surround mixer */ |
| 7190 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7191 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7192 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7193 | /* LFE mixer */ |
| 7194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7195 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7196 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7197 | /* HP mixer */ |
| 7198 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7199 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7200 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7201 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7203 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7204 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7205 | /* LFE Pin (0x0e) */ |
| 7206 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7207 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7208 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7209 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7210 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7211 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7212 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7213 | /* Front Mic pin: input vref at 80% */ |
| 7214 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7215 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7216 | /* Line In pin */ |
| 7217 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7218 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7219 | |
| 7220 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7221 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7222 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7223 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7224 | { } |
| 7225 | }; |
| 7226 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7227 | /* Macbook Pro rev3 */ |
| 7228 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7229 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7232 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7233 | /* Rear mixer */ |
| 7234 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7235 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7236 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7237 | /* Front Pin: output 0 (0x0c) */ |
| 7238 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7239 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7240 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7241 | /* HP Pin: output 0 (0x0d) */ |
| 7242 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7243 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7244 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7245 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7246 | /* Mic (rear) pin: input vref at 80% */ |
| 7247 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7248 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7249 | /* Front Mic pin: input vref at 80% */ |
| 7250 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7251 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7252 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7253 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7254 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7255 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7256 | |
| 7257 | /* FIXME: use matrix-type input source selection */ |
| 7258 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7259 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7260 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7261 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7262 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7263 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7264 | /* Input mixer2 */ |
| 7265 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7266 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7267 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7268 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7269 | /* Input mixer3 */ |
| 7270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7271 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7272 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7274 | /* ADC1: mute amp left and right */ |
| 7275 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7276 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7277 | /* ADC2: mute amp left and right */ |
| 7278 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7279 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7280 | /* ADC3: mute amp left and right */ |
| 7281 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7282 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7283 | |
| 7284 | { } |
| 7285 | }; |
| 7286 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7287 | /* iMac 24 mixer. */ |
| 7288 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7289 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7290 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7291 | { } /* end */ |
| 7292 | }; |
| 7293 | |
| 7294 | /* iMac 24 init verbs. */ |
| 7295 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7296 | /* Internal speakers: output 0 (0x0c) */ |
| 7297 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7298 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7299 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7300 | /* Internal speakers: output 0 (0x0c) */ |
| 7301 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7302 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7303 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7304 | /* Headphone: output 0 (0x0c) */ |
| 7305 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7306 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7307 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7308 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7309 | /* Front Mic: input vref at 80% */ |
| 7310 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7311 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7312 | { } |
| 7313 | }; |
| 7314 | |
| 7315 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7316 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7317 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7318 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7319 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7320 | spec->autocfg.hp_pins[0] = 0x14; |
| 7321 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7322 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 7323 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7324 | } |
| 7325 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7326 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7327 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7328 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7329 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7330 | spec->autocfg.hp_pins[0] = 0x15; |
| 7331 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7332 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7333 | } |
| 7334 | |
| 7335 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7336 | static struct hda_verb alc882_targa_verbs[] = { |
| 7337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7339 | |
| 7340 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7341 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7342 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7343 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7344 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7345 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7346 | |
| 7347 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7348 | { } /* end */ |
| 7349 | }; |
| 7350 | |
| 7351 | /* toggle speaker-output according to the hp-jack state */ |
| 7352 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7353 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7354 | struct alc_spec *spec = codec->spec; |
| 7355 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7356 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7357 | spec->jack_present ? 1 : 3); |
| 7358 | } |
| 7359 | |
| 7360 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 7361 | { |
| 7362 | struct alc_spec *spec = codec->spec; |
| 7363 | |
| 7364 | spec->autocfg.hp_pins[0] = 0x14; |
| 7365 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 7366 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7367 | } |
| 7368 | |
| 7369 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7370 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7371 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7372 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7373 | } |
| 7374 | |
| 7375 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7376 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7377 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7378 | |
| 7379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7380 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7381 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7382 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7383 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7384 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7385 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7386 | |
| 7387 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7388 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7389 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7390 | { } /* end */ |
| 7391 | }; |
| 7392 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7393 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7395 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7396 | |
| 7397 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7398 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7399 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7400 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7401 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7402 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7403 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7404 | |
| 7405 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7406 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7407 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7408 | { } /* end */ |
| 7409 | }; |
| 7410 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7411 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7412 | { |
| 7413 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7414 | |
| 7415 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7416 | AC_VERB_GET_GPIO_DATA, 0); |
| 7417 | |
| 7418 | if (!muted) |
| 7419 | gpiostate |= (1 << pin); |
| 7420 | else |
| 7421 | gpiostate &= ~(1 << pin); |
| 7422 | |
| 7423 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7424 | AC_VERB_GET_GPIO_MASK, 0); |
| 7425 | gpiomask |= (1 << pin); |
| 7426 | |
| 7427 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7428 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7429 | gpiodir |= (1 << pin); |
| 7430 | |
| 7431 | |
| 7432 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7433 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7434 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7435 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7436 | |
| 7437 | msleep(1); |
| 7438 | |
| 7439 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7440 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7441 | } |
| 7442 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7443 | /* set up GPIO at initialization */ |
| 7444 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7445 | { |
| 7446 | alc882_gpio_mute(codec, 0, 0); |
| 7447 | alc882_gpio_mute(codec, 1, 0); |
| 7448 | } |
| 7449 | |
| 7450 | /* set up GPIO and update auto-muting at initialization */ |
| 7451 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7452 | { |
| 7453 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7454 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7455 | } |
| 7456 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7457 | /* |
| 7458 | * generic initialization of ADC, input mixers and output mixers |
| 7459 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7460 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7461 | /* |
| 7462 | * Unmute ADC0-2 and set the default input to mic-in |
| 7463 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7464 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7465 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7466 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7468 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7469 | /* 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] | 7470 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7471 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7472 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7473 | */ |
| 7474 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7475 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7476 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7477 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7478 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7479 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7480 | |
| 7481 | /* |
| 7482 | * Set up output mixers (0x0c - 0x0f) |
| 7483 | */ |
| 7484 | /* set vol=0 to output mixers */ |
| 7485 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7486 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7487 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7488 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7489 | /* set up input amps for analog loopback */ |
| 7490 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7492 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7493 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7494 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7495 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7496 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7497 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7498 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7499 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7500 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7501 | |
| 7502 | /* FIXME: use matrix-type input source selection */ |
| 7503 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7504 | /* Input mixer2 */ |
| 7505 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7506 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7507 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7508 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7509 | /* Input mixer3 */ |
| 7510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7511 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7512 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7513 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7514 | |
| 7515 | { } |
| 7516 | }; |
| 7517 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7518 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7519 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7520 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7521 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7522 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7523 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7524 | { } /* end */ |
| 7525 | }; |
| 7526 | |
| 7527 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7528 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7529 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7530 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7531 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7532 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7533 | { } /* end */ |
| 7534 | }; |
| 7535 | |
| 7536 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7537 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7538 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7539 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7540 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7541 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7542 | { } /* end */ |
| 7543 | }; |
| 7544 | |
| 7545 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7546 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7547 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7548 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7549 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7550 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7551 | { } /* end */ |
| 7552 | }; |
| 7553 | |
| 7554 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7555 | { 2, alc889A_mb31_ch2_init }, |
| 7556 | { 4, alc889A_mb31_ch4_init }, |
| 7557 | { 5, alc889A_mb31_ch5_init }, |
| 7558 | { 6, alc889A_mb31_ch6_init }, |
| 7559 | }; |
| 7560 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7561 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7562 | /* eanable EAPD on medion laptop */ |
| 7563 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7564 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7565 | { } |
| 7566 | }; |
| 7567 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7568 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7569 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7570 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7571 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7572 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7573 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7574 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7575 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7576 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7577 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7579 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7581 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7582 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7583 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7584 | { } /* end */ |
| 7585 | }; |
| 7586 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7587 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7588 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7589 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7590 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7591 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7593 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7594 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7595 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7596 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7597 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7598 | { } /* end */ |
| 7599 | }; |
| 7600 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7601 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7602 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7603 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7604 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7605 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7606 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7607 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7608 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7609 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7610 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7611 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7612 | { } /* end */ |
| 7613 | }; |
| 7614 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7615 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7616 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7617 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7619 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7620 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7621 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7622 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7623 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7624 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7625 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7627 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7628 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7629 | { } /* end */ |
| 7630 | }; |
| 7631 | |
| 7632 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7634 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7635 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7636 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7637 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7638 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7639 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7640 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7641 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7642 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7643 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7645 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7647 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7649 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7650 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7651 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7652 | { } /* end */ |
| 7653 | }; |
| 7654 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7655 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7656 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7657 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7658 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7659 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7660 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7661 | HDA_OUTPUT), |
| 7662 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7663 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7664 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7667 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7668 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7669 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7671 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7672 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7673 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7674 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7675 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7676 | { } /* end */ |
| 7677 | }; |
| 7678 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7679 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7680 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7681 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7682 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7683 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7684 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7685 | HDA_OUTPUT), |
| 7686 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7687 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7688 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7689 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7690 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7691 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7692 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7693 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7695 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7696 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7697 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7698 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7699 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7700 | { } /* end */ |
| 7701 | }; |
| 7702 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7703 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7705 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7706 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7707 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7708 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7709 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7710 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7711 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7712 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7713 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7714 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7715 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7716 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7717 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7718 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7719 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7720 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7721 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7722 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7723 | { } /* end */ |
| 7724 | }; |
| 7725 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7726 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7728 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7729 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7730 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7731 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7732 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7733 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7734 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7735 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7736 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7737 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7738 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7739 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7741 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7742 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7743 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7744 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7745 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7746 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7747 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7748 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7749 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7750 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7751 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7752 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7753 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7754 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7755 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7756 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7757 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7758 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7759 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7760 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7761 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7762 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7763 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7764 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7765 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7766 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7768 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7769 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7770 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7771 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7772 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7773 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7774 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7775 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7776 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7777 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7778 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7779 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7780 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7781 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7782 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7783 | { } /* end */ |
| 7784 | }; |
| 7785 | |
| 7786 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7787 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7789 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7790 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7791 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7792 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7794 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7795 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7796 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7797 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7798 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7799 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7801 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7802 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7803 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7804 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7806 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7808 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7809 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7810 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7811 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 7812 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7813 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7814 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7815 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 7816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7817 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7818 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7819 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7821 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7823 | { } /* end */ |
| 7824 | }; |
| 7825 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7826 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7827 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7828 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7829 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7830 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7831 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7832 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7833 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7834 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7835 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7836 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7837 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7838 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7839 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7840 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7841 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7842 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7843 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7845 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7846 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7847 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7848 | { } /* end */ |
| 7849 | }; |
| 7850 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7851 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 7852 | /* Output mixers */ |
| 7853 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7854 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7855 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7856 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7857 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 7858 | HDA_OUTPUT), |
| 7859 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 7860 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 7861 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 7862 | /* Output switches */ |
| 7863 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 7864 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 7865 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 7866 | /* Boost mixers */ |
| 7867 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7868 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 7869 | /* Input mixers */ |
| 7870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7871 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7872 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7873 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7874 | { } /* end */ |
| 7875 | }; |
| 7876 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 7877 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 7878 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7879 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7880 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7881 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7882 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7883 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7884 | { } /* end */ |
| 7885 | }; |
| 7886 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7887 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7888 | .ops = &snd_hda_bind_vol, |
| 7889 | .values = { |
| 7890 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7891 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7892 | 0 |
| 7893 | }, |
| 7894 | }; |
| 7895 | |
| 7896 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7897 | .ops = &snd_hda_bind_sw, |
| 7898 | .values = { |
| 7899 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7900 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7901 | 0 |
| 7902 | }, |
| 7903 | }; |
| 7904 | |
| 7905 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7909 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7910 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7912 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7914 | { } /* end */ |
| 7915 | }; |
| 7916 | |
| 7917 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7918 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7919 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7920 | { |
| 7921 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7922 | /* .name = "Capture Source", */ |
| 7923 | .name = "Input Source", |
| 7924 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7925 | .info = alc_mux_enum_info, |
| 7926 | .get = alc_mux_enum_get, |
| 7927 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7928 | }, |
| 7929 | { } /* end */ |
| 7930 | }; |
| 7931 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7932 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7933 | { |
| 7934 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7935 | .name = "Channel Mode", |
| 7936 | .info = alc_ch_mode_info, |
| 7937 | .get = alc_ch_mode_get, |
| 7938 | .put = alc_ch_mode_put, |
| 7939 | }, |
| 7940 | { } /* end */ |
| 7941 | }; |
| 7942 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7943 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7944 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7945 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7946 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7947 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7948 | spec->autocfg.hp_pins[0] = 0x15; |
| 7949 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7950 | spec->autocfg.speaker_pins[1] = 0x17; |
| 7951 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7952 | } |
| 7953 | |
| 7954 | /* auto-toggle front mic */ |
| 7955 | /* |
| 7956 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7957 | { |
| 7958 | unsigned int present; |
| 7959 | unsigned char bits; |
| 7960 | |
| 7961 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7962 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7963 | bits = present ? HDA_AMP_MUTE : 0; |
| 7964 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7965 | } |
| 7966 | */ |
| 7967 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7968 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7969 | /* HP */ |
| 7970 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7972 | /* Subwoofer */ |
| 7973 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7974 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7975 | |
| 7976 | /* enable unsolicited event */ |
| 7977 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7978 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7979 | |
| 7980 | { } /* end */ |
| 7981 | }; |
| 7982 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7983 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7984 | /* HP */ |
| 7985 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7986 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7987 | /* Int speaker */ |
| 7988 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7989 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7990 | |
| 7991 | /* enable unsolicited event */ |
| 7992 | {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] | 7993 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7994 | |
| 7995 | { } /* end */ |
| 7996 | }; |
| 7997 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7998 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7999 | /* HP */ |
| 8000 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8001 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8002 | /* Subwoofer */ |
| 8003 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8004 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8005 | |
| 8006 | /* enable unsolicited event */ |
| 8007 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8008 | |
| 8009 | { } /* end */ |
| 8010 | }; |
| 8011 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8012 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8013 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8014 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8015 | |
| 8016 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8017 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8018 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8019 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8020 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8021 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8022 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8023 | /* Connect Mic jack to CLFE */ |
| 8024 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8025 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8026 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8027 | /* Connect Line-in jack to Surround */ |
| 8028 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8029 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8030 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8031 | /* Connect HP out jack to Front */ |
| 8032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8033 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8034 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8035 | |
| 8036 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8037 | |
| 8038 | { } /* end */ |
| 8039 | }; |
| 8040 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8041 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8042 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8043 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8044 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8045 | { } /* end */ |
| 8046 | }; |
| 8047 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8048 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8049 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8050 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8051 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8052 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8053 | { } /* end */ |
| 8054 | }; |
| 8055 | |
| 8056 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8057 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8059 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8060 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8061 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8062 | { } /* end */ |
| 8063 | }; |
| 8064 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8065 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8066 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8067 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8068 | |
| 8069 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8070 | |
| 8071 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8072 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8073 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8074 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8075 | { } /* end */ |
| 8076 | }; |
| 8077 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8078 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8079 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8081 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8082 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8083 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8084 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8085 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8086 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8087 | { } /* end */ |
| 8088 | }; |
| 8089 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8090 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8091 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8092 | { } |
| 8093 | }; |
| 8094 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8095 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8096 | /* HP */ |
| 8097 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8098 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8099 | |
| 8100 | /* enable unsolicited event */ |
| 8101 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8102 | |
| 8103 | { } /* end */ |
| 8104 | }; |
| 8105 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8106 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8107 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8108 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8109 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8110 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8111 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8112 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8113 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8114 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8115 | } |
| 8116 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8117 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8118 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8119 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8120 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8121 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8122 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8123 | }; |
| 8124 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8125 | /* |
| 8126 | * 2ch mode |
| 8127 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8128 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8129 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8130 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8131 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8132 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8133 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8134 | }; |
| 8135 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8136 | /* |
| 8137 | * 4ch mode |
| 8138 | */ |
| 8139 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8140 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8141 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8142 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8143 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8144 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8145 | { } /* end */ |
| 8146 | }; |
| 8147 | |
| 8148 | /* |
| 8149 | * 6ch mode |
| 8150 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8151 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8152 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8153 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8154 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8155 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8156 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8157 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8158 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8159 | }; |
| 8160 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8161 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8162 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8163 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8164 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8165 | }; |
| 8166 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8167 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8168 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8169 | { |
| 8170 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8171 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8172 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8173 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8174 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8175 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8176 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8177 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8178 | } |
| 8179 | |
| 8180 | /* toggle RCA according to the front-jack state */ |
| 8181 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8182 | { |
| 8183 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8184 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8185 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8186 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8187 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8188 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8189 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8190 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8191 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8192 | unsigned int res) |
| 8193 | { |
| 8194 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8195 | alc888_lenovo_ms7195_front_automute(codec); |
| 8196 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8197 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8198 | } |
| 8199 | |
| 8200 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8202 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8203 | |
| 8204 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8205 | |
| 8206 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8207 | { } /* end */ |
| 8208 | }; |
| 8209 | |
| 8210 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8211 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8212 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8213 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8214 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8215 | spec->autocfg.hp_pins[0] = 0x14; |
| 8216 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8217 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8218 | } |
| 8219 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8220 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8221 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8222 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8223 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8224 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8225 | { |
| 8226 | unsigned int present; |
| 8227 | |
| 8228 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8229 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8230 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8231 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8232 | } |
| 8233 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8234 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8235 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8236 | struct alc_spec *spec = codec->spec; |
| 8237 | |
| 8238 | spec->autocfg.hp_pins[0] = 0x15; |
| 8239 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8240 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8241 | alc883_clevo_m720_mic_automute(codec); |
| 8242 | } |
| 8243 | |
| 8244 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8245 | unsigned int res) |
| 8246 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8247 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8248 | case ALC880_MIC_EVENT: |
| 8249 | alc883_clevo_m720_mic_automute(codec); |
| 8250 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8251 | default: |
| 8252 | alc_automute_amp_unsol_event(codec, res); |
| 8253 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8254 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8255 | } |
| 8256 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8257 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8258 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8259 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8260 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8261 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8262 | spec->autocfg.hp_pins[0] = 0x14; |
| 8263 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8264 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8265 | } |
| 8266 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8267 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8268 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8269 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8270 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8271 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8272 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8273 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8274 | } |
| 8275 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8276 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8277 | { |
| 8278 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8279 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8280 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8281 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8282 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8283 | bits = present ? HDA_AMP_MUTE : 0; |
| 8284 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8285 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8286 | } |
| 8287 | |
| 8288 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8289 | { |
| 8290 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8291 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8292 | |
| 8293 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8294 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8295 | bits = present ? HDA_AMP_MUTE : 0; |
| 8296 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8297 | HDA_AMP_MUTE, bits); |
| 8298 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8299 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8300 | } |
| 8301 | |
| 8302 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8303 | unsigned int res) |
| 8304 | { |
| 8305 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8306 | alc883_lenovo_101e_all_automute(codec); |
| 8307 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8308 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8309 | } |
| 8310 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8311 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8312 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8313 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8314 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8315 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8316 | spec->autocfg.hp_pins[0] = 0x14; |
| 8317 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8318 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8319 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8320 | } |
| 8321 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8322 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8323 | /* HP Pin: output 0 (0x0c) */ |
| 8324 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8325 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8326 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8327 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8328 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8329 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8330 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8331 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8332 | /* eanable EAPD on medion laptop */ |
| 8333 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8334 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8335 | /* enable unsolicited event */ |
| 8336 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8337 | { } |
| 8338 | }; |
| 8339 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8340 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8341 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8342 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8343 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8344 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8345 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8346 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8347 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8348 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8349 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8350 | } |
| 8351 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8352 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8353 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8354 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8355 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8356 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8357 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8358 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8359 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8360 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8361 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8362 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8363 | } |
| 8364 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8365 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8366 | { |
| 8367 | struct alc_spec *spec = codec->spec; |
| 8368 | |
| 8369 | spec->autocfg.hp_pins[0] = 0x15; |
| 8370 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8371 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8372 | alc_automute_amp(codec); |
| 8373 | } |
| 8374 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8375 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8376 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8377 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8378 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8379 | /* enable unsolicited event */ |
| 8380 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8381 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8382 | { } /* end */ |
| 8383 | }; |
| 8384 | |
| 8385 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8386 | { |
| 8387 | unsigned int present; |
| 8388 | |
| 8389 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8390 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8391 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8392 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8393 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8394 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8395 | } |
| 8396 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8397 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8398 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8399 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8400 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8401 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8402 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8403 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8404 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8405 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8406 | } |
| 8407 | |
| 8408 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8409 | unsigned int res) |
| 8410 | { |
| 8411 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8412 | case ALC880_MIC_EVENT: |
| 8413 | alc883_nb_mic_automute(codec); |
| 8414 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8415 | default: |
| 8416 | alc_sku_unsol_event(codec, res); |
| 8417 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8418 | } |
| 8419 | } |
| 8420 | |
| 8421 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8422 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8423 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8424 | alc883_nb_mic_automute(codec); |
| 8425 | } |
| 8426 | |
| 8427 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8428 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8429 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8430 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8431 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8432 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8433 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8434 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8435 | /* enable unsolicited event */ |
| 8436 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8437 | { } /* end */ |
| 8438 | }; |
| 8439 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8440 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8441 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8442 | struct alc_spec *spec = codec->spec; |
| 8443 | |
| 8444 | spec->autocfg.hp_pins[0] = 0x14; |
| 8445 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8446 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8447 | } |
| 8448 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8449 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8450 | /* Init rear pin (used as headphone output) */ |
| 8451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8452 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8453 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8454 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8455 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8456 | /* Init line 2 pin (used as headphone out by default) */ |
| 8457 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8458 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8459 | { } /* end */ |
| 8460 | }; |
| 8461 | |
| 8462 | /* Mute speakers according to the headphone jack state */ |
| 8463 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8464 | { |
| 8465 | unsigned int present; |
| 8466 | |
| 8467 | /* Mute only in 2ch or 4ch mode */ |
| 8468 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8469 | == 0x00) { |
| 8470 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8471 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8472 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8473 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8474 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8475 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8476 | } |
| 8477 | } |
| 8478 | |
| 8479 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8480 | { |
| 8481 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8482 | alc889A_mb31_automute(codec); |
| 8483 | } |
| 8484 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8485 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8486 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8487 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8488 | #endif |
| 8489 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8490 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8491 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8492 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8493 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8494 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8495 | |
| 8496 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8497 | ALC1200_DIGOUT_NID, 0, |
| 8498 | }; |
| 8499 | |
| 8500 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8501 | ALC883_DIGOUT_NID, 0, |
| 8502 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8503 | |
| 8504 | /* |
| 8505 | * configuration and preset |
| 8506 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8507 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8508 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8509 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8510 | [ALC882_ARIMA] = "arima", |
| 8511 | [ALC882_W2JC] = "w2jc", |
| 8512 | [ALC882_TARGA] = "targa", |
| 8513 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8514 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8515 | [ALC885_MACPRO] = "macpro", |
| 8516 | [ALC885_MB5] = "mb5", |
| 8517 | [ALC885_MBP3] = "mbp3", |
| 8518 | [ALC885_IMAC24] = "imac24", |
| 8519 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8520 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8521 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8522 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8523 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8524 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8525 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8526 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8527 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8528 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8529 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8530 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8531 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8532 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8533 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8534 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8535 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8536 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8537 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8538 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8539 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8540 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8541 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8542 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8543 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8544 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8545 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8546 | [ALC889A_INTEL] = "intel-alc889a", |
| 8547 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8548 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8549 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8550 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8551 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8552 | }; |
| 8553 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8554 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8555 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8556 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8557 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8558 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8559 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8560 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8561 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8562 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8563 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8564 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8565 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8566 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8567 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8568 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8569 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8570 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8571 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8572 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8573 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8574 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8575 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8576 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8577 | /* default Acer -- disabled as it causes more problems. |
| 8578 | * model=auto should work fine now |
| 8579 | */ |
| 8580 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8581 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8582 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8583 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8584 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8585 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8586 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8587 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8588 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8589 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8590 | |
| 8591 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8592 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8593 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8594 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8595 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8596 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8597 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8598 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Mackenzie Morgan | 44a678d | 2009-02-10 17:13:43 +0100 | [diff] [blame] | 8599 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8600 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8601 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8602 | |
| 8603 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8604 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8605 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8606 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8607 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8608 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8609 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8610 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8611 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8612 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8613 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8614 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8615 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8616 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8617 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8618 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8619 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8620 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8621 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8622 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8623 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8624 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8625 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8626 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8627 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8628 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8629 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8630 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8631 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8632 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8633 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8634 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8635 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8636 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8637 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8638 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8639 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8640 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8641 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8642 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8643 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8644 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8645 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8646 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8647 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8648 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8649 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8650 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8651 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8652 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8653 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8654 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8655 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8656 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8657 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8658 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8659 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8660 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8661 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8662 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8663 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8664 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8665 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8666 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8667 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8668 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8669 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8670 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8671 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8672 | {} |
| 8673 | }; |
| 8674 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8675 | /* codec SSID table for Intel Mac */ |
| 8676 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8677 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8678 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8679 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8680 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8681 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8682 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8683 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8684 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8685 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8686 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8687 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8688 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8689 | * no perfect solution yet |
| 8690 | */ |
| 8691 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8692 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8693 | }; |
| 8694 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8695 | static struct alc_config_preset alc882_presets[] = { |
| 8696 | [ALC882_3ST_DIG] = { |
| 8697 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8698 | .init_verbs = { alc882_base_init_verbs, |
| 8699 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8700 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8701 | .dac_nids = alc882_dac_nids, |
| 8702 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8703 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8704 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8705 | .channel_mode = alc882_ch_modes, |
| 8706 | .need_dac_fix = 1, |
| 8707 | .input_mux = &alc882_capture_source, |
| 8708 | }, |
| 8709 | [ALC882_6ST_DIG] = { |
| 8710 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8711 | .init_verbs = { alc882_base_init_verbs, |
| 8712 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8713 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8714 | .dac_nids = alc882_dac_nids, |
| 8715 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8716 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8717 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8718 | .channel_mode = alc882_sixstack_modes, |
| 8719 | .input_mux = &alc882_capture_source, |
| 8720 | }, |
| 8721 | [ALC882_ARIMA] = { |
| 8722 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8723 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8724 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8725 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8726 | .dac_nids = alc882_dac_nids, |
| 8727 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8728 | .channel_mode = alc882_sixstack_modes, |
| 8729 | .input_mux = &alc882_capture_source, |
| 8730 | }, |
| 8731 | [ALC882_W2JC] = { |
| 8732 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8733 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8734 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8735 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8736 | .dac_nids = alc882_dac_nids, |
| 8737 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8738 | .channel_mode = alc880_threestack_modes, |
| 8739 | .need_dac_fix = 1, |
| 8740 | .input_mux = &alc882_capture_source, |
| 8741 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8742 | }, |
| 8743 | [ALC885_MBP3] = { |
| 8744 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8745 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8746 | alc880_gpio1_init_verbs }, |
| 8747 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8748 | .dac_nids = alc882_dac_nids, |
| 8749 | .channel_mode = alc885_mbp_6ch_modes, |
| 8750 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 8751 | .input_mux = &alc882_capture_source, |
| 8752 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8753 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8754 | .unsol_event = alc_automute_amp_unsol_event, |
| 8755 | .init_hook = alc885_mbp3_init_hook, |
| 8756 | }, |
| 8757 | [ALC885_MB5] = { |
| 8758 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8759 | .init_verbs = { alc885_mb5_init_verbs, |
| 8760 | alc880_gpio1_init_verbs }, |
| 8761 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8762 | .dac_nids = alc882_dac_nids, |
| 8763 | .channel_mode = alc885_mb5_6ch_modes, |
| 8764 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8765 | .input_mux = &mb5_capture_source, |
| 8766 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8767 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8768 | }, |
| 8769 | [ALC885_MACPRO] = { |
| 8770 | .mixers = { alc882_macpro_mixer }, |
| 8771 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8772 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8773 | .dac_nids = alc882_dac_nids, |
| 8774 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8775 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8776 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8777 | .channel_mode = alc882_ch_modes, |
| 8778 | .input_mux = &alc882_capture_source, |
| 8779 | .init_hook = alc885_macpro_init_hook, |
| 8780 | }, |
| 8781 | [ALC885_IMAC24] = { |
| 8782 | .mixers = { alc885_imac24_mixer }, |
| 8783 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8784 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8785 | .dac_nids = alc882_dac_nids, |
| 8786 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8787 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8788 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8789 | .channel_mode = alc882_ch_modes, |
| 8790 | .input_mux = &alc882_capture_source, |
| 8791 | .unsol_event = alc_automute_amp_unsol_event, |
| 8792 | .init_hook = alc885_imac24_init_hook, |
| 8793 | }, |
| 8794 | [ALC882_TARGA] = { |
| 8795 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8796 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 8797 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8798 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8799 | .dac_nids = alc882_dac_nids, |
| 8800 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8801 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8802 | .adc_nids = alc882_adc_nids, |
| 8803 | .capsrc_nids = alc882_capsrc_nids, |
| 8804 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8805 | .channel_mode = alc882_3ST_6ch_modes, |
| 8806 | .need_dac_fix = 1, |
| 8807 | .input_mux = &alc882_capture_source, |
| 8808 | .unsol_event = alc882_targa_unsol_event, |
| 8809 | .init_hook = alc882_targa_init_hook, |
| 8810 | }, |
| 8811 | [ALC882_ASUS_A7J] = { |
| 8812 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8813 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8814 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8815 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8816 | .dac_nids = alc882_dac_nids, |
| 8817 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8818 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8819 | .adc_nids = alc882_adc_nids, |
| 8820 | .capsrc_nids = alc882_capsrc_nids, |
| 8821 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8822 | .channel_mode = alc882_3ST_6ch_modes, |
| 8823 | .need_dac_fix = 1, |
| 8824 | .input_mux = &alc882_capture_source, |
| 8825 | }, |
| 8826 | [ALC882_ASUS_A7M] = { |
| 8827 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8828 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8829 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8830 | alc882_asus_a7m_verbs }, |
| 8831 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8832 | .dac_nids = alc882_dac_nids, |
| 8833 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8834 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8835 | .channel_mode = alc880_threestack_modes, |
| 8836 | .need_dac_fix = 1, |
| 8837 | .input_mux = &alc882_capture_source, |
| 8838 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8839 | [ALC883_3ST_2ch_DIG] = { |
| 8840 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8841 | .init_verbs = { alc883_init_verbs }, |
| 8842 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8843 | .dac_nids = alc883_dac_nids, |
| 8844 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8845 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8846 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8847 | .channel_mode = alc883_3ST_2ch_modes, |
| 8848 | .input_mux = &alc883_capture_source, |
| 8849 | }, |
| 8850 | [ALC883_3ST_6ch_DIG] = { |
| 8851 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8852 | .init_verbs = { alc883_init_verbs }, |
| 8853 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8854 | .dac_nids = alc883_dac_nids, |
| 8855 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8856 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8857 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8858 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8859 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8860 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8861 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8862 | [ALC883_3ST_6ch] = { |
| 8863 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8864 | .init_verbs = { alc883_init_verbs }, |
| 8865 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8866 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8867 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8868 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8869 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8870 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8871 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8872 | [ALC883_3ST_6ch_INTEL] = { |
| 8873 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8874 | .init_verbs = { alc883_init_verbs }, |
| 8875 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8876 | .dac_nids = alc883_dac_nids, |
| 8877 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8878 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8879 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8880 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8881 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8882 | .need_dac_fix = 1, |
| 8883 | .input_mux = &alc883_3stack_6ch_intel, |
| 8884 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8885 | [ALC889A_INTEL] = { |
| 8886 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 8887 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 8888 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8889 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8890 | .dac_nids = alc883_dac_nids, |
| 8891 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 8892 | .adc_nids = alc889_adc_nids, |
| 8893 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8894 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8895 | .slave_dig_outs = alc883_slave_dig_outs, |
| 8896 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 8897 | .channel_mode = alc889_8ch_intel_modes, |
| 8898 | .capsrc_nids = alc889_capsrc_nids, |
| 8899 | .input_mux = &alc889_capture_source, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 8900 | .init_hook = alc889_automute_init, |
| 8901 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8902 | .need_dac_fix = 1, |
| 8903 | }, |
| 8904 | [ALC889_INTEL] = { |
| 8905 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 8906 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 8907 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8908 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8909 | .dac_nids = alc883_dac_nids, |
| 8910 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 8911 | .adc_nids = alc889_adc_nids, |
| 8912 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8913 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8914 | .slave_dig_outs = alc883_slave_dig_outs, |
| 8915 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 8916 | .channel_mode = alc889_8ch_intel_modes, |
| 8917 | .capsrc_nids = alc889_capsrc_nids, |
| 8918 | .input_mux = &alc889_capture_source, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 8919 | .init_hook = alc889_intel_init_hook, |
| 8920 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8921 | .need_dac_fix = 1, |
| 8922 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8923 | [ALC883_6ST_DIG] = { |
| 8924 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8925 | .init_verbs = { alc883_init_verbs }, |
| 8926 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8927 | .dac_nids = alc883_dac_nids, |
| 8928 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8929 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8930 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8931 | .channel_mode = alc883_sixstack_modes, |
| 8932 | .input_mux = &alc883_capture_source, |
| 8933 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8934 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8935 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 8936 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 8937 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8938 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8939 | .dac_nids = alc883_dac_nids, |
| 8940 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8941 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8942 | .channel_mode = alc883_3ST_6ch_modes, |
| 8943 | .need_dac_fix = 1, |
| 8944 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8945 | .unsol_event = alc883_targa_unsol_event, |
| 8946 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8947 | }, |
| 8948 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8949 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 8950 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 8951 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8952 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8953 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8954 | .adc_nids = alc883_adc_nids_alt, |
| 8955 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8956 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8957 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8958 | .channel_mode = alc883_3ST_2ch_modes, |
| 8959 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8960 | .unsol_event = alc883_targa_unsol_event, |
| 8961 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8962 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8963 | [ALC883_TARGA_8ch_DIG] = { |
| 8964 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8965 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8966 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8967 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8968 | .dac_nids = alc883_dac_nids, |
| 8969 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8970 | .adc_nids = alc883_adc_nids_rev, |
| 8971 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8972 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8973 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8974 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 8975 | .channel_mode = alc883_4ST_8ch_modes, |
| 8976 | .need_dac_fix = 1, |
| 8977 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8978 | .unsol_event = alc883_targa_unsol_event, |
| 8979 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8980 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8981 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8982 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8983 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8984 | * and the headphone jack. Turn this on and rely on the |
| 8985 | * standard mute methods whenever the user wants to turn |
| 8986 | * these outputs off. |
| 8987 | */ |
| 8988 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8989 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8990 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8991 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8992 | .channel_mode = alc883_3ST_2ch_modes, |
| 8993 | .input_mux = &alc883_capture_source, |
| 8994 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8995 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8996 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8997 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8998 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8999 | .dac_nids = alc883_dac_nids, |
| 9000 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9001 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9002 | .channel_mode = alc883_3ST_2ch_modes, |
| 9003 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9004 | .unsol_event = alc_automute_amp_unsol_event, |
| 9005 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9006 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9007 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9008 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9009 | alc883_chmode_mixer }, |
| 9010 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9011 | alc888_acer_aspire_4930g_verbs }, |
| 9012 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9013 | .dac_nids = alc883_dac_nids, |
| 9014 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9015 | .adc_nids = alc883_adc_nids_rev, |
| 9016 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9017 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9018 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9019 | .channel_mode = alc883_3ST_6ch_modes, |
| 9020 | .need_dac_fix = 1, |
| 9021 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9022 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9023 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9024 | .unsol_event = alc_automute_amp_unsol_event, |
| 9025 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9026 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9027 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9028 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9029 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9030 | alc888_acer_aspire_6530g_verbs }, |
| 9031 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9032 | .dac_nids = alc883_dac_nids, |
| 9033 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9034 | .adc_nids = alc883_adc_nids_rev, |
| 9035 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9036 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9037 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9038 | .channel_mode = alc883_3ST_2ch_modes, |
| 9039 | .num_mux_defs = |
| 9040 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9041 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9042 | .unsol_event = alc_automute_amp_unsol_event, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 9043 | .init_hook = alc888_acer_aspire_6530g_init_hook, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9044 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9045 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9046 | .mixers = { alc888_base_mixer, |
| 9047 | alc883_chmode_mixer }, |
| 9048 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9049 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9050 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9051 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9052 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9053 | .adc_nids = alc889_adc_nids, |
| 9054 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9055 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9056 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9057 | .channel_mode = alc883_3ST_6ch_modes, |
| 9058 | .need_dac_fix = 1, |
| 9059 | .const_channel_count = 6, |
| 9060 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9061 | ARRAY_SIZE(alc889_capture_sources), |
| 9062 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9063 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9064 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9065 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9066 | [ALC883_MEDION] = { |
| 9067 | .mixers = { alc883_fivestack_mixer, |
| 9068 | alc883_chmode_mixer }, |
| 9069 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9070 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9071 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9072 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9073 | .adc_nids = alc883_adc_nids_alt, |
| 9074 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9075 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9076 | .channel_mode = alc883_sixstack_modes, |
| 9077 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9078 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9079 | [ALC883_MEDION_MD2] = { |
| 9080 | .mixers = { alc883_medion_md2_mixer}, |
| 9081 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9082 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9083 | .dac_nids = alc883_dac_nids, |
| 9084 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9085 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9086 | .channel_mode = alc883_3ST_2ch_modes, |
| 9087 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9088 | .unsol_event = alc_automute_amp_unsol_event, |
| 9089 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9090 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9091 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9092 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9093 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9094 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9095 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9096 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9097 | .channel_mode = alc883_3ST_2ch_modes, |
| 9098 | .input_mux = &alc883_capture_source, |
| 9099 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9100 | [ALC883_CLEVO_M720] = { |
| 9101 | .mixers = { alc883_clevo_m720_mixer }, |
| 9102 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9103 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9104 | .dac_nids = alc883_dac_nids, |
| 9105 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9106 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9107 | .channel_mode = alc883_3ST_2ch_modes, |
| 9108 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9109 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9110 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9111 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9112 | [ALC883_LENOVO_101E_2ch] = { |
| 9113 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9114 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9115 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9116 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9117 | .adc_nids = alc883_adc_nids_alt, |
| 9118 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9119 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9120 | .channel_mode = alc883_3ST_2ch_modes, |
| 9121 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9122 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9123 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9124 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9125 | [ALC883_LENOVO_NB0763] = { |
| 9126 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9127 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9128 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9129 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9130 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9131 | .channel_mode = alc883_3ST_2ch_modes, |
| 9132 | .need_dac_fix = 1, |
| 9133 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9134 | .unsol_event = alc_automute_amp_unsol_event, |
| 9135 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9136 | }, |
| 9137 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9138 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9139 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9140 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9141 | .dac_nids = alc883_dac_nids, |
| 9142 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9143 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9144 | .channel_mode = alc883_3ST_6ch_modes, |
| 9145 | .need_dac_fix = 1, |
| 9146 | .input_mux = &alc883_capture_source, |
| 9147 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9148 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9149 | }, |
| 9150 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9151 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9152 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9153 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9154 | .dac_nids = alc883_dac_nids, |
| 9155 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9156 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9157 | .channel_mode = alc883_3ST_2ch_modes, |
| 9158 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9159 | .unsol_event = alc_automute_amp_unsol_event, |
| 9160 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9161 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9162 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9163 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9164 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9165 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9166 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9167 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9168 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9169 | .need_dac_fix = 1, |
| 9170 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9171 | .unsol_event = alc_automute_amp_unsol_event, |
| 9172 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9173 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9174 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9175 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9176 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9177 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9178 | .dac_nids = alc883_dac_nids, |
| 9179 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9180 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9181 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9182 | .channel_mode = alc883_sixstack_modes, |
| 9183 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9184 | .unsol_event = alc_automute_amp_unsol_event, |
| 9185 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9186 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9187 | [ALC883_MITAC] = { |
| 9188 | .mixers = { alc883_mitac_mixer }, |
| 9189 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9190 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9191 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9192 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9193 | .channel_mode = alc883_3ST_2ch_modes, |
| 9194 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9195 | .unsol_event = alc_automute_amp_unsol_event, |
| 9196 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9197 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9198 | [ALC883_FUJITSU_PI2515] = { |
| 9199 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9200 | .init_verbs = { alc883_init_verbs, |
| 9201 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9202 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9203 | .dac_nids = alc883_dac_nids, |
| 9204 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9205 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9206 | .channel_mode = alc883_3ST_2ch_modes, |
| 9207 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9208 | .unsol_event = alc_automute_amp_unsol_event, |
| 9209 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9210 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9211 | [ALC888_FUJITSU_XA3530] = { |
| 9212 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9213 | .init_verbs = { alc883_init_verbs, |
| 9214 | alc888_fujitsu_xa3530_verbs }, |
| 9215 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9216 | .dac_nids = alc883_dac_nids, |
| 9217 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9218 | .adc_nids = alc883_adc_nids_rev, |
| 9219 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9220 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9221 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9222 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9223 | .num_mux_defs = |
| 9224 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9225 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9226 | .unsol_event = alc_automute_amp_unsol_event, |
| 9227 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9228 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9229 | [ALC888_LENOVO_SKY] = { |
| 9230 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9231 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9232 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9233 | .dac_nids = alc883_dac_nids, |
| 9234 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9235 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9236 | .channel_mode = alc883_sixstack_modes, |
| 9237 | .need_dac_fix = 1, |
| 9238 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9239 | .unsol_event = alc_automute_amp_unsol_event, |
| 9240 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9241 | }, |
| 9242 | [ALC888_ASUS_M90V] = { |
| 9243 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9244 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9245 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9246 | .dac_nids = alc883_dac_nids, |
| 9247 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9248 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9249 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9250 | .channel_mode = alc883_3ST_6ch_modes, |
| 9251 | .need_dac_fix = 1, |
| 9252 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9253 | .unsol_event = alc883_mode2_unsol_event, |
| 9254 | .init_hook = alc883_mode2_inithook, |
| 9255 | }, |
| 9256 | [ALC888_ASUS_EEE1601] = { |
| 9257 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9258 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9259 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9260 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9261 | .dac_nids = alc883_dac_nids, |
| 9262 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9263 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9264 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9265 | .channel_mode = alc883_3ST_2ch_modes, |
| 9266 | .need_dac_fix = 1, |
| 9267 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9268 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9269 | .init_hook = alc883_eee1601_inithook, |
| 9270 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9271 | [ALC1200_ASUS_P5Q] = { |
| 9272 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9273 | .init_verbs = { alc883_init_verbs }, |
| 9274 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9275 | .dac_nids = alc883_dac_nids, |
| 9276 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9277 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9278 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9279 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9280 | .channel_mode = alc883_sixstack_modes, |
| 9281 | .input_mux = &alc883_capture_source, |
| 9282 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9283 | [ALC889A_MB31] = { |
| 9284 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9285 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9286 | alc880_gpio1_init_verbs }, |
| 9287 | .adc_nids = alc883_adc_nids, |
| 9288 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9289 | .dac_nids = alc883_dac_nids, |
| 9290 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9291 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9292 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9293 | .input_mux = &alc889A_mb31_capture_source, |
| 9294 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9295 | .unsol_event = alc889A_mb31_unsol_event, |
| 9296 | .init_hook = alc889A_mb31_automute, |
| 9297 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9298 | [ALC883_SONY_VAIO_TT] = { |
| 9299 | .mixers = { alc883_vaiott_mixer }, |
| 9300 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9301 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9302 | .dac_nids = alc883_dac_nids, |
| 9303 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9304 | .channel_mode = alc883_3ST_2ch_modes, |
| 9305 | .input_mux = &alc883_capture_source, |
| 9306 | .unsol_event = alc_automute_amp_unsol_event, |
| 9307 | .init_hook = alc883_vaiott_init_hook, |
| 9308 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9309 | }; |
| 9310 | |
| 9311 | |
| 9312 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9313 | * Pin config fixes |
| 9314 | */ |
| 9315 | enum { |
| 9316 | PINFIX_ABIT_AW9D_MAX |
| 9317 | }; |
| 9318 | |
| 9319 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9320 | { 0x15, 0x01080104 }, /* side */ |
| 9321 | { 0x16, 0x01011012 }, /* rear */ |
| 9322 | { 0x17, 0x01016011 }, /* clfe */ |
| 9323 | { } |
| 9324 | }; |
| 9325 | |
| 9326 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9327 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9328 | }; |
| 9329 | |
| 9330 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9331 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9332 | {} |
| 9333 | }; |
| 9334 | |
| 9335 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9336 | * BIOS auto configuration |
| 9337 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9338 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9339 | hda_nid_t nid, int pin_type, |
| 9340 | int dac_idx) |
| 9341 | { |
| 9342 | /* set as output */ |
| 9343 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9344 | int idx; |
| 9345 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9346 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9347 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9348 | idx = 4; |
| 9349 | else |
| 9350 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9351 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9352 | |
| 9353 | } |
| 9354 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9355 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9356 | { |
| 9357 | struct alc_spec *spec = codec->spec; |
| 9358 | int i; |
| 9359 | |
| 9360 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9361 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9362 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9363 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9364 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9365 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9366 | } |
| 9367 | } |
| 9368 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9369 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9370 | { |
| 9371 | struct alc_spec *spec = codec->spec; |
| 9372 | hda_nid_t pin; |
| 9373 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9374 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9375 | if (pin) /* connect to front */ |
| 9376 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9377 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9378 | pin = spec->autocfg.speaker_pins[0]; |
| 9379 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9380 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9381 | } |
| 9382 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9383 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9384 | { |
| 9385 | struct alc_spec *spec = codec->spec; |
| 9386 | int i; |
| 9387 | |
| 9388 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9389 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9390 | if (!nid) |
| 9391 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9392 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9393 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9394 | snd_hda_codec_write(codec, nid, 0, |
| 9395 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9396 | AMP_OUT_MUTE); |
| 9397 | } |
| 9398 | } |
| 9399 | |
| 9400 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9401 | { |
| 9402 | struct alc_spec *spec = codec->spec; |
| 9403 | int c; |
| 9404 | |
| 9405 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9406 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9407 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9408 | unsigned int mux_idx; |
| 9409 | const struct hda_input_mux *imux; |
| 9410 | int conns, mute, idx, item; |
| 9411 | |
| 9412 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9413 | ARRAY_SIZE(conn_list)); |
| 9414 | if (conns < 0) |
| 9415 | continue; |
| 9416 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9417 | imux = &spec->input_mux[mux_idx]; |
| 9418 | for (idx = 0; idx < conns; idx++) { |
| 9419 | /* if the current connection is the selected one, |
| 9420 | * unmute it as default - otherwise mute it |
| 9421 | */ |
| 9422 | mute = AMP_IN_MUTE(idx); |
| 9423 | for (item = 0; item < imux->num_items; item++) { |
| 9424 | if (imux->items[item].index == idx) { |
| 9425 | if (spec->cur_mux[c] == item) |
| 9426 | mute = AMP_IN_UNMUTE(idx); |
| 9427 | break; |
| 9428 | } |
| 9429 | } |
| 9430 | /* check if we have a selector or mixer |
| 9431 | * we could check for the widget type instead, but |
| 9432 | * just check for Amp-In presence (in case of mixer |
| 9433 | * without amp-in there is something wrong, this |
| 9434 | * function shouldn't be used or capsrc nid is wrong) |
| 9435 | */ |
| 9436 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9437 | snd_hda_codec_write(codec, nid, 0, |
| 9438 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9439 | mute); |
| 9440 | else if (mute != AMP_IN_MUTE(idx)) |
| 9441 | snd_hda_codec_write(codec, nid, 0, |
| 9442 | AC_VERB_SET_CONNECT_SEL, |
| 9443 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9444 | } |
| 9445 | } |
| 9446 | } |
| 9447 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9448 | /* add mic boosts if needed */ |
| 9449 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9450 | { |
| 9451 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9452 | int err; |
| 9453 | hda_nid_t nid; |
| 9454 | |
| 9455 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9456 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9457 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9458 | "Mic Boost", |
| 9459 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9460 | if (err < 0) |
| 9461 | return err; |
| 9462 | } |
| 9463 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9464 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9465 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9466 | "Front Mic Boost", |
| 9467 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9468 | if (err < 0) |
| 9469 | return err; |
| 9470 | } |
| 9471 | return 0; |
| 9472 | } |
| 9473 | |
| 9474 | /* almost identical with ALC880 parser... */ |
| 9475 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9476 | { |
| 9477 | struct alc_spec *spec = codec->spec; |
| 9478 | struct auto_pin_cfg *autocfg = &spec->autocfg; |
| 9479 | unsigned int wcap; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9480 | int i; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9481 | int err = alc880_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9482 | |
| 9483 | if (err < 0) |
| 9484 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9485 | else if (!err) |
| 9486 | return 0; /* no config found */ |
| 9487 | |
| 9488 | err = alc_auto_add_mic_boost(codec); |
| 9489 | if (err < 0) |
| 9490 | return err; |
| 9491 | |
| 9492 | /* hack - override the init verbs */ |
| 9493 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9494 | /* if ADC 0x07 is available, initialize it, too */ |
| 9495 | wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9496 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9497 | if (wcap == AC_WID_AUD_IN) |
| 9498 | add_verb(spec, alc882_adc1_init_verbs); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9499 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9500 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9501 | * because it's under 0x18 |
| 9502 | */ |
| 9503 | if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9504 | autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9505 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9506 | for (i = 1; i < 3; i++) |
| 9507 | memcpy(&spec->private_imux[i], |
| 9508 | &spec->private_imux[0], |
| 9509 | sizeof(spec->private_imux[0])); |
| 9510 | imux->items[imux->num_items].label = "Int DMic"; |
| 9511 | imux->items[imux->num_items].index = 0x0b; |
| 9512 | imux->num_items++; |
| 9513 | spec->num_mux_defs = 3; |
| 9514 | spec->input_mux = spec->private_imux; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9515 | } |
| 9516 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9517 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9518 | } |
| 9519 | |
| 9520 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9521 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9522 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9523 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9524 | alc882_auto_init_multi_out(codec); |
| 9525 | alc882_auto_init_hp_out(codec); |
| 9526 | alc882_auto_init_analog_input(codec); |
| 9527 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9528 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9529 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9530 | } |
| 9531 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9532 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9533 | { |
| 9534 | struct alc_spec *spec; |
| 9535 | int err, board_config; |
| 9536 | |
| 9537 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9538 | if (spec == NULL) |
| 9539 | return -ENOMEM; |
| 9540 | |
| 9541 | codec->spec = spec; |
| 9542 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9543 | switch (codec->vendor_id) { |
| 9544 | case 0x10ec0882: |
| 9545 | case 0x10ec0885: |
| 9546 | break; |
| 9547 | default: |
| 9548 | /* ALC883 and variants */ |
| 9549 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9550 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9551 | } |
| 9552 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9553 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9554 | alc882_models, |
| 9555 | alc882_cfg_tbl); |
| 9556 | |
| 9557 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9558 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9559 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9560 | |
| 9561 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9562 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9563 | codec->chip_name); |
| 9564 | board_config = ALC882_AUTO; |
| 9565 | } |
| 9566 | |
| 9567 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9568 | |
| 9569 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9570 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9571 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9572 | if (err < 0) { |
| 9573 | alc_free(codec); |
| 9574 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9575 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9576 | printk(KERN_INFO |
| 9577 | "hda_codec: Cannot set up configuration " |
| 9578 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9579 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9580 | } |
| 9581 | } |
| 9582 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9583 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9584 | if (err < 0) { |
| 9585 | alc_free(codec); |
| 9586 | return err; |
| 9587 | } |
| 9588 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9589 | if (board_config != ALC882_AUTO) |
| 9590 | setup_preset(spec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9591 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9592 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9593 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9594 | /* FIXME: setup DAC5 */ |
| 9595 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9596 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9597 | |
| 9598 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9599 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9600 | |
| 9601 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9602 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9603 | |
| 9604 | if (!spec->adc_nids && spec->input_mux) { |
| 9605 | int i; |
| 9606 | spec->num_adc_nids = 0; |
| 9607 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9608 | hda_nid_t cap; |
| 9609 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9610 | unsigned int wcap = get_wcaps(codec, nid); |
| 9611 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9612 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9613 | if (wcap != AC_WID_AUD_IN) |
| 9614 | continue; |
| 9615 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9616 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9617 | if (err < 0) |
| 9618 | continue; |
| 9619 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9620 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9621 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9622 | spec->adc_nids = spec->private_adc_nids; |
| 9623 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9624 | } |
| 9625 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9626 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9627 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9628 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9629 | spec->vmaster_nid = 0x0c; |
| 9630 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9631 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9632 | if (board_config == ALC882_AUTO) |
| 9633 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9634 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9635 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9636 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9637 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9638 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9639 | |
| 9640 | return 0; |
| 9641 | } |
| 9642 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9643 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9644 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9645 | * ALC262 support |
| 9646 | */ |
| 9647 | |
| 9648 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9649 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9650 | |
| 9651 | #define alc262_dac_nids alc260_dac_nids |
| 9652 | #define alc262_adc_nids alc882_adc_nids |
| 9653 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9654 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9655 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9656 | |
| 9657 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9658 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9659 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9660 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9661 | /* ADC0 */ |
| 9662 | 0x09 |
| 9663 | }; |
| 9664 | |
| 9665 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9667 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9668 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9669 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9670 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9671 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9673 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9674 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9676 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9677 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9678 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9679 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9680 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9681 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9682 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9683 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9684 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9685 | }; |
| 9686 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9687 | /* update HP, line and mono-out pins according to the master switch */ |
| 9688 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9689 | { |
| 9690 | struct alc_spec *spec = codec->spec; |
| 9691 | int val = spec->master_sw; |
| 9692 | |
| 9693 | /* HP & line-out */ |
| 9694 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9695 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9696 | val ? PIN_HP : 0); |
| 9697 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9698 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9699 | val ? PIN_HP : 0); |
| 9700 | /* mono (speaker) depending on the HP jack sense */ |
| 9701 | val = val && !spec->jack_present; |
| 9702 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9703 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9704 | val ? PIN_OUT : 0); |
| 9705 | } |
| 9706 | |
| 9707 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9708 | { |
| 9709 | struct alc_spec *spec = codec->spec; |
| 9710 | unsigned int presence; |
| 9711 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9712 | AC_VERB_GET_PIN_SENSE, 0); |
| 9713 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9714 | alc262_hp_master_update(codec); |
| 9715 | } |
| 9716 | |
| 9717 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9718 | { |
| 9719 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9720 | return; |
| 9721 | alc262_hp_bpc_automute(codec); |
| 9722 | } |
| 9723 | |
| 9724 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9725 | { |
| 9726 | struct alc_spec *spec = codec->spec; |
| 9727 | unsigned int presence; |
| 9728 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9729 | AC_VERB_GET_PIN_SENSE, 0); |
| 9730 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9731 | alc262_hp_master_update(codec); |
| 9732 | } |
| 9733 | |
| 9734 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9735 | unsigned int res) |
| 9736 | { |
| 9737 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9738 | return; |
| 9739 | alc262_hp_wildwest_automute(codec); |
| 9740 | } |
| 9741 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9742 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9743 | |
| 9744 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9745 | struct snd_ctl_elem_value *ucontrol) |
| 9746 | { |
| 9747 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9748 | struct alc_spec *spec = codec->spec; |
| 9749 | int val = !!*ucontrol->value.integer.value; |
| 9750 | |
| 9751 | if (val == spec->master_sw) |
| 9752 | return 0; |
| 9753 | spec->master_sw = val; |
| 9754 | alc262_hp_master_update(codec); |
| 9755 | return 1; |
| 9756 | } |
| 9757 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9758 | #define ALC262_HP_MASTER_SWITCH \ |
| 9759 | { \ |
| 9760 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9761 | .name = "Master Playback Switch", \ |
| 9762 | .info = snd_ctl_boolean_mono_info, \ |
| 9763 | .get = alc262_hp_master_sw_get, \ |
| 9764 | .put = alc262_hp_master_sw_put, \ |
| 9765 | } |
| 9766 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9767 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9768 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9769 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9770 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9772 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9773 | HDA_OUTPUT), |
| 9774 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9775 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9778 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9779 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9781 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9782 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9783 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9784 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9785 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9786 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9787 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9788 | { } /* end */ |
| 9789 | }; |
| 9790 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9791 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9792 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9793 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9794 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9795 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9796 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9797 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9798 | HDA_OUTPUT), |
| 9799 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9800 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9803 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9804 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9805 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9806 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9807 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9808 | { } /* end */ |
| 9809 | }; |
| 9810 | |
| 9811 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9812 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9813 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9814 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9815 | { } /* end */ |
| 9816 | }; |
| 9817 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9818 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9819 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9820 | { |
| 9821 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9822 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9823 | spec->autocfg.hp_pins[0] = 0x15; |
| 9824 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 9825 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9826 | } |
| 9827 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9828 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9829 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9830 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9831 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9832 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9835 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9836 | { } /* end */ |
| 9837 | }; |
| 9838 | |
| 9839 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9840 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9841 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9842 | |
| 9843 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9844 | { } |
| 9845 | }; |
| 9846 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9847 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9848 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9849 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9850 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9851 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9854 | { } /* end */ |
| 9855 | }; |
| 9856 | |
| 9857 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9858 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9859 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9860 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9861 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9862 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9863 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9864 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9865 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9866 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9867 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9868 | {} |
| 9869 | }; |
| 9870 | |
| 9871 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9872 | .num_items = 1, |
| 9873 | .items = { |
| 9874 | { "Line", 0x1 }, |
| 9875 | }, |
| 9876 | }; |
| 9877 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9878 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 9879 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 9880 | { |
| 9881 | struct alc_spec *spec = codec->spec; |
| 9882 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9883 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9884 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9885 | unsigned int mute; |
| 9886 | |
| 9887 | /* HP */ |
| 9888 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 9889 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 9890 | HDA_AMP_MUTE, mute); |
| 9891 | /* mute internal speaker per jack sense */ |
| 9892 | if (spec->jack_present) |
| 9893 | mute = HDA_AMP_MUTE; |
| 9894 | if (line_nid) |
| 9895 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 9896 | HDA_AMP_MUTE, mute); |
| 9897 | if (speaker_nid && speaker_nid != line_nid) |
| 9898 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 9899 | HDA_AMP_MUTE, mute); |
| 9900 | } |
| 9901 | |
| 9902 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 9903 | |
| 9904 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9905 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9906 | { |
| 9907 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9908 | struct alc_spec *spec = codec->spec; |
| 9909 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9910 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9911 | if (val == spec->master_sw) |
| 9912 | return 0; |
| 9913 | spec->master_sw = val; |
| 9914 | alc262_hippo_master_update(codec); |
| 9915 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9916 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9917 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9918 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 9919 | { \ |
| 9920 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9921 | .name = "Master Playback Switch", \ |
| 9922 | .info = snd_ctl_boolean_mono_info, \ |
| 9923 | .get = alc262_hippo_master_sw_get, \ |
| 9924 | .put = alc262_hippo_master_sw_put, \ |
| 9925 | } |
| 9926 | |
| 9927 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 9928 | ALC262_HIPPO_MASTER_SWITCH, |
| 9929 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9930 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9931 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9932 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9933 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9934 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9935 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9936 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9937 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9938 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9939 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9940 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9941 | { } /* end */ |
| 9942 | }; |
| 9943 | |
| 9944 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9945 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9946 | ALC262_HIPPO_MASTER_SWITCH, |
| 9947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9950 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9953 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9954 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9955 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9956 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9957 | { } /* end */ |
| 9958 | }; |
| 9959 | |
| 9960 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9961 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 9962 | { |
| 9963 | struct alc_spec *spec = codec->spec; |
| 9964 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9965 | unsigned int present; |
| 9966 | |
| 9967 | /* need to execute and sync at first */ |
| 9968 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9969 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 9970 | AC_VERB_GET_PIN_SENSE, 0); |
| 9971 | spec->jack_present = (present & 0x80000000) != 0; |
| 9972 | alc262_hippo_master_update(codec); |
| 9973 | } |
| 9974 | |
| 9975 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9976 | { |
| 9977 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9978 | return; |
| 9979 | alc262_hippo_automute(codec); |
| 9980 | } |
| 9981 | |
| 9982 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 9983 | { |
| 9984 | struct alc_spec *spec = codec->spec; |
| 9985 | |
| 9986 | spec->autocfg.hp_pins[0] = 0x15; |
| 9987 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9988 | alc262_hippo_automute(codec); |
| 9989 | } |
| 9990 | |
| 9991 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 9992 | { |
| 9993 | struct alc_spec *spec = codec->spec; |
| 9994 | |
| 9995 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9996 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9997 | alc262_hippo_automute(codec); |
| 9998 | } |
| 9999 | |
| 10000 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10001 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10002 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10003 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10004 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10005 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10006 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10007 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10008 | { } /* end */ |
| 10009 | }; |
| 10010 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10011 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10012 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10013 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10014 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10015 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10016 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10017 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10018 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10019 | { } /* end */ |
| 10020 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10021 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10022 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10023 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10024 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10025 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10026 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10027 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10028 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10029 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10030 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10031 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10032 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10033 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10034 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10035 | { } /* end */ |
| 10036 | }; |
| 10037 | |
| 10038 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10039 | /* Headphone automute */ |
| 10040 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10041 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10042 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10043 | |
| 10044 | /* P11 AUX_IN, white 4-pin connector */ |
| 10045 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10046 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10047 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10048 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10049 | |
| 10050 | {} |
| 10051 | }; |
| 10052 | |
| 10053 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10054 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10055 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10056 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10057 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10058 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10059 | spec->autocfg.speaker_pins[0] = 0x15; |
| 10060 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10061 | } |
| 10062 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10063 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10064 | #define alc262_capture_mixer alc882_capture_mixer |
| 10065 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10066 | |
| 10067 | /* |
| 10068 | * generic initialization of ADC, input mixers and output mixers |
| 10069 | */ |
| 10070 | static struct hda_verb alc262_init_verbs[] = { |
| 10071 | /* |
| 10072 | * Unmute ADC0-2 and set the default input to mic-in |
| 10073 | */ |
| 10074 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10075 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10076 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10077 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10078 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10079 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10080 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10081 | /* 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] | 10082 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10083 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10084 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10085 | */ |
| 10086 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10088 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10092 | |
| 10093 | /* |
| 10094 | * Set up output mixers (0x0c - 0x0e) |
| 10095 | */ |
| 10096 | /* set vol=0 to output mixers */ |
| 10097 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10098 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10099 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10100 | /* set up input amps for analog loopback */ |
| 10101 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10105 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10107 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10108 | |
| 10109 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10110 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10111 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10112 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10113 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10114 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10115 | |
| 10116 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10118 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10119 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10120 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10121 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10122 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10123 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10124 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10125 | /* FIXME: use matrix-type input source selection */ |
| 10126 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10127 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10128 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10129 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10130 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10131 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10132 | /* Input mixer2 */ |
| 10133 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10134 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10135 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10136 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10137 | /* Input mixer3 */ |
| 10138 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10140 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10141 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10142 | |
| 10143 | { } |
| 10144 | }; |
| 10145 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10146 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10147 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10148 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10149 | { } |
| 10150 | }; |
| 10151 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10152 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10153 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10154 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10155 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10156 | |
| 10157 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10158 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10159 | {} |
| 10160 | }; |
| 10161 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10162 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10163 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10164 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10165 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10166 | |
| 10167 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10169 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10170 | }; |
| 10171 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10172 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10173 | .num_items = 2, |
| 10174 | .items = { |
| 10175 | { "Int DMic", 0x9 }, |
| 10176 | { "Mic", 0x0 }, |
| 10177 | }, |
| 10178 | }; |
| 10179 | |
| 10180 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10181 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10182 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10183 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10184 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10185 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10186 | { } /* end */ |
| 10187 | }; |
| 10188 | |
| 10189 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10190 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10191 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10192 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10193 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10194 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10195 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10196 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10197 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10198 | {} |
| 10199 | }; |
| 10200 | |
| 10201 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10202 | { |
| 10203 | unsigned int present; |
| 10204 | |
| 10205 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10206 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10207 | snd_hda_codec_write(codec, 0x22, 0, |
| 10208 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10209 | } |
| 10210 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10211 | |
| 10212 | /* unsolicited event for HP jack sensing */ |
| 10213 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10214 | unsigned int res) |
| 10215 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10216 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10217 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10218 | else |
| 10219 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10220 | } |
| 10221 | |
| 10222 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10223 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10224 | struct alc_spec *spec = codec->spec; |
| 10225 | |
| 10226 | spec->autocfg.hp_pins[0] = 0x15; |
| 10227 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10228 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10229 | alc262_dmic_automute(codec); |
| 10230 | } |
| 10231 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10232 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10233 | * nec model |
| 10234 | * 0x15 = headphone |
| 10235 | * 0x16 = internal speaker |
| 10236 | * 0x18 = external mic |
| 10237 | */ |
| 10238 | |
| 10239 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10240 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10241 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10242 | |
| 10243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10245 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10246 | |
| 10247 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10248 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10249 | { } /* end */ |
| 10250 | }; |
| 10251 | |
| 10252 | static struct hda_verb alc262_nec_verbs[] = { |
| 10253 | /* Unmute Speaker */ |
| 10254 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10255 | |
| 10256 | /* Headphone */ |
| 10257 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10259 | |
| 10260 | /* External mic to headphone */ |
| 10261 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10262 | /* External mic to speaker */ |
| 10263 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10264 | {} |
| 10265 | }; |
| 10266 | |
| 10267 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10268 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10269 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10270 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10271 | */ |
| 10272 | |
| 10273 | #define ALC_HP_EVENT 0x37 |
| 10274 | |
| 10275 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10276 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10277 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10278 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10279 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10280 | {} |
| 10281 | }; |
| 10282 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10283 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10284 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10286 | {} |
| 10287 | }; |
| 10288 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10289 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10290 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10291 | .items = { |
| 10292 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10293 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10294 | { "CD", 0x4 }, |
| 10295 | }, |
| 10296 | }; |
| 10297 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10298 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10299 | .num_items = 5, |
| 10300 | .items = { |
| 10301 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10302 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10303 | { "Line", 0x2 }, |
| 10304 | { "CD", 0x4 }, |
| 10305 | { "AUX IN", 0x6 }, |
| 10306 | }, |
| 10307 | }; |
| 10308 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10309 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10310 | .num_items = 4, |
| 10311 | .items = { |
| 10312 | { "Mic", 0x0 }, |
| 10313 | { "Front Mic", 0x2 }, |
| 10314 | { "Line", 0x1 }, |
| 10315 | { "CD", 0x4 }, |
| 10316 | }, |
| 10317 | }; |
| 10318 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10319 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10320 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10321 | { |
| 10322 | struct alc_spec *spec = codec->spec; |
| 10323 | unsigned int mute; |
| 10324 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10325 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10326 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10327 | /* need to execute and sync at first */ |
| 10328 | 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] | 10329 | /* check laptop HP jack */ |
| 10330 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10331 | AC_VERB_GET_PIN_SENSE, 0); |
| 10332 | /* need to execute and sync at first */ |
| 10333 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10334 | /* check docking HP jack */ |
| 10335 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10336 | AC_VERB_GET_PIN_SENSE, 0); |
| 10337 | if (present & AC_PINSENSE_PRESENCE) |
| 10338 | spec->jack_present = 1; |
| 10339 | else |
| 10340 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10341 | spec->sense_updated = 1; |
| 10342 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10343 | /* unmute internal speaker only if both HPs are unplugged and |
| 10344 | * master switch is on |
| 10345 | */ |
| 10346 | if (spec->jack_present) |
| 10347 | mute = HDA_AMP_MUTE; |
| 10348 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10349 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10350 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10351 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10352 | } |
| 10353 | |
| 10354 | /* unsolicited event for HP jack sensing */ |
| 10355 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10356 | unsigned int res) |
| 10357 | { |
| 10358 | if ((res >> 26) != ALC_HP_EVENT) |
| 10359 | return; |
| 10360 | alc262_fujitsu_automute(codec, 1); |
| 10361 | } |
| 10362 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10363 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10364 | { |
| 10365 | alc262_fujitsu_automute(codec, 1); |
| 10366 | } |
| 10367 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10368 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10369 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10370 | .ops = &snd_hda_bind_vol, |
| 10371 | .values = { |
| 10372 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10373 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10374 | 0 |
| 10375 | }, |
| 10376 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10377 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10378 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10379 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10380 | { |
| 10381 | struct alc_spec *spec = codec->spec; |
| 10382 | unsigned int mute; |
| 10383 | |
| 10384 | if (force || !spec->sense_updated) { |
| 10385 | unsigned int present_int_hp; |
| 10386 | /* need to execute and sync at first */ |
| 10387 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10388 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10389 | AC_VERB_GET_PIN_SENSE, 0); |
| 10390 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10391 | spec->sense_updated = 1; |
| 10392 | } |
| 10393 | if (spec->jack_present) { |
| 10394 | /* mute internal speaker */ |
| 10395 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10396 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10397 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10398 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10399 | } else { |
| 10400 | /* unmute internal speaker if necessary */ |
| 10401 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10402 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10403 | HDA_AMP_MUTE, mute); |
| 10404 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10405 | HDA_AMP_MUTE, mute); |
| 10406 | } |
| 10407 | } |
| 10408 | |
| 10409 | /* unsolicited event for HP jack sensing */ |
| 10410 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10411 | unsigned int res) |
| 10412 | { |
| 10413 | if ((res >> 26) != ALC_HP_EVENT) |
| 10414 | return; |
| 10415 | alc262_lenovo_3000_automute(codec, 1); |
| 10416 | } |
| 10417 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10418 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10419 | int dir, int idx, long *valp) |
| 10420 | { |
| 10421 | int i, change = 0; |
| 10422 | |
| 10423 | for (i = 0; i < 2; i++, valp++) |
| 10424 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10425 | HDA_AMP_MUTE, |
| 10426 | *valp ? 0 : HDA_AMP_MUTE); |
| 10427 | return change; |
| 10428 | } |
| 10429 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10430 | /* bind hp and internal speaker mute (with plug check) */ |
| 10431 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10432 | struct snd_ctl_elem_value *ucontrol) |
| 10433 | { |
| 10434 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10435 | long *valp = ucontrol->value.integer.value; |
| 10436 | int change; |
| 10437 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10438 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10439 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10440 | if (change) |
| 10441 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10442 | return change; |
| 10443 | } |
| 10444 | |
| 10445 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10446 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10447 | { |
| 10448 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10449 | .name = "Master Playback Switch", |
| 10450 | .info = snd_hda_mixer_amp_switch_info, |
| 10451 | .get = snd_hda_mixer_amp_switch_get, |
| 10452 | .put = alc262_fujitsu_master_sw_put, |
| 10453 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10454 | }, |
| 10455 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10456 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10457 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10458 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10459 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10460 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10461 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10462 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10463 | { } /* end */ |
| 10464 | }; |
| 10465 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10466 | /* bind hp and internal speaker mute (with plug check) */ |
| 10467 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10468 | struct snd_ctl_elem_value *ucontrol) |
| 10469 | { |
| 10470 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10471 | long *valp = ucontrol->value.integer.value; |
| 10472 | int change; |
| 10473 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10474 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10475 | if (change) |
| 10476 | alc262_lenovo_3000_automute(codec, 0); |
| 10477 | return change; |
| 10478 | } |
| 10479 | |
| 10480 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10481 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10482 | { |
| 10483 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10484 | .name = "Master Playback Switch", |
| 10485 | .info = snd_hda_mixer_amp_switch_info, |
| 10486 | .get = snd_hda_mixer_amp_switch_get, |
| 10487 | .put = alc262_lenovo_3000_master_sw_put, |
| 10488 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10489 | }, |
| 10490 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10491 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10492 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10493 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10494 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10495 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10496 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10497 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10498 | { } /* end */ |
| 10499 | }; |
| 10500 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10501 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10502 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10503 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10504 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10506 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10507 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10508 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10509 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10510 | { } /* end */ |
| 10511 | }; |
| 10512 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10513 | /* additional init verbs for Benq laptops */ |
| 10514 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10515 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10516 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10517 | {} |
| 10518 | }; |
| 10519 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10520 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10522 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10523 | |
| 10524 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10525 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10526 | {} |
| 10527 | }; |
| 10528 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10529 | /* Samsung Q1 Ultra Vista model setup */ |
| 10530 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10531 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10532 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10535 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10536 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10537 | { } /* end */ |
| 10538 | }; |
| 10539 | |
| 10540 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10541 | /* output mixer */ |
| 10542 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10543 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10544 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10545 | /* speaker */ |
| 10546 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10547 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10548 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10549 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10550 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10553 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10554 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10555 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10556 | /* internal mic */ |
| 10557 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10558 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10559 | /* ADC, choose mic */ |
| 10560 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10561 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10562 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10563 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10564 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10565 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10566 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10567 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10568 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10569 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10570 | {} |
| 10571 | }; |
| 10572 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10573 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10574 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10575 | { |
| 10576 | struct alc_spec *spec = codec->spec; |
| 10577 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10578 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10579 | mute = 0; |
| 10580 | /* auto-mute only when HP is used as HP */ |
| 10581 | if (!spec->cur_mux[0]) { |
| 10582 | unsigned int present; |
| 10583 | /* need to execute and sync at first */ |
| 10584 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10585 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10586 | AC_VERB_GET_PIN_SENSE, 0); |
| 10587 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10588 | if (spec->jack_present) |
| 10589 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10590 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10591 | /* mute/unmute internal speaker */ |
| 10592 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10593 | HDA_AMP_MUTE, mute); |
| 10594 | /* mute/unmute HP */ |
| 10595 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10596 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10597 | } |
| 10598 | |
| 10599 | /* unsolicited event for HP jack sensing */ |
| 10600 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10601 | unsigned int res) |
| 10602 | { |
| 10603 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10604 | return; |
| 10605 | alc262_ultra_automute(codec); |
| 10606 | } |
| 10607 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10608 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10609 | .num_items = 2, |
| 10610 | .items = { |
| 10611 | { "Mic", 0x1 }, |
| 10612 | { "Headphone", 0x7 }, |
| 10613 | }, |
| 10614 | }; |
| 10615 | |
| 10616 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10617 | struct snd_ctl_elem_value *ucontrol) |
| 10618 | { |
| 10619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10620 | struct alc_spec *spec = codec->spec; |
| 10621 | int ret; |
| 10622 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10623 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10624 | if (!ret) |
| 10625 | return 0; |
| 10626 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10627 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10628 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10629 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10630 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10631 | return ret; |
| 10632 | } |
| 10633 | |
| 10634 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10635 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10636 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10637 | { |
| 10638 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10639 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10640 | .info = alc_mux_enum_info, |
| 10641 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10642 | .put = alc262_ultra_mux_enum_put, |
| 10643 | }, |
| 10644 | { } /* end */ |
| 10645 | }; |
| 10646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10647 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10648 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10649 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10650 | { |
| 10651 | hda_nid_t nid; |
| 10652 | int err; |
| 10653 | |
| 10654 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10655 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10656 | spec->multiout.dac_nids[0] = 2; |
| 10657 | |
| 10658 | nid = cfg->line_out_pins[0]; |
| 10659 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10660 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10661 | "Front Playback Volume", |
| 10662 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10663 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10664 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10665 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10666 | "Front Playback Switch", |
| 10667 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10668 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10669 | return err; |
| 10670 | } |
| 10671 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10672 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10673 | if (nid) { |
| 10674 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10675 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10676 | "Speaker Playback Volume", |
| 10677 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10678 | HDA_OUTPUT)); |
| 10679 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10680 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10681 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10682 | "Speaker Playback Switch", |
| 10683 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10684 | HDA_OUTPUT)); |
| 10685 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10686 | return err; |
| 10687 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10688 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10689 | "Speaker Playback Switch", |
| 10690 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10691 | HDA_OUTPUT)); |
| 10692 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10693 | return err; |
| 10694 | } |
| 10695 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10696 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10697 | if (nid) { |
| 10698 | /* spec->multiout.hp_nid = 2; */ |
| 10699 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10700 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10701 | "Headphone Playback Volume", |
| 10702 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10703 | HDA_OUTPUT)); |
| 10704 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10705 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10706 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10707 | "Headphone Playback Switch", |
| 10708 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10709 | HDA_OUTPUT)); |
| 10710 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10711 | return err; |
| 10712 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10713 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10714 | "Headphone Playback Switch", |
| 10715 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10716 | HDA_OUTPUT)); |
| 10717 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10718 | return err; |
| 10719 | } |
| 10720 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10721 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10722 | } |
| 10723 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 10724 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10725 | const struct auto_pin_cfg *cfg) |
| 10726 | { |
| 10727 | int err; |
| 10728 | |
| 10729 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10730 | if (err < 0) |
| 10731 | return err; |
| 10732 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10733 | * because it's under 0x18 |
| 10734 | */ |
| 10735 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10736 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10737 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10738 | imux->items[imux->num_items].label = "Int Mic"; |
| 10739 | imux->items[imux->num_items].index = 0x09; |
| 10740 | imux->num_items++; |
| 10741 | } |
| 10742 | return 0; |
| 10743 | } |
| 10744 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10745 | |
| 10746 | /* |
| 10747 | * generic initialization of ADC, input mixers and output mixers |
| 10748 | */ |
| 10749 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10750 | /* |
| 10751 | * Unmute ADC0-2 and set the default input to mic-in |
| 10752 | */ |
| 10753 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10755 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10756 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10757 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10758 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10759 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10760 | /* 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] | 10761 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10762 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10763 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10764 | */ |
| 10765 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10771 | |
| 10772 | /* |
| 10773 | * Set up output mixers (0x0c - 0x0f) |
| 10774 | */ |
| 10775 | /* set vol=0 to output mixers */ |
| 10776 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10777 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10778 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10779 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10780 | /* set up input amps for analog loopback */ |
| 10781 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10784 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10786 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10788 | |
| 10789 | /* FIXME: use matrix-type input source selection */ |
| 10790 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10791 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10793 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10794 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10795 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10796 | /* Input mixer2 */ |
| 10797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10798 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10799 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10800 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10801 | /* Input mixer3 */ |
| 10802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10803 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10804 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10805 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10806 | |
| 10807 | { } |
| 10808 | }; |
| 10809 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10810 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10811 | /* |
| 10812 | * Unmute ADC0-2 and set the default input to mic-in |
| 10813 | */ |
| 10814 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10815 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10816 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10817 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10818 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10819 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10820 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10821 | /* 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] | 10822 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10823 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10824 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10825 | */ |
| 10826 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10827 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10829 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10830 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10833 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10834 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10835 | /* |
| 10836 | * Set up output mixers (0x0c - 0x0e) |
| 10837 | */ |
| 10838 | /* set vol=0 to output mixers */ |
| 10839 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10840 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10841 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10842 | |
| 10843 | /* set up input amps for analog loopback */ |
| 10844 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10848 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10849 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10850 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10851 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10852 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10853 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10854 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10855 | |
| 10856 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10857 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10858 | |
| 10859 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10860 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10861 | |
| 10862 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10863 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10864 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10865 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10866 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10867 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10868 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10869 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10870 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10871 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10872 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10873 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10874 | |
| 10875 | |
| 10876 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10877 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 10878 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10879 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10880 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10881 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10882 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10883 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10884 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10885 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10886 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10887 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10888 | /* Input mixer2 */ |
| 10889 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10891 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10892 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10893 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10894 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10895 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10896 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10897 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10898 | /* Input mixer3 */ |
| 10899 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10900 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10904 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10908 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10909 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10910 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10911 | { } |
| 10912 | }; |
| 10913 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10914 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10915 | /* |
| 10916 | * Unmute ADC0-2 and set the default input to mic-in |
| 10917 | */ |
| 10918 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10920 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10921 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10922 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10923 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10924 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10925 | /* 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] | 10926 | * mixer widget |
| 10927 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10928 | * panel mic (mic 2) |
| 10929 | */ |
| 10930 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10936 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10937 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10938 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10939 | /* |
| 10940 | * Set up output mixers (0x0c - 0x0e) |
| 10941 | */ |
| 10942 | /* set vol=0 to output mixers */ |
| 10943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10944 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10945 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10946 | |
| 10947 | /* set up input amps for analog loopback */ |
| 10948 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10949 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10951 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10952 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10953 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10954 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10955 | |
| 10956 | |
| 10957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10958 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10959 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10960 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10961 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10962 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10963 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10964 | |
| 10965 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10966 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10967 | |
| 10968 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10969 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10970 | |
| 10971 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10972 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10974 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10975 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10976 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10977 | |
| 10978 | /* FIXME: use matrix-type input source selection */ |
| 10979 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10980 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10981 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10982 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10983 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10986 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10987 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10988 | /* Input mixer2 */ |
| 10989 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10990 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10991 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10992 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10993 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10994 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10996 | /* Input mixer3 */ |
| 10997 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11002 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11004 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11005 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11006 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11007 | { } |
| 11008 | }; |
| 11009 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11010 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11011 | |
| 11012 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11013 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11014 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11015 | |
| 11016 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11017 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11018 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11019 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11020 | |
| 11021 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11022 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11023 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11024 | {} |
| 11025 | }; |
| 11026 | |
| 11027 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11028 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11029 | #define alc262_loopbacks alc880_loopbacks |
| 11030 | #endif |
| 11031 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11032 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11033 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11034 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11035 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11036 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11037 | |
| 11038 | /* |
| 11039 | * BIOS auto configuration |
| 11040 | */ |
| 11041 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11042 | { |
| 11043 | struct alc_spec *spec = codec->spec; |
| 11044 | int err; |
| 11045 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11046 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11047 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11048 | alc262_ignore); |
| 11049 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11050 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11051 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11052 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11053 | spec->multiout.max_channels = 2; |
| 11054 | spec->no_analog = 1; |
| 11055 | goto dig_only; |
| 11056 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11057 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11058 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11059 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11060 | if (err < 0) |
| 11061 | return err; |
| 11062 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11063 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11064 | return err; |
| 11065 | |
| 11066 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11067 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11068 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11069 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11070 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11071 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11072 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11073 | if (spec->autocfg.dig_in_pin) |
| 11074 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11075 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11076 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11077 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11078 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11079 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11080 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11081 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11082 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11083 | err = alc_auto_add_mic_boost(codec); |
| 11084 | if (err < 0) |
| 11085 | return err; |
| 11086 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11087 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11088 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11089 | return 1; |
| 11090 | } |
| 11091 | |
| 11092 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11093 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11094 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11095 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11096 | |
| 11097 | |
| 11098 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11099 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11100 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11101 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11102 | alc262_auto_init_multi_out(codec); |
| 11103 | alc262_auto_init_hp_out(codec); |
| 11104 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11105 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11106 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11107 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11108 | } |
| 11109 | |
| 11110 | /* |
| 11111 | * configuration and preset |
| 11112 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11113 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11114 | [ALC262_BASIC] = "basic", |
| 11115 | [ALC262_HIPPO] = "hippo", |
| 11116 | [ALC262_HIPPO_1] = "hippo_1", |
| 11117 | [ALC262_FUJITSU] = "fujitsu", |
| 11118 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11119 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11120 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11121 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11122 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11123 | [ALC262_BENQ_T31] = "benq-t31", |
| 11124 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11125 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11126 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11127 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11128 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11129 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11130 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11131 | [ALC262_AUTO] = "auto", |
| 11132 | }; |
| 11133 | |
| 11134 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11135 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11136 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11137 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11138 | ALC262_HP_BPC), |
| 11139 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11140 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11141 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11142 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11143 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11144 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11145 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11146 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11147 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11148 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11149 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11150 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11151 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11152 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11153 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11154 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11155 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11156 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11157 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11158 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11159 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11160 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11161 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11162 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11163 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11164 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11165 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11166 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11167 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11168 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11169 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11170 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11171 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11172 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11173 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11174 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11175 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11176 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11177 | {} |
| 11178 | }; |
| 11179 | |
| 11180 | static struct alc_config_preset alc262_presets[] = { |
| 11181 | [ALC262_BASIC] = { |
| 11182 | .mixers = { alc262_base_mixer }, |
| 11183 | .init_verbs = { alc262_init_verbs }, |
| 11184 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11185 | .dac_nids = alc262_dac_nids, |
| 11186 | .hp_nid = 0x03, |
| 11187 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11188 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11189 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11190 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11191 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11192 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 11193 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11194 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11195 | .dac_nids = alc262_dac_nids, |
| 11196 | .hp_nid = 0x03, |
| 11197 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11198 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11199 | .channel_mode = alc262_modes, |
| 11200 | .input_mux = &alc262_capture_source, |
| 11201 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11202 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11203 | }, |
| 11204 | [ALC262_HIPPO_1] = { |
| 11205 | .mixers = { alc262_hippo1_mixer }, |
| 11206 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11207 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11208 | .dac_nids = alc262_dac_nids, |
| 11209 | .hp_nid = 0x02, |
| 11210 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11211 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11212 | .channel_mode = alc262_modes, |
| 11213 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11214 | .unsol_event = alc262_hippo_unsol_event, |
| 11215 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11216 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11217 | [ALC262_FUJITSU] = { |
| 11218 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11219 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11220 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11221 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11222 | .dac_nids = alc262_dac_nids, |
| 11223 | .hp_nid = 0x03, |
| 11224 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11225 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11226 | .channel_mode = alc262_modes, |
| 11227 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11228 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11229 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11230 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11231 | [ALC262_HP_BPC] = { |
| 11232 | .mixers = { alc262_HP_BPC_mixer }, |
| 11233 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11234 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11235 | .dac_nids = alc262_dac_nids, |
| 11236 | .hp_nid = 0x03, |
| 11237 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11238 | .channel_mode = alc262_modes, |
| 11239 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11240 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11241 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11242 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11243 | [ALC262_HP_BPC_D7000_WF] = { |
| 11244 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11245 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11246 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11247 | .dac_nids = alc262_dac_nids, |
| 11248 | .hp_nid = 0x03, |
| 11249 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11250 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11251 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11252 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11253 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11254 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11255 | [ALC262_HP_BPC_D7000_WL] = { |
| 11256 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11257 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11258 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11259 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11260 | .dac_nids = alc262_dac_nids, |
| 11261 | .hp_nid = 0x03, |
| 11262 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11263 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11264 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11265 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11266 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11267 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11268 | [ALC262_HP_TC_T5735] = { |
| 11269 | .mixers = { alc262_hp_t5735_mixer }, |
| 11270 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11271 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11272 | .dac_nids = alc262_dac_nids, |
| 11273 | .hp_nid = 0x03, |
| 11274 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11275 | .channel_mode = alc262_modes, |
| 11276 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11277 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11278 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11279 | }, |
| 11280 | [ALC262_HP_RP5700] = { |
| 11281 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11282 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11283 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11284 | .dac_nids = alc262_dac_nids, |
| 11285 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11286 | .channel_mode = alc262_modes, |
| 11287 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11288 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11289 | [ALC262_BENQ_ED8] = { |
| 11290 | .mixers = { alc262_base_mixer }, |
| 11291 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11292 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11293 | .dac_nids = alc262_dac_nids, |
| 11294 | .hp_nid = 0x03, |
| 11295 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11296 | .channel_mode = alc262_modes, |
| 11297 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11298 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11299 | [ALC262_SONY_ASSAMD] = { |
| 11300 | .mixers = { alc262_sony_mixer }, |
| 11301 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11302 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11303 | .dac_nids = alc262_dac_nids, |
| 11304 | .hp_nid = 0x02, |
| 11305 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11306 | .channel_mode = alc262_modes, |
| 11307 | .input_mux = &alc262_capture_source, |
| 11308 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11309 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11310 | }, |
| 11311 | [ALC262_BENQ_T31] = { |
| 11312 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame^] | 11313 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11314 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11315 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11316 | .dac_nids = alc262_dac_nids, |
| 11317 | .hp_nid = 0x03, |
| 11318 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11319 | .channel_mode = alc262_modes, |
| 11320 | .input_mux = &alc262_capture_source, |
| 11321 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11322 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11323 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11324 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11325 | .mixers = { alc262_ultra_mixer }, |
| 11326 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11327 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11328 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11329 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11330 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11331 | .channel_mode = alc262_modes, |
| 11332 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11333 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11334 | .capsrc_nids = alc262_capsrc_nids, |
| 11335 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11336 | .unsol_event = alc262_ultra_unsol_event, |
| 11337 | .init_hook = alc262_ultra_automute, |
| 11338 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11339 | [ALC262_LENOVO_3000] = { |
| 11340 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11341 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11342 | alc262_lenovo_3000_unsol_verbs }, |
| 11343 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11344 | .dac_nids = alc262_dac_nids, |
| 11345 | .hp_nid = 0x03, |
| 11346 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11347 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11348 | .channel_mode = alc262_modes, |
| 11349 | .input_mux = &alc262_fujitsu_capture_source, |
| 11350 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11351 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11352 | [ALC262_NEC] = { |
| 11353 | .mixers = { alc262_nec_mixer }, |
| 11354 | .init_verbs = { alc262_nec_verbs }, |
| 11355 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11356 | .dac_nids = alc262_dac_nids, |
| 11357 | .hp_nid = 0x03, |
| 11358 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11359 | .channel_mode = alc262_modes, |
| 11360 | .input_mux = &alc262_capture_source, |
| 11361 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11362 | [ALC262_TOSHIBA_S06] = { |
| 11363 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11364 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11365 | alc262_eapd_verbs }, |
| 11366 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11367 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11368 | .dac_nids = alc262_dac_nids, |
| 11369 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11370 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11371 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11372 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11373 | .channel_mode = alc262_modes, |
| 11374 | .input_mux = &alc262_dmic_capture_source, |
| 11375 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11376 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11377 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11378 | [ALC262_TOSHIBA_RX1] = { |
| 11379 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11380 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11381 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11382 | .dac_nids = alc262_dac_nids, |
| 11383 | .hp_nid = 0x03, |
| 11384 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11385 | .channel_mode = alc262_modes, |
| 11386 | .input_mux = &alc262_capture_source, |
| 11387 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11388 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11389 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11390 | [ALC262_TYAN] = { |
| 11391 | .mixers = { alc262_tyan_mixer }, |
| 11392 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11393 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11394 | .dac_nids = alc262_dac_nids, |
| 11395 | .hp_nid = 0x02, |
| 11396 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11397 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11398 | .channel_mode = alc262_modes, |
| 11399 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11400 | .unsol_event = alc_automute_amp_unsol_event, |
| 11401 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11402 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11403 | }; |
| 11404 | |
| 11405 | static int patch_alc262(struct hda_codec *codec) |
| 11406 | { |
| 11407 | struct alc_spec *spec; |
| 11408 | int board_config; |
| 11409 | int err; |
| 11410 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11411 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11412 | if (spec == NULL) |
| 11413 | return -ENOMEM; |
| 11414 | |
| 11415 | codec->spec = spec; |
| 11416 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11417 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11418 | * under-run |
| 11419 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11420 | { |
| 11421 | int tmp; |
| 11422 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11423 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11424 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11425 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11426 | } |
| 11427 | #endif |
| 11428 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11429 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11430 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11431 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11432 | alc262_models, |
| 11433 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11434 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11435 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11436 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11437 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11438 | board_config = ALC262_AUTO; |
| 11439 | } |
| 11440 | |
| 11441 | if (board_config == ALC262_AUTO) { |
| 11442 | /* automatic parse from the BIOS config */ |
| 11443 | err = alc262_parse_auto_config(codec); |
| 11444 | if (err < 0) { |
| 11445 | alc_free(codec); |
| 11446 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11447 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11448 | printk(KERN_INFO |
| 11449 | "hda_codec: Cannot set up configuration " |
| 11450 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11451 | board_config = ALC262_BASIC; |
| 11452 | } |
| 11453 | } |
| 11454 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11455 | if (!spec->no_analog) { |
| 11456 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11457 | if (err < 0) { |
| 11458 | alc_free(codec); |
| 11459 | return err; |
| 11460 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11461 | } |
| 11462 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11463 | if (board_config != ALC262_AUTO) |
| 11464 | setup_preset(spec, &alc262_presets[board_config]); |
| 11465 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11466 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11467 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11468 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11469 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11470 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11471 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11472 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11473 | int i; |
| 11474 | /* check whether the digital-mic has to be supported */ |
| 11475 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11476 | if (spec->input_mux->items[i].index >= 9) |
| 11477 | break; |
| 11478 | } |
| 11479 | if (i < spec->input_mux->num_items) { |
| 11480 | /* use only ADC0 */ |
| 11481 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11482 | spec->num_adc_nids = 1; |
| 11483 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11484 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11485 | /* all analog inputs */ |
| 11486 | /* check whether NID 0x07 is valid */ |
| 11487 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11488 | |
| 11489 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11490 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11491 | if (wcap != AC_WID_AUD_IN) { |
| 11492 | spec->adc_nids = alc262_adc_nids_alt; |
| 11493 | spec->num_adc_nids = |
| 11494 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11495 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11496 | } else { |
| 11497 | spec->adc_nids = alc262_adc_nids; |
| 11498 | spec->num_adc_nids = |
| 11499 | ARRAY_SIZE(alc262_adc_nids); |
| 11500 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11501 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11502 | } |
| 11503 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11504 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11505 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11506 | if (!spec->no_analog) |
| 11507 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11508 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11509 | spec->vmaster_nid = 0x0c; |
| 11510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11511 | codec->patch_ops = alc_patch_ops; |
| 11512 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11513 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11514 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11515 | if (!spec->loopback.amplist) |
| 11516 | spec->loopback.amplist = alc262_loopbacks; |
| 11517 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11518 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11519 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11520 | return 0; |
| 11521 | } |
| 11522 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11523 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11524 | * ALC268 channel source setting (2 channel) |
| 11525 | */ |
| 11526 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11527 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11528 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11529 | static hda_nid_t alc268_dac_nids[2] = { |
| 11530 | /* front, hp */ |
| 11531 | 0x02, 0x03 |
| 11532 | }; |
| 11533 | |
| 11534 | static hda_nid_t alc268_adc_nids[2] = { |
| 11535 | /* ADC0-1 */ |
| 11536 | 0x08, 0x07 |
| 11537 | }; |
| 11538 | |
| 11539 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11540 | /* ADC0 */ |
| 11541 | 0x08 |
| 11542 | }; |
| 11543 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11544 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11545 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11546 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11547 | /* output mixer control */ |
| 11548 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11549 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11550 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11551 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11552 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11553 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11554 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11555 | { } |
| 11556 | }; |
| 11557 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11558 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11559 | /* output mixer control */ |
| 11560 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11561 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11562 | ALC262_HIPPO_MASTER_SWITCH, |
| 11563 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11564 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11565 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11566 | { } |
| 11567 | }; |
| 11568 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11569 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11570 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11571 | .ops = &snd_hda_bind_sw, |
| 11572 | .values = { |
| 11573 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11574 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11575 | 0 |
| 11576 | }, |
| 11577 | }; |
| 11578 | |
| 11579 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11580 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11581 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11582 | { } |
| 11583 | }; |
| 11584 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11585 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11586 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11587 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11588 | { } |
| 11589 | }; |
| 11590 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11591 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11592 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11593 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11594 | { } /* end */ |
| 11595 | }; |
| 11596 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11597 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11598 | .num_items = 2, |
| 11599 | .items = { |
| 11600 | { "i-Mic", 0x6 }, |
| 11601 | { "E-Mic", 0x0 }, |
| 11602 | }, |
| 11603 | }; |
| 11604 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11605 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11606 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11607 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11608 | .ops = &snd_hda_bind_vol, |
| 11609 | .values = { |
| 11610 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11611 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11612 | 0 |
| 11613 | }, |
| 11614 | }; |
| 11615 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11616 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11617 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11618 | { |
| 11619 | struct alc_spec *spec = codec->spec; |
| 11620 | unsigned int mute; |
| 11621 | |
| 11622 | if (force || !spec->sense_updated) { |
| 11623 | unsigned int present; |
| 11624 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11625 | AC_VERB_GET_PIN_SENSE, 0); |
| 11626 | spec->jack_present = (present & 0x80000000) != 0; |
| 11627 | spec->sense_updated = 1; |
| 11628 | } |
| 11629 | if (spec->jack_present) |
| 11630 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11631 | else /* unmute internal speaker if necessary */ |
| 11632 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11633 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11634 | HDA_AMP_MUTE, mute); |
| 11635 | } |
| 11636 | |
| 11637 | |
| 11638 | /* bind hp and internal speaker mute (with plug check) */ |
| 11639 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11640 | struct snd_ctl_elem_value *ucontrol) |
| 11641 | { |
| 11642 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11643 | long *valp = ucontrol->value.integer.value; |
| 11644 | int change; |
| 11645 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11646 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11647 | if (change) |
| 11648 | alc268_acer_automute(codec, 0); |
| 11649 | return change; |
| 11650 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11651 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11652 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11653 | /* output mixer control */ |
| 11654 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11655 | { |
| 11656 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11657 | .name = "Master Playback Switch", |
| 11658 | .info = snd_hda_mixer_amp_switch_info, |
| 11659 | .get = snd_hda_mixer_amp_switch_get, |
| 11660 | .put = alc268_acer_master_sw_put, |
| 11661 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11662 | }, |
| 11663 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11664 | { } |
| 11665 | }; |
| 11666 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11667 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11668 | /* output mixer control */ |
| 11669 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11670 | { |
| 11671 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11672 | .name = "Master Playback Switch", |
| 11673 | .info = snd_hda_mixer_amp_switch_info, |
| 11674 | .get = snd_hda_mixer_amp_switch_get, |
| 11675 | .put = alc268_acer_master_sw_put, |
| 11676 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11677 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11678 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11679 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11680 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11681 | { } |
| 11682 | }; |
| 11683 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11684 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11685 | /* output mixer control */ |
| 11686 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11687 | { |
| 11688 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11689 | .name = "Master Playback Switch", |
| 11690 | .info = snd_hda_mixer_amp_switch_info, |
| 11691 | .get = snd_hda_mixer_amp_switch_get, |
| 11692 | .put = alc268_acer_master_sw_put, |
| 11693 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11694 | }, |
| 11695 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11696 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11697 | { } |
| 11698 | }; |
| 11699 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11700 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11701 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11702 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11703 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11704 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11705 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11707 | { } |
| 11708 | }; |
| 11709 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11710 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11711 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11712 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11713 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11714 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11715 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11716 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11717 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11718 | { } |
| 11719 | }; |
| 11720 | |
| 11721 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11722 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11723 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11724 | |
| 11725 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11726 | unsigned int res) |
| 11727 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11728 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11729 | return; |
| 11730 | alc268_acer_automute(codec, 1); |
| 11731 | } |
| 11732 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11733 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11734 | { |
| 11735 | alc268_acer_automute(codec, 1); |
| 11736 | } |
| 11737 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11738 | /* toggle speaker-output according to the hp-jack state */ |
| 11739 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11740 | { |
| 11741 | unsigned int present; |
| 11742 | unsigned char bits; |
| 11743 | |
| 11744 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11745 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11746 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11747 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11748 | AMP_IN_MUTE(0), bits); |
| 11749 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11750 | AMP_IN_MUTE(0), bits); |
| 11751 | } |
| 11752 | |
| 11753 | |
| 11754 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11755 | { |
| 11756 | unsigned int present; |
| 11757 | |
| 11758 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11759 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11760 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11761 | present ? 0x0 : 0x6); |
| 11762 | } |
| 11763 | |
| 11764 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11765 | unsigned int res) |
| 11766 | { |
| 11767 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11768 | alc268_aspire_one_speaker_automute(codec); |
| 11769 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11770 | alc268_acer_mic_automute(codec); |
| 11771 | } |
| 11772 | |
| 11773 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11774 | { |
| 11775 | alc268_aspire_one_speaker_automute(codec); |
| 11776 | alc268_acer_mic_automute(codec); |
| 11777 | } |
| 11778 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11779 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11780 | /* output mixer control */ |
| 11781 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11782 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11783 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11784 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11785 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11786 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11787 | { } |
| 11788 | }; |
| 11789 | |
| 11790 | static struct hda_verb alc268_dell_verbs[] = { |
| 11791 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11792 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11793 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11794 | { } |
| 11795 | }; |
| 11796 | |
| 11797 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11798 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11799 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11800 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11801 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11802 | spec->autocfg.hp_pins[0] = 0x15; |
| 11803 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11804 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11805 | } |
| 11806 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11807 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11808 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11809 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11810 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11811 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11812 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11813 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11814 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11815 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11816 | { } |
| 11817 | }; |
| 11818 | |
| 11819 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11820 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11821 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11822 | { } |
| 11823 | }; |
| 11824 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11825 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11826 | { |
| 11827 | unsigned int present; |
| 11828 | |
| 11829 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11830 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11831 | snd_hda_codec_write(codec, 0x23, 0, |
| 11832 | AC_VERB_SET_CONNECT_SEL, |
| 11833 | present ? 0x00 : 0x01); |
| 11834 | } |
| 11835 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11836 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11837 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11838 | struct alc_spec *spec = codec->spec; |
| 11839 | |
| 11840 | spec->autocfg.hp_pins[0] = 0x15; |
| 11841 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11842 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11843 | alc267_quanta_il1_mic_automute(codec); |
| 11844 | } |
| 11845 | |
| 11846 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11847 | unsigned int res) |
| 11848 | { |
| 11849 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11850 | case ALC880_MIC_EVENT: |
| 11851 | alc267_quanta_il1_mic_automute(codec); |
| 11852 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11853 | default: |
| 11854 | alc_sku_unsol_event(codec, res); |
| 11855 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11856 | } |
| 11857 | } |
| 11858 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11859 | /* |
| 11860 | * generic initialization of ADC, input mixers and output mixers |
| 11861 | */ |
| 11862 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11863 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11864 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11865 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11866 | |
| 11867 | /* |
| 11868 | * Set up output mixers (0x0c - 0x0e) |
| 11869 | */ |
| 11870 | /* set vol=0 to output mixers */ |
| 11871 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11872 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11873 | |
| 11874 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11875 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11876 | |
| 11877 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11878 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11879 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11880 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11881 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11882 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11883 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11884 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11885 | |
| 11886 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11887 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11888 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11889 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11890 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11891 | |
| 11892 | /* set PCBEEP vol = 0, mute connections */ |
| 11893 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11894 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11895 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11896 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11897 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11898 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11899 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11900 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11901 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11902 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11903 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11904 | { } |
| 11905 | }; |
| 11906 | |
| 11907 | /* |
| 11908 | * generic initialization of ADC, input mixers and output mixers |
| 11909 | */ |
| 11910 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11911 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11912 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11913 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11914 | |
| 11915 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11916 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11917 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11918 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11919 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11920 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11923 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11924 | |
| 11925 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11926 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11927 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11928 | /* set PCBEEP vol = 0, mute connections */ |
| 11929 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11930 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11931 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11932 | |
| 11933 | { } |
| 11934 | }; |
| 11935 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11936 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11937 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11938 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11939 | { |
| 11940 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11941 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11942 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11943 | */ |
| 11944 | /* .name = "Capture Source", */ |
| 11945 | .name = "Input Source", |
| 11946 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11947 | .info = alc_mux_enum_info, |
| 11948 | .get = alc_mux_enum_get, |
| 11949 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11950 | }, |
| 11951 | { } /* end */ |
| 11952 | }; |
| 11953 | |
| 11954 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11955 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11956 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11957 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11958 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11959 | { |
| 11960 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11961 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11962 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11963 | */ |
| 11964 | /* .name = "Capture Source", */ |
| 11965 | .name = "Input Source", |
| 11966 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11967 | .info = alc_mux_enum_info, |
| 11968 | .get = alc_mux_enum_get, |
| 11969 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11970 | }, |
| 11971 | { } /* end */ |
| 11972 | }; |
| 11973 | |
| 11974 | static struct hda_input_mux alc268_capture_source = { |
| 11975 | .num_items = 4, |
| 11976 | .items = { |
| 11977 | { "Mic", 0x0 }, |
| 11978 | { "Front Mic", 0x1 }, |
| 11979 | { "Line", 0x2 }, |
| 11980 | { "CD", 0x3 }, |
| 11981 | }, |
| 11982 | }; |
| 11983 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11984 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11985 | .num_items = 3, |
| 11986 | .items = { |
| 11987 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11988 | { "Internal Mic", 0x1 }, |
| 11989 | { "Line", 0x2 }, |
| 11990 | }, |
| 11991 | }; |
| 11992 | |
| 11993 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11994 | .num_items = 3, |
| 11995 | .items = { |
| 11996 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11997 | { "Internal Mic", 0x6 }, |
| 11998 | { "Line", 0x2 }, |
| 11999 | }, |
| 12000 | }; |
| 12001 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12002 | #ifdef CONFIG_SND_DEBUG |
| 12003 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12004 | /* Volume widgets */ |
| 12005 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12006 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12007 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12008 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12009 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12010 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12011 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12012 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12013 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12014 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12015 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12016 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12017 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12018 | /* The below appears problematic on some hardwares */ |
| 12019 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12020 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12021 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12022 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12023 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12024 | |
| 12025 | /* Modes for retasking pin widgets */ |
| 12026 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12027 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12028 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12029 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12030 | |
| 12031 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12032 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12033 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12034 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12035 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12036 | |
| 12037 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12038 | * The ALC268 does not have an SPDIF input. |
| 12039 | */ |
| 12040 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12041 | |
| 12042 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12043 | * this output to turn on an external amplifier. |
| 12044 | */ |
| 12045 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12046 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12047 | |
| 12048 | { } /* end */ |
| 12049 | }; |
| 12050 | #endif |
| 12051 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12052 | /* create input playback/capture controls for the given pin */ |
| 12053 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12054 | const char *ctlname, int idx) |
| 12055 | { |
| 12056 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12057 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12058 | int err; |
| 12059 | |
| 12060 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12061 | switch (nid) { |
| 12062 | case 0x14: |
| 12063 | case 0x16: |
| 12064 | dac = 0x02; |
| 12065 | break; |
| 12066 | case 0x15: |
| 12067 | dac = 0x03; |
| 12068 | break; |
| 12069 | default: |
| 12070 | return 0; |
| 12071 | } |
| 12072 | if (spec->multiout.dac_nids[0] != dac && |
| 12073 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12074 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12075 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12076 | HDA_OUTPUT)); |
| 12077 | if (err < 0) |
| 12078 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12079 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12080 | } |
| 12081 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12082 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12083 | if (nid != 0x16) |
| 12084 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12085 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12086 | else /* mono */ |
| 12087 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12088 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12089 | if (err < 0) |
| 12090 | return err; |
| 12091 | return 0; |
| 12092 | } |
| 12093 | |
| 12094 | /* add playback controls from the parsed DAC table */ |
| 12095 | static int alc268_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 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12101 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12102 | |
| 12103 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12104 | if (nid) { |
| 12105 | const char *name; |
| 12106 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12107 | name = "Speaker"; |
| 12108 | else |
| 12109 | name = "Front"; |
| 12110 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12111 | if (err < 0) |
| 12112 | return err; |
| 12113 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12114 | |
| 12115 | nid = cfg->speaker_pins[0]; |
| 12116 | if (nid == 0x1d) { |
| 12117 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12118 | "Speaker Playback Volume", |
| 12119 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12120 | if (err < 0) |
| 12121 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12122 | } else { |
| 12123 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12124 | if (err < 0) |
| 12125 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12126 | } |
| 12127 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12128 | if (nid) { |
| 12129 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12130 | if (err < 0) |
| 12131 | return err; |
| 12132 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12133 | |
| 12134 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12135 | if (nid == 0x16) { |
| 12136 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12137 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12138 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12139 | if (err < 0) |
| 12140 | return err; |
| 12141 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12142 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12143 | } |
| 12144 | |
| 12145 | /* create playback/capture controls for input pins */ |
| 12146 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12147 | const struct auto_pin_cfg *cfg) |
| 12148 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12149 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12150 | int i, idx1; |
| 12151 | |
| 12152 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12153 | switch(cfg->input_pins[i]) { |
| 12154 | case 0x18: |
| 12155 | idx1 = 0; /* Mic 1 */ |
| 12156 | break; |
| 12157 | case 0x19: |
| 12158 | idx1 = 1; /* Mic 2 */ |
| 12159 | break; |
| 12160 | case 0x1a: |
| 12161 | idx1 = 2; /* Line In */ |
| 12162 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12163 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12164 | idx1 = 3; /* CD */ |
| 12165 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12166 | case 0x12: |
| 12167 | case 0x13: |
| 12168 | idx1 = 6; /* digital mics */ |
| 12169 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12170 | default: |
| 12171 | continue; |
| 12172 | } |
| 12173 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12174 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12175 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12176 | } |
| 12177 | return 0; |
| 12178 | } |
| 12179 | |
| 12180 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12181 | { |
| 12182 | struct alc_spec *spec = codec->spec; |
| 12183 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12184 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12185 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12186 | unsigned int dac_vol1, dac_vol2; |
| 12187 | |
| 12188 | if (speaker_nid) { |
| 12189 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12190 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12191 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12192 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12193 | AMP_IN_UNMUTE(1)); |
| 12194 | snd_hda_codec_write(codec, 0x10, 0, |
| 12195 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12196 | AMP_IN_UNMUTE(1)); |
| 12197 | } else { |
| 12198 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12199 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12200 | snd_hda_codec_write(codec, 0x10, 0, |
| 12201 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12202 | } |
| 12203 | |
| 12204 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12205 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12206 | dac_vol2 = AMP_OUT_ZERO; |
| 12207 | else if (line_nid == 0x15) |
| 12208 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12209 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12210 | dac_vol2 = AMP_OUT_ZERO; |
| 12211 | else if (hp_nid == 0x15) |
| 12212 | dac_vol1 = AMP_OUT_ZERO; |
| 12213 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12214 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12215 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12216 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12217 | |
| 12218 | snd_hda_codec_write(codec, 0x02, 0, |
| 12219 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12220 | snd_hda_codec_write(codec, 0x03, 0, |
| 12221 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12222 | } |
| 12223 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12224 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12225 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12226 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12227 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12228 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12229 | |
| 12230 | /* |
| 12231 | * BIOS auto configuration |
| 12232 | */ |
| 12233 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12234 | { |
| 12235 | struct alc_spec *spec = codec->spec; |
| 12236 | int err; |
| 12237 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12238 | |
| 12239 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12240 | alc268_ignore); |
| 12241 | if (err < 0) |
| 12242 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12243 | if (!spec->autocfg.line_outs) { |
| 12244 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12245 | spec->multiout.max_channels = 2; |
| 12246 | spec->no_analog = 1; |
| 12247 | goto dig_only; |
| 12248 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12249 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12250 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12251 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12252 | if (err < 0) |
| 12253 | return err; |
| 12254 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12255 | if (err < 0) |
| 12256 | return err; |
| 12257 | |
| 12258 | spec->multiout.max_channels = 2; |
| 12259 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12260 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12261 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12262 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12263 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12264 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12265 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12266 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12267 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12268 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12269 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12270 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12271 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12272 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12273 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12274 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12275 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12276 | err = alc_auto_add_mic_boost(codec); |
| 12277 | if (err < 0) |
| 12278 | return err; |
| 12279 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12280 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12281 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12282 | return 1; |
| 12283 | } |
| 12284 | |
| 12285 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12286 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12287 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12288 | |
| 12289 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12290 | static void alc268_auto_init(struct hda_codec *codec) |
| 12291 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12292 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12293 | alc268_auto_init_multi_out(codec); |
| 12294 | alc268_auto_init_hp_out(codec); |
| 12295 | alc268_auto_init_mono_speaker_out(codec); |
| 12296 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12297 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12298 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12299 | } |
| 12300 | |
| 12301 | /* |
| 12302 | * configuration and preset |
| 12303 | */ |
| 12304 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12305 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12306 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12307 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12308 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12309 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12310 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12311 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12312 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12313 | #ifdef CONFIG_SND_DEBUG |
| 12314 | [ALC268_TEST] = "test", |
| 12315 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12316 | [ALC268_AUTO] = "auto", |
| 12317 | }; |
| 12318 | |
| 12319 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12320 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12321 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12322 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12323 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12324 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12325 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12326 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12327 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12328 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12329 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12330 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12331 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12332 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12333 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12334 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12335 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12336 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12337 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12338 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12339 | {} |
| 12340 | }; |
| 12341 | |
| 12342 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12343 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12344 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12345 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12346 | alc267_quanta_il1_verbs }, |
| 12347 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12348 | .dac_nids = alc268_dac_nids, |
| 12349 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12350 | .adc_nids = alc268_adc_nids_alt, |
| 12351 | .hp_nid = 0x03, |
| 12352 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12353 | .channel_mode = alc268_modes, |
| 12354 | .input_mux = &alc268_capture_source, |
| 12355 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12356 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12357 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12358 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12359 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12360 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12361 | .init_verbs = { alc268_base_init_verbs }, |
| 12362 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12363 | .dac_nids = alc268_dac_nids, |
| 12364 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12365 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12366 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12367 | .hp_nid = 0x03, |
| 12368 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12369 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12370 | .channel_mode = alc268_modes, |
| 12371 | .input_mux = &alc268_capture_source, |
| 12372 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12373 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12374 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12375 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12376 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12377 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12378 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12379 | .dac_nids = alc268_dac_nids, |
| 12380 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12381 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12382 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12383 | .hp_nid = 0x03, |
| 12384 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12385 | .channel_mode = alc268_modes, |
| 12386 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12387 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12388 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12389 | }, |
| 12390 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12391 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12392 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12393 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12394 | alc268_acer_verbs }, |
| 12395 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12396 | .dac_nids = alc268_dac_nids, |
| 12397 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12398 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12399 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12400 | .hp_nid = 0x02, |
| 12401 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12402 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12403 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12404 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12405 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12406 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12407 | [ALC268_ACER_DMIC] = { |
| 12408 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12409 | alc268_beep_mixer }, |
| 12410 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12411 | alc268_acer_verbs }, |
| 12412 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12413 | .dac_nids = alc268_dac_nids, |
| 12414 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12415 | .adc_nids = alc268_adc_nids_alt, |
| 12416 | .capsrc_nids = alc268_capsrc_nids, |
| 12417 | .hp_nid = 0x02, |
| 12418 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12419 | .channel_mode = alc268_modes, |
| 12420 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12421 | .unsol_event = alc268_acer_unsol_event, |
| 12422 | .init_hook = alc268_acer_init_hook, |
| 12423 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12424 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12425 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12426 | alc268_beep_mixer, |
| 12427 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12428 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12429 | alc268_acer_aspire_one_verbs }, |
| 12430 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12431 | .dac_nids = alc268_dac_nids, |
| 12432 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12433 | .adc_nids = alc268_adc_nids_alt, |
| 12434 | .capsrc_nids = alc268_capsrc_nids, |
| 12435 | .hp_nid = 0x03, |
| 12436 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12437 | .channel_mode = alc268_modes, |
| 12438 | .input_mux = &alc268_acer_lc_capture_source, |
| 12439 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12440 | .init_hook = alc268_acer_lc_init_hook, |
| 12441 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12442 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12443 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12444 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12445 | alc268_dell_verbs }, |
| 12446 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12447 | .dac_nids = alc268_dac_nids, |
| 12448 | .hp_nid = 0x02, |
| 12449 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12450 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12451 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12452 | .init_hook = alc268_dell_init_hook, |
| 12453 | .input_mux = &alc268_capture_source, |
| 12454 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12455 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12456 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12457 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12458 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12459 | alc268_toshiba_verbs }, |
| 12460 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12461 | .dac_nids = alc268_dac_nids, |
| 12462 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12463 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12464 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12465 | .hp_nid = 0x03, |
| 12466 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12467 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12468 | .channel_mode = alc268_modes, |
| 12469 | .input_mux = &alc268_capture_source, |
| 12470 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12471 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12472 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12473 | #ifdef CONFIG_SND_DEBUG |
| 12474 | [ALC268_TEST] = { |
| 12475 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12476 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12477 | alc268_volume_init_verbs }, |
| 12478 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12479 | .dac_nids = alc268_dac_nids, |
| 12480 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12481 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12482 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12483 | .hp_nid = 0x03, |
| 12484 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12485 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12486 | .channel_mode = alc268_modes, |
| 12487 | .input_mux = &alc268_capture_source, |
| 12488 | }, |
| 12489 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12490 | }; |
| 12491 | |
| 12492 | static int patch_alc268(struct hda_codec *codec) |
| 12493 | { |
| 12494 | struct alc_spec *spec; |
| 12495 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12496 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12497 | |
| 12498 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12499 | if (spec == NULL) |
| 12500 | return -ENOMEM; |
| 12501 | |
| 12502 | codec->spec = spec; |
| 12503 | |
| 12504 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12505 | alc268_models, |
| 12506 | alc268_cfg_tbl); |
| 12507 | |
| 12508 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12509 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12510 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12511 | board_config = ALC268_AUTO; |
| 12512 | } |
| 12513 | |
| 12514 | if (board_config == ALC268_AUTO) { |
| 12515 | /* automatic parse from the BIOS config */ |
| 12516 | err = alc268_parse_auto_config(codec); |
| 12517 | if (err < 0) { |
| 12518 | alc_free(codec); |
| 12519 | return err; |
| 12520 | } else if (!err) { |
| 12521 | printk(KERN_INFO |
| 12522 | "hda_codec: Cannot set up configuration " |
| 12523 | "from BIOS. Using base mode...\n"); |
| 12524 | board_config = ALC268_3ST; |
| 12525 | } |
| 12526 | } |
| 12527 | |
| 12528 | if (board_config != ALC268_AUTO) |
| 12529 | setup_preset(spec, &alc268_presets[board_config]); |
| 12530 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12531 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12532 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12533 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12534 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12535 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12536 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12537 | has_beep = 0; |
| 12538 | for (i = 0; i < spec->num_mixers; i++) { |
| 12539 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12540 | has_beep = 1; |
| 12541 | break; |
| 12542 | } |
| 12543 | } |
| 12544 | |
| 12545 | if (has_beep) { |
| 12546 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12547 | if (err < 0) { |
| 12548 | alc_free(codec); |
| 12549 | return err; |
| 12550 | } |
| 12551 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12552 | /* override the amp caps for beep generator */ |
| 12553 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12554 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12555 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12556 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12557 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12558 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12559 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12560 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12561 | /* check whether NID 0x07 is valid */ |
| 12562 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12563 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12564 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12565 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12566 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12567 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12568 | spec->adc_nids = alc268_adc_nids_alt; |
| 12569 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12570 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12571 | } else { |
| 12572 | spec->adc_nids = alc268_adc_nids; |
| 12573 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12574 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12575 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12576 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12577 | /* set default input source */ |
| 12578 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12579 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12580 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12581 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12582 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12583 | |
| 12584 | spec->vmaster_nid = 0x02; |
| 12585 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12586 | codec->patch_ops = alc_patch_ops; |
| 12587 | if (board_config == ALC268_AUTO) |
| 12588 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12589 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12590 | codec->proc_widget_hook = print_realtek_coef; |
| 12591 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12592 | return 0; |
| 12593 | } |
| 12594 | |
| 12595 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12596 | * ALC269 channel source setting (2 channel) |
| 12597 | */ |
| 12598 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12599 | |
| 12600 | #define alc269_dac_nids alc260_dac_nids |
| 12601 | |
| 12602 | static hda_nid_t alc269_adc_nids[1] = { |
| 12603 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12604 | 0x08, |
| 12605 | }; |
| 12606 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12607 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12608 | 0x23, |
| 12609 | }; |
| 12610 | |
| 12611 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12612 | * not a mux! |
| 12613 | */ |
| 12614 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12615 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12616 | .num_items = 2, |
| 12617 | .items = { |
| 12618 | { "i-Mic", 0x5 }, |
| 12619 | { "e-Mic", 0x0 }, |
| 12620 | }, |
| 12621 | }; |
| 12622 | |
| 12623 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12624 | .num_items = 2, |
| 12625 | .items = { |
| 12626 | { "i-Mic", 0x1 }, |
| 12627 | { "e-Mic", 0x0 }, |
| 12628 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12629 | }; |
| 12630 | |
| 12631 | #define alc269_modes alc260_modes |
| 12632 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12633 | |
| 12634 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12635 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12636 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12637 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12638 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12639 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12640 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12641 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12644 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12645 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12646 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12647 | { } /* end */ |
| 12648 | }; |
| 12649 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12650 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12651 | /* output mixer control */ |
| 12652 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12653 | { |
| 12654 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12655 | .name = "Master Playback Switch", |
| 12656 | .info = snd_hda_mixer_amp_switch_info, |
| 12657 | .get = snd_hda_mixer_amp_switch_get, |
| 12658 | .put = alc268_acer_master_sw_put, |
| 12659 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12660 | }, |
| 12661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12662 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12663 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12664 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12665 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12666 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12667 | { } |
| 12668 | }; |
| 12669 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12670 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12671 | /* output mixer control */ |
| 12672 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12673 | { |
| 12674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12675 | .name = "Master Playback Switch", |
| 12676 | .info = snd_hda_mixer_amp_switch_info, |
| 12677 | .get = snd_hda_mixer_amp_switch_get, |
| 12678 | .put = alc268_acer_master_sw_put, |
| 12679 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12680 | }, |
| 12681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12683 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12684 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12685 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12686 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12687 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12688 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12689 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12690 | { } |
| 12691 | }; |
| 12692 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12693 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12694 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12695 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12696 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12697 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12698 | { } /* end */ |
| 12699 | }; |
| 12700 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12701 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12702 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12703 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12704 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12705 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12706 | { } /* end */ |
| 12707 | }; |
| 12708 | |
| 12709 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12710 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12711 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12712 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12713 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12714 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12715 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12716 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12717 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12718 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12719 | { } |
| 12720 | }; |
| 12721 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12722 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12723 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12724 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12725 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12726 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12727 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12728 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12729 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12730 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12731 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12732 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12733 | { } |
| 12734 | }; |
| 12735 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12736 | /* toggle speaker-output according to the hp-jack state */ |
| 12737 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12738 | { |
| 12739 | unsigned int present; |
| 12740 | unsigned char bits; |
| 12741 | |
| 12742 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12743 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12744 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12745 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12746 | AMP_IN_MUTE(0), bits); |
| 12747 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12748 | AMP_IN_MUTE(0), bits); |
| 12749 | |
| 12750 | snd_hda_codec_write(codec, 0x20, 0, |
| 12751 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12752 | snd_hda_codec_write(codec, 0x20, 0, |
| 12753 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12754 | |
| 12755 | snd_hda_codec_write(codec, 0x20, 0, |
| 12756 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12757 | snd_hda_codec_write(codec, 0x20, 0, |
| 12758 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12759 | } |
| 12760 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12761 | /* toggle speaker-output according to the hp-jacks state */ |
| 12762 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12763 | { |
| 12764 | unsigned int present; |
| 12765 | unsigned char bits; |
| 12766 | |
| 12767 | /* Check laptop headphone socket */ |
| 12768 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12769 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12770 | |
| 12771 | /* Check port replicator headphone socket */ |
| 12772 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12773 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12774 | |
| 12775 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12776 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12777 | AMP_IN_MUTE(0), bits); |
| 12778 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12779 | AMP_IN_MUTE(0), bits); |
| 12780 | |
| 12781 | snd_hda_codec_write(codec, 0x20, 0, |
| 12782 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12783 | snd_hda_codec_write(codec, 0x20, 0, |
| 12784 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12785 | |
| 12786 | snd_hda_codec_write(codec, 0x20, 0, |
| 12787 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12788 | snd_hda_codec_write(codec, 0x20, 0, |
| 12789 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12790 | } |
| 12791 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12792 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12793 | { |
| 12794 | unsigned int present; |
| 12795 | |
| 12796 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12797 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12798 | snd_hda_codec_write(codec, 0x23, 0, |
| 12799 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12800 | } |
| 12801 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12802 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12803 | { |
| 12804 | unsigned int present_laptop; |
| 12805 | unsigned int present_dock; |
| 12806 | |
| 12807 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12808 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12809 | |
| 12810 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12811 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12812 | |
| 12813 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12814 | if (present_dock) |
| 12815 | snd_hda_codec_write(codec, 0x23, 0, |
| 12816 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12817 | if (present_laptop) |
| 12818 | snd_hda_codec_write(codec, 0x23, 0, |
| 12819 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12820 | if (!present_dock && !present_laptop) |
| 12821 | snd_hda_codec_write(codec, 0x23, 0, |
| 12822 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12823 | } |
| 12824 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12825 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12826 | unsigned int res) |
| 12827 | { |
| 12828 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12829 | alc269_quanta_fl1_speaker_automute(codec); |
| 12830 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12831 | alc269_quanta_fl1_mic_automute(codec); |
| 12832 | } |
| 12833 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12834 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12835 | unsigned int res) |
| 12836 | { |
| 12837 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12838 | alc269_lifebook_speaker_automute(codec); |
| 12839 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12840 | alc269_lifebook_mic_autoswitch(codec); |
| 12841 | } |
| 12842 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12843 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12844 | { |
| 12845 | alc269_quanta_fl1_speaker_automute(codec); |
| 12846 | alc269_quanta_fl1_mic_automute(codec); |
| 12847 | } |
| 12848 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12849 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12850 | { |
| 12851 | alc269_lifebook_speaker_automute(codec); |
| 12852 | alc269_lifebook_mic_autoswitch(codec); |
| 12853 | } |
| 12854 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12855 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12856 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12857 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12858 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12859 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12860 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12861 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12862 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12863 | {} |
| 12864 | }; |
| 12865 | |
| 12866 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12867 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12868 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12869 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12870 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12871 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12872 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12873 | {} |
| 12874 | }; |
| 12875 | |
| 12876 | /* toggle speaker-output according to the hp-jack state */ |
| 12877 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12878 | { |
| 12879 | unsigned int present; |
| 12880 | unsigned char bits; |
| 12881 | |
| 12882 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12883 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12884 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12885 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12886 | AMP_IN_MUTE(0), bits); |
| 12887 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12888 | AMP_IN_MUTE(0), bits); |
| 12889 | } |
| 12890 | |
| 12891 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12892 | { |
| 12893 | unsigned int present; |
| 12894 | |
| 12895 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12896 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12897 | snd_hda_codec_write(codec, 0x23, 0, |
| 12898 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12899 | } |
| 12900 | |
| 12901 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12902 | { |
| 12903 | unsigned int present; |
| 12904 | |
| 12905 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12906 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12907 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12908 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12909 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12910 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12911 | } |
| 12912 | |
| 12913 | /* unsolicited event for HP jack sensing */ |
| 12914 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12915 | unsigned int res) |
| 12916 | { |
| 12917 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12918 | alc269_speaker_automute(codec); |
| 12919 | |
| 12920 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12921 | alc269_eeepc_dmic_automute(codec); |
| 12922 | } |
| 12923 | |
| 12924 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12925 | { |
| 12926 | alc269_speaker_automute(codec); |
| 12927 | alc269_eeepc_dmic_automute(codec); |
| 12928 | } |
| 12929 | |
| 12930 | /* unsolicited event for HP jack sensing */ |
| 12931 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12932 | unsigned int res) |
| 12933 | { |
| 12934 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12935 | alc269_speaker_automute(codec); |
| 12936 | |
| 12937 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12938 | alc269_eeepc_amic_automute(codec); |
| 12939 | } |
| 12940 | |
| 12941 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12942 | { |
| 12943 | alc269_speaker_automute(codec); |
| 12944 | alc269_eeepc_amic_automute(codec); |
| 12945 | } |
| 12946 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12947 | /* |
| 12948 | * generic initialization of ADC, input mixers and output mixers |
| 12949 | */ |
| 12950 | static struct hda_verb alc269_init_verbs[] = { |
| 12951 | /* |
| 12952 | * Unmute ADC0 and set the default input to mic-in |
| 12953 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12954 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12955 | |
| 12956 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12957 | * analog-loopback mixer widget |
| 12958 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12959 | * front panel mic (mic 2) |
| 12960 | */ |
| 12961 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12962 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12963 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12964 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12965 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12966 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12967 | |
| 12968 | /* |
| 12969 | * Set up output mixers (0x0c - 0x0e) |
| 12970 | */ |
| 12971 | /* set vol=0 to output mixers */ |
| 12972 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12973 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12974 | |
| 12975 | /* set up input amps for analog loopback */ |
| 12976 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12977 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12978 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12979 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12980 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12981 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12982 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12983 | |
| 12984 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12985 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12986 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12987 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12988 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12989 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12990 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12991 | |
| 12992 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12993 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12994 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12995 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12996 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12997 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12998 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12999 | |
| 13000 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13001 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13002 | |
| 13003 | /* FIXME: use matrix-type input source selection */ |
| 13004 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13005 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13008 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13009 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13010 | |
| 13011 | /* set EAPD */ |
| 13012 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13013 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13014 | { } |
| 13015 | }; |
| 13016 | |
| 13017 | /* add playback controls from the parsed DAC table */ |
| 13018 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13019 | const struct auto_pin_cfg *cfg) |
| 13020 | { |
| 13021 | hda_nid_t nid; |
| 13022 | int err; |
| 13023 | |
| 13024 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 13025 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13026 | spec->multiout.dac_nids[0] = 2; |
| 13027 | |
| 13028 | nid = cfg->line_out_pins[0]; |
| 13029 | if (nid) { |
| 13030 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13031 | "Front Playback Volume", |
| 13032 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13033 | if (err < 0) |
| 13034 | return err; |
| 13035 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13036 | "Front Playback Switch", |
| 13037 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13038 | if (err < 0) |
| 13039 | return err; |
| 13040 | } |
| 13041 | |
| 13042 | nid = cfg->speaker_pins[0]; |
| 13043 | if (nid) { |
| 13044 | if (!cfg->line_out_pins[0]) { |
| 13045 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13046 | "Speaker Playback Volume", |
| 13047 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13048 | HDA_OUTPUT)); |
| 13049 | if (err < 0) |
| 13050 | return err; |
| 13051 | } |
| 13052 | if (nid == 0x16) { |
| 13053 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13054 | "Speaker Playback Switch", |
| 13055 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13056 | HDA_OUTPUT)); |
| 13057 | if (err < 0) |
| 13058 | return err; |
| 13059 | } else { |
| 13060 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13061 | "Speaker Playback Switch", |
| 13062 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13063 | HDA_OUTPUT)); |
| 13064 | if (err < 0) |
| 13065 | return err; |
| 13066 | } |
| 13067 | } |
| 13068 | nid = cfg->hp_pins[0]; |
| 13069 | if (nid) { |
| 13070 | /* spec->multiout.hp_nid = 2; */ |
| 13071 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13072 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13073 | "Headphone Playback Volume", |
| 13074 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13075 | HDA_OUTPUT)); |
| 13076 | if (err < 0) |
| 13077 | return err; |
| 13078 | } |
| 13079 | if (nid == 0x16) { |
| 13080 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13081 | "Headphone Playback Switch", |
| 13082 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13083 | HDA_OUTPUT)); |
| 13084 | if (err < 0) |
| 13085 | return err; |
| 13086 | } else { |
| 13087 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13088 | "Headphone Playback Switch", |
| 13089 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13090 | HDA_OUTPUT)); |
| 13091 | if (err < 0) |
| 13092 | return err; |
| 13093 | } |
| 13094 | } |
| 13095 | return 0; |
| 13096 | } |
| 13097 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13098 | #define alc269_auto_create_analog_input_ctls \ |
| 13099 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13100 | |
| 13101 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13102 | #define alc269_loopbacks alc880_loopbacks |
| 13103 | #endif |
| 13104 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13105 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13106 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13107 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13108 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13109 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13110 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13111 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13112 | .substreams = 1, |
| 13113 | .channels_min = 2, |
| 13114 | .channels_max = 8, |
| 13115 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13116 | /* NID is set in alc_build_pcms */ |
| 13117 | .ops = { |
| 13118 | .open = alc880_playback_pcm_open, |
| 13119 | .prepare = alc880_playback_pcm_prepare, |
| 13120 | .cleanup = alc880_playback_pcm_cleanup |
| 13121 | }, |
| 13122 | }; |
| 13123 | |
| 13124 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13125 | .substreams = 1, |
| 13126 | .channels_min = 2, |
| 13127 | .channels_max = 2, |
| 13128 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13129 | /* NID is set in alc_build_pcms */ |
| 13130 | }; |
| 13131 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13132 | /* |
| 13133 | * BIOS auto configuration |
| 13134 | */ |
| 13135 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13136 | { |
| 13137 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13138 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13139 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13140 | |
| 13141 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13142 | alc269_ignore); |
| 13143 | if (err < 0) |
| 13144 | return err; |
| 13145 | |
| 13146 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13147 | if (err < 0) |
| 13148 | return err; |
| 13149 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13150 | if (err < 0) |
| 13151 | return err; |
| 13152 | |
| 13153 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13154 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13155 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13156 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13157 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13158 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13159 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13160 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13161 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13162 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13163 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13164 | /* set default input source */ |
| 13165 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13166 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13167 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13168 | |
| 13169 | err = alc_auto_add_mic_boost(codec); |
| 13170 | if (err < 0) |
| 13171 | return err; |
| 13172 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13173 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13174 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13175 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13176 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13177 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13178 | return 1; |
| 13179 | } |
| 13180 | |
| 13181 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13182 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13183 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13184 | |
| 13185 | |
| 13186 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13187 | static void alc269_auto_init(struct hda_codec *codec) |
| 13188 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13189 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13190 | alc269_auto_init_multi_out(codec); |
| 13191 | alc269_auto_init_hp_out(codec); |
| 13192 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13193 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13194 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13195 | } |
| 13196 | |
| 13197 | /* |
| 13198 | * configuration and preset |
| 13199 | */ |
| 13200 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13201 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13202 | [ALC269_QUANTA_FL1] = "quanta", |
| 13203 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13204 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13205 | [ALC269_FUJITSU] = "fujitsu", |
| 13206 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13207 | }; |
| 13208 | |
| 13209 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13210 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13211 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13212 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13213 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13214 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13215 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13216 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13217 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13218 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13219 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13220 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13221 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13222 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13223 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13224 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13225 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13226 | {} |
| 13227 | }; |
| 13228 | |
| 13229 | static struct alc_config_preset alc269_presets[] = { |
| 13230 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13231 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13232 | .init_verbs = { alc269_init_verbs }, |
| 13233 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13234 | .dac_nids = alc269_dac_nids, |
| 13235 | .hp_nid = 0x03, |
| 13236 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13237 | .channel_mode = alc269_modes, |
| 13238 | .input_mux = &alc269_capture_source, |
| 13239 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13240 | [ALC269_QUANTA_FL1] = { |
| 13241 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13242 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13243 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13244 | .dac_nids = alc269_dac_nids, |
| 13245 | .hp_nid = 0x03, |
| 13246 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13247 | .channel_mode = alc269_modes, |
| 13248 | .input_mux = &alc269_capture_source, |
| 13249 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13250 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13251 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13252 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13253 | .mixers = { alc269_eeepc_mixer }, |
| 13254 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13255 | .init_verbs = { alc269_init_verbs, |
| 13256 | alc269_eeepc_amic_init_verbs }, |
| 13257 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13258 | .dac_nids = alc269_dac_nids, |
| 13259 | .hp_nid = 0x03, |
| 13260 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13261 | .channel_mode = alc269_modes, |
| 13262 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13263 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13264 | .init_hook = alc269_eeepc_amic_inithook, |
| 13265 | }, |
| 13266 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13267 | .mixers = { alc269_eeepc_mixer }, |
| 13268 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13269 | .init_verbs = { alc269_init_verbs, |
| 13270 | alc269_eeepc_dmic_init_verbs }, |
| 13271 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13272 | .dac_nids = alc269_dac_nids, |
| 13273 | .hp_nid = 0x03, |
| 13274 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13275 | .channel_mode = alc269_modes, |
| 13276 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13277 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13278 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13279 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13280 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13281 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13282 | .cap_mixer = alc269_epc_capture_mixer, |
| 13283 | .init_verbs = { alc269_init_verbs, |
| 13284 | alc269_eeepc_dmic_init_verbs }, |
| 13285 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13286 | .dac_nids = alc269_dac_nids, |
| 13287 | .hp_nid = 0x03, |
| 13288 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13289 | .channel_mode = alc269_modes, |
| 13290 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13291 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13292 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13293 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13294 | [ALC269_LIFEBOOK] = { |
| 13295 | .mixers = { alc269_lifebook_mixer }, |
| 13296 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13297 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13298 | .dac_nids = alc269_dac_nids, |
| 13299 | .hp_nid = 0x03, |
| 13300 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13301 | .channel_mode = alc269_modes, |
| 13302 | .input_mux = &alc269_capture_source, |
| 13303 | .unsol_event = alc269_lifebook_unsol_event, |
| 13304 | .init_hook = alc269_lifebook_init_hook, |
| 13305 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13306 | }; |
| 13307 | |
| 13308 | static int patch_alc269(struct hda_codec *codec) |
| 13309 | { |
| 13310 | struct alc_spec *spec; |
| 13311 | int board_config; |
| 13312 | int err; |
| 13313 | |
| 13314 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13315 | if (spec == NULL) |
| 13316 | return -ENOMEM; |
| 13317 | |
| 13318 | codec->spec = spec; |
| 13319 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13320 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13321 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13322 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13323 | alc269_models, |
| 13324 | alc269_cfg_tbl); |
| 13325 | |
| 13326 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13327 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13328 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13329 | board_config = ALC269_AUTO; |
| 13330 | } |
| 13331 | |
| 13332 | if (board_config == ALC269_AUTO) { |
| 13333 | /* automatic parse from the BIOS config */ |
| 13334 | err = alc269_parse_auto_config(codec); |
| 13335 | if (err < 0) { |
| 13336 | alc_free(codec); |
| 13337 | return err; |
| 13338 | } else if (!err) { |
| 13339 | printk(KERN_INFO |
| 13340 | "hda_codec: Cannot set up configuration " |
| 13341 | "from BIOS. Using base mode...\n"); |
| 13342 | board_config = ALC269_BASIC; |
| 13343 | } |
| 13344 | } |
| 13345 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13346 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13347 | if (err < 0) { |
| 13348 | alc_free(codec); |
| 13349 | return err; |
| 13350 | } |
| 13351 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13352 | if (board_config != ALC269_AUTO) |
| 13353 | setup_preset(spec, &alc269_presets[board_config]); |
| 13354 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13355 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13356 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13357 | * fix the sample rate of analog I/O to 44.1kHz |
| 13358 | */ |
| 13359 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13360 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13361 | } else { |
| 13362 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13363 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13364 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13365 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13366 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13367 | |
| 13368 | spec->adc_nids = alc269_adc_nids; |
| 13369 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13370 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13371 | if (!spec->cap_mixer) |
| 13372 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13373 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13374 | |
| 13375 | codec->patch_ops = alc_patch_ops; |
| 13376 | if (board_config == ALC269_AUTO) |
| 13377 | spec->init_hook = alc269_auto_init; |
| 13378 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13379 | if (!spec->loopback.amplist) |
| 13380 | spec->loopback.amplist = alc269_loopbacks; |
| 13381 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13382 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13383 | |
| 13384 | return 0; |
| 13385 | } |
| 13386 | |
| 13387 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13388 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13389 | */ |
| 13390 | |
| 13391 | /* |
| 13392 | * set the path ways for 2 channel output |
| 13393 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13394 | */ |
| 13395 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13396 | /* set pin widget 1Ah (line in) for input */ |
| 13397 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13398 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13399 | * the vref |
| 13400 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13401 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13403 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13404 | #if 0 |
| 13405 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13406 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13407 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13408 | { } /* end */ |
| 13409 | }; |
| 13410 | /* |
| 13411 | * 6ch mode |
| 13412 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13413 | */ |
| 13414 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13415 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13416 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13417 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13418 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13419 | |
| 13420 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13421 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13422 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13423 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13424 | #if 0 |
| 13425 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13426 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13427 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13428 | { } /* end */ |
| 13429 | }; |
| 13430 | |
| 13431 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13432 | { 2, alc861_threestack_ch2_init }, |
| 13433 | { 6, alc861_threestack_ch6_init }, |
| 13434 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13435 | /* Set mic1 as input and unmute the mixer */ |
| 13436 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13437 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13438 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13439 | { } /* end */ |
| 13440 | }; |
| 13441 | /* Set mic1 as output and mute mixer */ |
| 13442 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13443 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13444 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13445 | { } /* end */ |
| 13446 | }; |
| 13447 | |
| 13448 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13449 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13450 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13451 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13452 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13453 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13454 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13455 | /* set pin widget 1Ah (line in) for input */ |
| 13456 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13457 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13458 | * the vref |
| 13459 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13460 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13461 | |
| 13462 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13463 | #if 0 |
| 13464 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13465 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13466 | #endif |
| 13467 | { } /* end */ |
| 13468 | }; |
| 13469 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13470 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13471 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13472 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13473 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13474 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13475 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13476 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13477 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13478 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13479 | |
| 13480 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13481 | #if 0 |
| 13482 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13483 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13484 | #endif |
| 13485 | { } /* end */ |
| 13486 | }; |
| 13487 | |
| 13488 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13489 | { 2, alc861_asus_ch2_init }, |
| 13490 | { 6, alc861_asus_ch6_init }, |
| 13491 | }; |
| 13492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13493 | /* patch-ALC861 */ |
| 13494 | |
| 13495 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13496 | /* output mixer control */ |
| 13497 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13498 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13499 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13500 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13501 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13502 | |
| 13503 | /*Input mixer control */ |
| 13504 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13505 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13506 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13507 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13508 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13509 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13510 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13511 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13512 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13513 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13515 | { } /* end */ |
| 13516 | }; |
| 13517 | |
| 13518 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13519 | /* output mixer control */ |
| 13520 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13521 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13522 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13523 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13524 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13525 | |
| 13526 | /* Input mixer control */ |
| 13527 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13528 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13529 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13530 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13531 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13532 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13535 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13536 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13537 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13538 | { |
| 13539 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13540 | .name = "Channel Mode", |
| 13541 | .info = alc_ch_mode_info, |
| 13542 | .get = alc_ch_mode_get, |
| 13543 | .put = alc_ch_mode_put, |
| 13544 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13545 | }, |
| 13546 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13547 | }; |
| 13548 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13549 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13550 | /* output mixer control */ |
| 13551 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13552 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13553 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13554 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13555 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13556 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13557 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13558 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13559 | /* output mixer control */ |
| 13560 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13561 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13562 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13563 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13564 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13565 | |
| 13566 | /* Input mixer control */ |
| 13567 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13568 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13569 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13570 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13571 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13572 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13573 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13574 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13575 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13577 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13578 | { |
| 13579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13580 | .name = "Channel Mode", |
| 13581 | .info = alc_ch_mode_info, |
| 13582 | .get = alc_ch_mode_get, |
| 13583 | .put = alc_ch_mode_put, |
| 13584 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13585 | }, |
| 13586 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13587 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13588 | |
| 13589 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13590 | /* output mixer control */ |
| 13591 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13592 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13593 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13594 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13595 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13596 | |
| 13597 | /* Input mixer control */ |
| 13598 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13599 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13600 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13601 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13602 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13603 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13604 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13605 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13606 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13607 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13608 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13609 | { |
| 13610 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13611 | .name = "Channel Mode", |
| 13612 | .info = alc_ch_mode_info, |
| 13613 | .get = alc_ch_mode_get, |
| 13614 | .put = alc_ch_mode_put, |
| 13615 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13616 | }, |
| 13617 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13618 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13619 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13620 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13621 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13622 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13623 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13624 | { } |
| 13625 | }; |
| 13626 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13627 | /* |
| 13628 | * generic initialization of ADC, input mixers and output mixers |
| 13629 | */ |
| 13630 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13631 | /* |
| 13632 | * Unmute ADC0 and set the default input to mic-in |
| 13633 | */ |
| 13634 | /* port-A for surround (rear panel) */ |
| 13635 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13636 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13637 | /* port-B for mic-in (rear panel) with vref */ |
| 13638 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13639 | /* port-C for line-in (rear panel) */ |
| 13640 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13641 | /* port-D for Front */ |
| 13642 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13643 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13644 | /* port-E for HP out (front panel) */ |
| 13645 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13646 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13647 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13648 | /* port-F for mic-in (front panel) with vref */ |
| 13649 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13650 | /* port-G for CLFE (rear panel) */ |
| 13651 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13652 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13653 | /* port-H for side (rear panel) */ |
| 13654 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13655 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13656 | /* CD-in */ |
| 13657 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13658 | /* route front mic to ADC1*/ |
| 13659 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13660 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13661 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13662 | /* Unmute DAC0~3 & spdif out*/ |
| 13663 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13664 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13665 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13666 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13667 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13668 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13669 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13670 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13671 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13672 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13673 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13674 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13675 | /* Unmute Stereo Mixer 15 */ |
| 13676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13677 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13678 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13679 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13680 | |
| 13681 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13682 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13683 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13684 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13685 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13686 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13687 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13688 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13689 | /* hp used DAC 3 (Front) */ |
| 13690 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13691 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13692 | |
| 13693 | { } |
| 13694 | }; |
| 13695 | |
| 13696 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13697 | /* |
| 13698 | * Unmute ADC0 and set the default input to mic-in |
| 13699 | */ |
| 13700 | /* port-A for surround (rear panel) */ |
| 13701 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13702 | /* port-B for mic-in (rear panel) with vref */ |
| 13703 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13704 | /* port-C for line-in (rear panel) */ |
| 13705 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13706 | /* port-D for Front */ |
| 13707 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13708 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13709 | /* port-E for HP out (front panel) */ |
| 13710 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13711 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13712 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13713 | /* port-F for mic-in (front panel) with vref */ |
| 13714 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13715 | /* port-G for CLFE (rear panel) */ |
| 13716 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13717 | /* port-H for side (rear panel) */ |
| 13718 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13719 | /* CD-in */ |
| 13720 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13721 | /* route front mic to ADC1*/ |
| 13722 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13723 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13724 | /* Unmute DAC0~3 & spdif out*/ |
| 13725 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13726 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13727 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13728 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13730 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13731 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13732 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13733 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13734 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13735 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13736 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13737 | /* Unmute Stereo Mixer 15 */ |
| 13738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13739 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13740 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13742 | |
| 13743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13744 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13746 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13751 | /* hp used DAC 3 (Front) */ |
| 13752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13753 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13754 | { } |
| 13755 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13756 | |
| 13757 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13758 | /* |
| 13759 | * Unmute ADC0 and set the default input to mic-in |
| 13760 | */ |
| 13761 | /* port-A for surround (rear panel) */ |
| 13762 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13763 | /* port-B for mic-in (rear panel) with vref */ |
| 13764 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13765 | /* port-C for line-in (rear panel) */ |
| 13766 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13767 | /* port-D for Front */ |
| 13768 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13769 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13770 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13771 | /* this has to be set to VREF80 */ |
| 13772 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13773 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13774 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13775 | /* port-F for mic-in (front panel) with vref */ |
| 13776 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13777 | /* port-G for CLFE (rear panel) */ |
| 13778 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13779 | /* port-H for side (rear panel) */ |
| 13780 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13781 | /* CD-in */ |
| 13782 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13783 | /* route front mic to ADC1*/ |
| 13784 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13785 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13786 | /* Unmute DAC0~3 & spdif out*/ |
| 13787 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13788 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13789 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13790 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13792 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13793 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13794 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13795 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13796 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13797 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13798 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13799 | /* Unmute Stereo Mixer 15 */ |
| 13800 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13802 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13803 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13804 | |
| 13805 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13806 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13807 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13808 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13809 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13810 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13811 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13812 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13813 | /* hp used DAC 3 (Front) */ |
| 13814 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13815 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13816 | { } |
| 13817 | }; |
| 13818 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13819 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13820 | /* |
| 13821 | * Unmute ADC0 and set the default input to mic-in |
| 13822 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13823 | /* port-A for surround (rear panel) |
| 13824 | * according to codec#0 this is the HP jack |
| 13825 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13826 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13827 | /* route front PCM to HP */ |
| 13828 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13829 | /* port-B for mic-in (rear panel) with vref */ |
| 13830 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13831 | /* port-C for line-in (rear panel) */ |
| 13832 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13833 | /* port-D for Front */ |
| 13834 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13835 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13836 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13837 | /* this has to be set to VREF80 */ |
| 13838 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13839 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13840 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13841 | /* port-F for mic-in (front panel) with vref */ |
| 13842 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13843 | /* port-G for CLFE (rear panel) */ |
| 13844 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13845 | /* port-H for side (rear panel) */ |
| 13846 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13847 | /* CD-in */ |
| 13848 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13849 | /* route front mic to ADC1*/ |
| 13850 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13851 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13852 | /* Unmute DAC0~3 & spdif out*/ |
| 13853 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13854 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13855 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13856 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13857 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13858 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13859 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13860 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13861 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13862 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13863 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13864 | /* Unmute Stereo Mixer 15 */ |
| 13865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13866 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13867 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13868 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13869 | |
| 13870 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13871 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13872 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13873 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13874 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13875 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13876 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13877 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13878 | /* hp used DAC 3 (Front) */ |
| 13879 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13880 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13881 | { } |
| 13882 | }; |
| 13883 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13884 | /* additional init verbs for ASUS laptops */ |
| 13885 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13886 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13887 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13888 | { } |
| 13889 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13890 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13891 | /* |
| 13892 | * generic initialization of ADC, input mixers and output mixers |
| 13893 | */ |
| 13894 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13895 | /* |
| 13896 | * Unmute ADC0 and set the default input to mic-in |
| 13897 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13898 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13899 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13900 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13901 | /* Unmute DAC0~3 & spdif out*/ |
| 13902 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13903 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13904 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13905 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13906 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13907 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13908 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13909 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13910 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13911 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13912 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13913 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13914 | /* Unmute Stereo Mixer 15 */ |
| 13915 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13916 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13917 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13918 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13919 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13920 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13921 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13922 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13923 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13924 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13925 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13926 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13927 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13928 | |
| 13929 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13931 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13932 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13933 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13934 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13935 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13936 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13937 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13938 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13939 | |
| 13940 | { } |
| 13941 | }; |
| 13942 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13943 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13944 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13945 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13946 | { } |
| 13947 | }; |
| 13948 | |
| 13949 | /* toggle speaker-output according to the hp-jack state */ |
| 13950 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13951 | { |
| 13952 | unsigned int present; |
| 13953 | |
| 13954 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13955 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13956 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13957 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13958 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13959 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13960 | } |
| 13961 | |
| 13962 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13963 | unsigned int res) |
| 13964 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13965 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13966 | alc861_toshiba_automute(codec); |
| 13967 | } |
| 13968 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13969 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13970 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13971 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13972 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13973 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13974 | |
| 13975 | |
| 13976 | #define ALC861_DIGOUT_NID 0x07 |
| 13977 | |
| 13978 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13979 | { 8, NULL } |
| 13980 | }; |
| 13981 | |
| 13982 | static hda_nid_t alc861_dac_nids[4] = { |
| 13983 | /* front, surround, clfe, side */ |
| 13984 | 0x03, 0x06, 0x05, 0x04 |
| 13985 | }; |
| 13986 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13987 | static hda_nid_t alc660_dac_nids[3] = { |
| 13988 | /* front, clfe, surround */ |
| 13989 | 0x03, 0x05, 0x06 |
| 13990 | }; |
| 13991 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13992 | static hda_nid_t alc861_adc_nids[1] = { |
| 13993 | /* ADC0-2 */ |
| 13994 | 0x08, |
| 13995 | }; |
| 13996 | |
| 13997 | static struct hda_input_mux alc861_capture_source = { |
| 13998 | .num_items = 5, |
| 13999 | .items = { |
| 14000 | { "Mic", 0x0 }, |
| 14001 | { "Front Mic", 0x3 }, |
| 14002 | { "Line", 0x1 }, |
| 14003 | { "CD", 0x4 }, |
| 14004 | { "Mixer", 0x5 }, |
| 14005 | }, |
| 14006 | }; |
| 14007 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14008 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14009 | { |
| 14010 | struct alc_spec *spec = codec->spec; |
| 14011 | hda_nid_t mix, srcs[5]; |
| 14012 | int i, j, num; |
| 14013 | |
| 14014 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14015 | return 0; |
| 14016 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14017 | if (num < 0) |
| 14018 | return 0; |
| 14019 | for (i = 0; i < num; i++) { |
| 14020 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14021 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14022 | if (type != AC_WID_AUD_OUT) |
| 14023 | continue; |
| 14024 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14025 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14026 | break; |
| 14027 | if (j >= spec->multiout.num_dacs) |
| 14028 | return srcs[i]; |
| 14029 | } |
| 14030 | return 0; |
| 14031 | } |
| 14032 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14033 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14034 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14035 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14036 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14037 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14038 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14039 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14040 | |
| 14041 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14042 | for (i = 0; i < cfg->line_outs; i++) { |
| 14043 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14044 | dac = alc861_look_for_dac(codec, nid); |
| 14045 | if (!dac) |
| 14046 | continue; |
| 14047 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14048 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14049 | return 0; |
| 14050 | } |
| 14051 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14052 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14053 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14054 | { |
| 14055 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14056 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14057 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14058 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14059 | } |
| 14060 | |
| 14061 | /* add playback controls from the parsed DAC table */ |
| 14062 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14063 | const struct auto_pin_cfg *cfg) |
| 14064 | { |
| 14065 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14066 | static const char *chname[4] = { |
| 14067 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14068 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14069 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14070 | int i, err; |
| 14071 | |
| 14072 | if (cfg->line_outs == 1) { |
| 14073 | const char *pfx = NULL; |
| 14074 | if (!cfg->hp_outs) |
| 14075 | pfx = "Master"; |
| 14076 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14077 | pfx = "Speaker"; |
| 14078 | if (pfx) { |
| 14079 | nid = spec->multiout.dac_nids[0]; |
| 14080 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14081 | } |
| 14082 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14083 | |
| 14084 | for (i = 0; i < cfg->line_outs; i++) { |
| 14085 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14086 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14087 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14088 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14089 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14090 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14091 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14092 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14093 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14094 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14095 | return err; |
| 14096 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14097 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14098 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14099 | return err; |
| 14100 | } |
| 14101 | } |
| 14102 | return 0; |
| 14103 | } |
| 14104 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14105 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14106 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14107 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14108 | int err; |
| 14109 | hda_nid_t nid; |
| 14110 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14111 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14112 | return 0; |
| 14113 | |
| 14114 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14115 | nid = alc861_look_for_dac(codec, pin); |
| 14116 | if (nid) { |
| 14117 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14118 | if (err < 0) |
| 14119 | return err; |
| 14120 | spec->multiout.hp_nid = nid; |
| 14121 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14122 | } |
| 14123 | return 0; |
| 14124 | } |
| 14125 | |
| 14126 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14127 | static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14128 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14129 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14130 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14131 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14132 | int i, err, idx, idx1; |
| 14133 | |
| 14134 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14135 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14136 | case 0x0c: |
| 14137 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14138 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14139 | break; |
| 14140 | case 0x0f: |
| 14141 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14142 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14143 | break; |
| 14144 | case 0x0d: |
| 14145 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14146 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14147 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14148 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14149 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14150 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14151 | break; |
| 14152 | case 0x11: |
| 14153 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14154 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14155 | break; |
| 14156 | default: |
| 14157 | continue; |
| 14158 | } |
| 14159 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14160 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14161 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14162 | if (err < 0) |
| 14163 | return err; |
| 14164 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14165 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14166 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14167 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14168 | } |
| 14169 | return 0; |
| 14170 | } |
| 14171 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14172 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14173 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14174 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14175 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14176 | hda_nid_t mix, srcs[5]; |
| 14177 | int i, num; |
| 14178 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14179 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14180 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14181 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14182 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14183 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14184 | return; |
| 14185 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14186 | if (num < 0) |
| 14187 | return; |
| 14188 | for (i = 0; i < num; i++) { |
| 14189 | unsigned int mute; |
| 14190 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14191 | mute = AMP_IN_UNMUTE(i); |
| 14192 | else |
| 14193 | mute = AMP_IN_MUTE(i); |
| 14194 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14195 | mute); |
| 14196 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14197 | } |
| 14198 | |
| 14199 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14200 | { |
| 14201 | struct alc_spec *spec = codec->spec; |
| 14202 | int i; |
| 14203 | |
| 14204 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14205 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14206 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14207 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14208 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14209 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14210 | } |
| 14211 | } |
| 14212 | |
| 14213 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14214 | { |
| 14215 | struct alc_spec *spec = codec->spec; |
| 14216 | hda_nid_t pin; |
| 14217 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14218 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14219 | if (pin) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14220 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14221 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14222 | pin = spec->autocfg.speaker_pins[0]; |
| 14223 | if (pin) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14224 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 14225 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14226 | } |
| 14227 | |
| 14228 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14229 | { |
| 14230 | struct alc_spec *spec = codec->spec; |
| 14231 | int i; |
| 14232 | |
| 14233 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14234 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14235 | if (nid >= 0x0c && nid <= 0x11) |
| 14236 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14237 | } |
| 14238 | } |
| 14239 | |
| 14240 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14241 | /* return 1 if successful, 0 if the proper config is not found, |
| 14242 | * or a negative error code |
| 14243 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14244 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14245 | { |
| 14246 | struct alc_spec *spec = codec->spec; |
| 14247 | int err; |
| 14248 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14249 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14250 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14251 | alc861_ignore); |
| 14252 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14253 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14254 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14255 | return 0; /* can't find valid BIOS pin config */ |
| 14256 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14257 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14258 | if (err < 0) |
| 14259 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14260 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14261 | if (err < 0) |
| 14262 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14263 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14264 | if (err < 0) |
| 14265 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14266 | err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14267 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14268 | return err; |
| 14269 | |
| 14270 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14271 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14272 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14273 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14274 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14275 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14276 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14277 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14278 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14279 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14280 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14281 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14282 | |
| 14283 | spec->adc_nids = alc861_adc_nids; |
| 14284 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14285 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14286 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14287 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14288 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14289 | return 1; |
| 14290 | } |
| 14291 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14292 | /* additional initialization for auto-configuration model */ |
| 14293 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14294 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14295 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14296 | alc861_auto_init_multi_out(codec); |
| 14297 | alc861_auto_init_hp_out(codec); |
| 14298 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14299 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14300 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14301 | } |
| 14302 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14303 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14304 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14305 | { 0x15, HDA_INPUT, 0 }, |
| 14306 | { 0x15, HDA_INPUT, 1 }, |
| 14307 | { 0x15, HDA_INPUT, 2 }, |
| 14308 | { 0x15, HDA_INPUT, 3 }, |
| 14309 | { } /* end */ |
| 14310 | }; |
| 14311 | #endif |
| 14312 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14313 | |
| 14314 | /* |
| 14315 | * configuration and preset |
| 14316 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14317 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14318 | [ALC861_3ST] = "3stack", |
| 14319 | [ALC660_3ST] = "3stack-660", |
| 14320 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14321 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14322 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14323 | [ALC861_TOSHIBA] = "toshiba", |
| 14324 | [ALC861_ASUS] = "asus", |
| 14325 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14326 | [ALC861_AUTO] = "auto", |
| 14327 | }; |
| 14328 | |
| 14329 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14330 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14331 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14332 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14333 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14334 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14335 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14336 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14337 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14338 | * Any other models that need this preset? |
| 14339 | */ |
| 14340 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14341 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14342 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14343 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14344 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14345 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14346 | /* FIXME: the below seems conflict */ |
| 14347 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14348 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14349 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14350 | {} |
| 14351 | }; |
| 14352 | |
| 14353 | static struct alc_config_preset alc861_presets[] = { |
| 14354 | [ALC861_3ST] = { |
| 14355 | .mixers = { alc861_3ST_mixer }, |
| 14356 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14357 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14358 | .dac_nids = alc861_dac_nids, |
| 14359 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14360 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14361 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14362 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14363 | .adc_nids = alc861_adc_nids, |
| 14364 | .input_mux = &alc861_capture_source, |
| 14365 | }, |
| 14366 | [ALC861_3ST_DIG] = { |
| 14367 | .mixers = { alc861_base_mixer }, |
| 14368 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14369 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14370 | .dac_nids = alc861_dac_nids, |
| 14371 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14372 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14373 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14374 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14375 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14376 | .adc_nids = alc861_adc_nids, |
| 14377 | .input_mux = &alc861_capture_source, |
| 14378 | }, |
| 14379 | [ALC861_6ST_DIG] = { |
| 14380 | .mixers = { alc861_base_mixer }, |
| 14381 | .init_verbs = { alc861_base_init_verbs }, |
| 14382 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14383 | .dac_nids = alc861_dac_nids, |
| 14384 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14385 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14386 | .channel_mode = alc861_8ch_modes, |
| 14387 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14388 | .adc_nids = alc861_adc_nids, |
| 14389 | .input_mux = &alc861_capture_source, |
| 14390 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14391 | [ALC660_3ST] = { |
| 14392 | .mixers = { alc861_3ST_mixer }, |
| 14393 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14394 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14395 | .dac_nids = alc660_dac_nids, |
| 14396 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14397 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14398 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14399 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14400 | .adc_nids = alc861_adc_nids, |
| 14401 | .input_mux = &alc861_capture_source, |
| 14402 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14403 | [ALC861_UNIWILL_M31] = { |
| 14404 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14405 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14406 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14407 | .dac_nids = alc861_dac_nids, |
| 14408 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14409 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14410 | .channel_mode = alc861_uniwill_m31_modes, |
| 14411 | .need_dac_fix = 1, |
| 14412 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14413 | .adc_nids = alc861_adc_nids, |
| 14414 | .input_mux = &alc861_capture_source, |
| 14415 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14416 | [ALC861_TOSHIBA] = { |
| 14417 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14418 | .init_verbs = { alc861_base_init_verbs, |
| 14419 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14420 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14421 | .dac_nids = alc861_dac_nids, |
| 14422 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14423 | .channel_mode = alc883_3ST_2ch_modes, |
| 14424 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14425 | .adc_nids = alc861_adc_nids, |
| 14426 | .input_mux = &alc861_capture_source, |
| 14427 | .unsol_event = alc861_toshiba_unsol_event, |
| 14428 | .init_hook = alc861_toshiba_automute, |
| 14429 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14430 | [ALC861_ASUS] = { |
| 14431 | .mixers = { alc861_asus_mixer }, |
| 14432 | .init_verbs = { alc861_asus_init_verbs }, |
| 14433 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14434 | .dac_nids = alc861_dac_nids, |
| 14435 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14436 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14437 | .channel_mode = alc861_asus_modes, |
| 14438 | .need_dac_fix = 1, |
| 14439 | .hp_nid = 0x06, |
| 14440 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14441 | .adc_nids = alc861_adc_nids, |
| 14442 | .input_mux = &alc861_capture_source, |
| 14443 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14444 | [ALC861_ASUS_LAPTOP] = { |
| 14445 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14446 | .init_verbs = { alc861_asus_init_verbs, |
| 14447 | alc861_asus_laptop_init_verbs }, |
| 14448 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14449 | .dac_nids = alc861_dac_nids, |
| 14450 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14451 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14452 | .channel_mode = alc883_3ST_2ch_modes, |
| 14453 | .need_dac_fix = 1, |
| 14454 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14455 | .adc_nids = alc861_adc_nids, |
| 14456 | .input_mux = &alc861_capture_source, |
| 14457 | }, |
| 14458 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14459 | |
| 14460 | |
| 14461 | static int patch_alc861(struct hda_codec *codec) |
| 14462 | { |
| 14463 | struct alc_spec *spec; |
| 14464 | int board_config; |
| 14465 | int err; |
| 14466 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14467 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14468 | if (spec == NULL) |
| 14469 | return -ENOMEM; |
| 14470 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14471 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14472 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14473 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14474 | alc861_models, |
| 14475 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14476 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14477 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14478 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14479 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14480 | board_config = ALC861_AUTO; |
| 14481 | } |
| 14482 | |
| 14483 | if (board_config == ALC861_AUTO) { |
| 14484 | /* automatic parse from the BIOS config */ |
| 14485 | err = alc861_parse_auto_config(codec); |
| 14486 | if (err < 0) { |
| 14487 | alc_free(codec); |
| 14488 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14489 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14490 | printk(KERN_INFO |
| 14491 | "hda_codec: Cannot set up configuration " |
| 14492 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14493 | board_config = ALC861_3ST_DIG; |
| 14494 | } |
| 14495 | } |
| 14496 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14497 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14498 | if (err < 0) { |
| 14499 | alc_free(codec); |
| 14500 | return err; |
| 14501 | } |
| 14502 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14503 | if (board_config != ALC861_AUTO) |
| 14504 | setup_preset(spec, &alc861_presets[board_config]); |
| 14505 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14506 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14507 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14508 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14509 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14510 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14511 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14512 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14513 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14514 | spec->vmaster_nid = 0x03; |
| 14515 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14516 | codec->patch_ops = alc_patch_ops; |
| 14517 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14518 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14519 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14520 | if (!spec->loopback.amplist) |
| 14521 | spec->loopback.amplist = alc861_loopbacks; |
| 14522 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14523 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14524 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14525 | return 0; |
| 14526 | } |
| 14527 | |
| 14528 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14529 | * ALC861-VD support |
| 14530 | * |
| 14531 | * Based on ALC882 |
| 14532 | * |
| 14533 | * In addition, an independent DAC |
| 14534 | */ |
| 14535 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14536 | |
| 14537 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14538 | /* front, surr, clfe, side surr */ |
| 14539 | 0x02, 0x03, 0x04, 0x05 |
| 14540 | }; |
| 14541 | |
| 14542 | /* dac_nids for ALC660vd are in a different order - according to |
| 14543 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14544 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14545 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14546 | * - and it is the same as in 861vd. |
| 14547 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14548 | */ |
| 14549 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14550 | /* front, rear, clfe, rear_surr */ |
| 14551 | 0x02, 0x04, 0x03 |
| 14552 | }; |
| 14553 | |
| 14554 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14555 | /* ADC0 */ |
| 14556 | 0x09, |
| 14557 | }; |
| 14558 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14559 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14560 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14561 | /* input MUX */ |
| 14562 | /* FIXME: should be a matrix-type input source selection */ |
| 14563 | static struct hda_input_mux alc861vd_capture_source = { |
| 14564 | .num_items = 4, |
| 14565 | .items = { |
| 14566 | { "Mic", 0x0 }, |
| 14567 | { "Front Mic", 0x1 }, |
| 14568 | { "Line", 0x2 }, |
| 14569 | { "CD", 0x4 }, |
| 14570 | }, |
| 14571 | }; |
| 14572 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14573 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14574 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14575 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14576 | { "Ext Mic", 0x0 }, |
| 14577 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14578 | }, |
| 14579 | }; |
| 14580 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14581 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14582 | .num_items = 2, |
| 14583 | .items = { |
| 14584 | { "Front Mic", 0x0 }, |
| 14585 | { "ATAPI Mic", 0x1 }, |
| 14586 | }, |
| 14587 | }; |
| 14588 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14589 | /* |
| 14590 | * 2ch mode |
| 14591 | */ |
| 14592 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14593 | { 2, NULL } |
| 14594 | }; |
| 14595 | |
| 14596 | /* |
| 14597 | * 6ch mode |
| 14598 | */ |
| 14599 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14600 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14601 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14602 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14603 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14604 | { } /* end */ |
| 14605 | }; |
| 14606 | |
| 14607 | /* |
| 14608 | * 8ch mode |
| 14609 | */ |
| 14610 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14611 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14612 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14613 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14614 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14615 | { } /* end */ |
| 14616 | }; |
| 14617 | |
| 14618 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14619 | { 6, alc861vd_6stack_ch6_init }, |
| 14620 | { 8, alc861vd_6stack_ch8_init }, |
| 14621 | }; |
| 14622 | |
| 14623 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14624 | { |
| 14625 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14626 | .name = "Channel Mode", |
| 14627 | .info = alc_ch_mode_info, |
| 14628 | .get = alc_ch_mode_get, |
| 14629 | .put = alc_ch_mode_put, |
| 14630 | }, |
| 14631 | { } /* end */ |
| 14632 | }; |
| 14633 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14634 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14635 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14636 | */ |
| 14637 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14638 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14639 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14640 | |
| 14641 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14642 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14643 | |
| 14644 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14645 | HDA_OUTPUT), |
| 14646 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14647 | HDA_OUTPUT), |
| 14648 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14649 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14650 | |
| 14651 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14652 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14653 | |
| 14654 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14655 | |
| 14656 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14659 | |
| 14660 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14661 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14662 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14663 | |
| 14664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14665 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14666 | |
| 14667 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14668 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14669 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14670 | { } /* end */ |
| 14671 | }; |
| 14672 | |
| 14673 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14675 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14676 | |
| 14677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14678 | |
| 14679 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14682 | |
| 14683 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14684 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14685 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14686 | |
| 14687 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14688 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14689 | |
| 14690 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14691 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14692 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14693 | { } /* end */ |
| 14694 | }; |
| 14695 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14696 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14697 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14698 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14699 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14700 | |
| 14701 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14702 | |
| 14703 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14704 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14705 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14706 | |
| 14707 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14708 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14709 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14710 | |
| 14711 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14712 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14713 | |
| 14714 | { } /* end */ |
| 14715 | }; |
| 14716 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14717 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14718 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14719 | */ |
| 14720 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14721 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14722 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14723 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14724 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14725 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14726 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14727 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14728 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14729 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14730 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14731 | { } /* end */ |
| 14732 | }; |
| 14733 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14734 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14735 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14736 | */ |
| 14737 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14738 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14739 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14740 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14741 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14742 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14743 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14744 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14745 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14746 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14747 | { } /* end */ |
| 14748 | }; |
| 14749 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14750 | /* |
| 14751 | * generic initialization of ADC, input mixers and output mixers |
| 14752 | */ |
| 14753 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14754 | /* |
| 14755 | * Unmute ADC0 and set the default input to mic-in |
| 14756 | */ |
| 14757 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14758 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14759 | |
| 14760 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14761 | * the analog-loopback mixer widget |
| 14762 | */ |
| 14763 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14769 | |
| 14770 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14772 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14775 | |
| 14776 | /* |
| 14777 | * Set up output mixers (0x02 - 0x05) |
| 14778 | */ |
| 14779 | /* set vol=0 to output mixers */ |
| 14780 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14781 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14782 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14783 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14784 | |
| 14785 | /* set up input amps for analog loopback */ |
| 14786 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14789 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14790 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14791 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14792 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14793 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14794 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14795 | |
| 14796 | { } |
| 14797 | }; |
| 14798 | |
| 14799 | /* |
| 14800 | * 3-stack pin configuration: |
| 14801 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14802 | */ |
| 14803 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14804 | /* |
| 14805 | * Set pin mode and muting |
| 14806 | */ |
| 14807 | /* set front pin widgets 0x14 for output */ |
| 14808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14809 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14810 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14811 | |
| 14812 | /* Mic (rear) pin: input vref at 80% */ |
| 14813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14814 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14815 | /* Front Mic pin: input vref at 80% */ |
| 14816 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14817 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14818 | /* Line In pin: input */ |
| 14819 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14820 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14821 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14822 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14823 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14824 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14825 | /* CD pin widget for input */ |
| 14826 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14827 | |
| 14828 | { } |
| 14829 | }; |
| 14830 | |
| 14831 | /* |
| 14832 | * 6-stack pin configuration: |
| 14833 | */ |
| 14834 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14835 | /* |
| 14836 | * Set pin mode and muting |
| 14837 | */ |
| 14838 | /* set front pin widgets 0x14 for output */ |
| 14839 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14840 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14841 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14842 | |
| 14843 | /* Rear Pin: output 1 (0x0d) */ |
| 14844 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14845 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14846 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14847 | /* CLFE Pin: output 2 (0x0e) */ |
| 14848 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14849 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14850 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14851 | /* Side Pin: output 3 (0x0f) */ |
| 14852 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14853 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14854 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14855 | |
| 14856 | /* Mic (rear) pin: input vref at 80% */ |
| 14857 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14858 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14859 | /* Front Mic pin: input vref at 80% */ |
| 14860 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14861 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14862 | /* Line In pin: input */ |
| 14863 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14864 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14865 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14866 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14867 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14868 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14869 | /* CD pin widget for input */ |
| 14870 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14871 | |
| 14872 | { } |
| 14873 | }; |
| 14874 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14875 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14876 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14877 | { } |
| 14878 | }; |
| 14879 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14880 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14881 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14882 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14883 | { } |
| 14884 | }; |
| 14885 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14886 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14889 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14890 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14891 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14892 | {} |
| 14893 | }; |
| 14894 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14895 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14896 | { |
| 14897 | unsigned int present; |
| 14898 | unsigned char bits; |
| 14899 | |
| 14900 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14901 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14902 | bits = present ? HDA_AMP_MUTE : 0; |
| 14903 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14904 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14905 | } |
| 14906 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14907 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14908 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14909 | struct alc_spec *spec = codec->spec; |
| 14910 | |
| 14911 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14912 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14913 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14914 | alc861vd_lenovo_mic_automute(codec); |
| 14915 | } |
| 14916 | |
| 14917 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14918 | unsigned int res) |
| 14919 | { |
| 14920 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14921 | case ALC880_MIC_EVENT: |
| 14922 | alc861vd_lenovo_mic_automute(codec); |
| 14923 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14924 | default: |
| 14925 | alc_automute_amp_unsol_event(codec, res); |
| 14926 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14927 | } |
| 14928 | } |
| 14929 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14930 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14931 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14932 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14933 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14934 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14935 | |
| 14936 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14938 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14939 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14940 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14941 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14942 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14943 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14944 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14945 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14946 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14947 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14948 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14949 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14950 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14951 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14952 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14953 | |
| 14954 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14955 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14956 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14957 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14958 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14959 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14960 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14961 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14962 | |
| 14963 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14964 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14965 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14967 | |
| 14968 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14969 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14970 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14971 | |
| 14972 | { } /* end */ |
| 14973 | }; |
| 14974 | |
| 14975 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14976 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14977 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14978 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14979 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14980 | spec->autocfg.hp_pins[0] = 0x15; |
| 14981 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14982 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14983 | } |
| 14984 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14985 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14986 | #define alc861vd_loopbacks alc880_loopbacks |
| 14987 | #endif |
| 14988 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14989 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14990 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14991 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14992 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14993 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14994 | |
| 14995 | /* |
| 14996 | * configuration and preset |
| 14997 | */ |
| 14998 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14999 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15000 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15001 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15002 | [ALC861VD_3ST] = "3stack", |
| 15003 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15004 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15005 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15006 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15007 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15008 | [ALC861VD_AUTO] = "auto", |
| 15009 | }; |
| 15010 | |
| 15011 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15012 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15013 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15014 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15015 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15016 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15017 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15018 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15019 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15020 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15021 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15022 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15023 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15024 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15025 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15026 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15027 | {} |
| 15028 | }; |
| 15029 | |
| 15030 | static struct alc_config_preset alc861vd_presets[] = { |
| 15031 | [ALC660VD_3ST] = { |
| 15032 | .mixers = { alc861vd_3st_mixer }, |
| 15033 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15034 | alc861vd_3stack_init_verbs }, |
| 15035 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15036 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15037 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15038 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15039 | .input_mux = &alc861vd_capture_source, |
| 15040 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15041 | [ALC660VD_3ST_DIG] = { |
| 15042 | .mixers = { alc861vd_3st_mixer }, |
| 15043 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15044 | alc861vd_3stack_init_verbs }, |
| 15045 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15046 | .dac_nids = alc660vd_dac_nids, |
| 15047 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15048 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15049 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15050 | .input_mux = &alc861vd_capture_source, |
| 15051 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15052 | [ALC861VD_3ST] = { |
| 15053 | .mixers = { alc861vd_3st_mixer }, |
| 15054 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15055 | alc861vd_3stack_init_verbs }, |
| 15056 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15057 | .dac_nids = alc861vd_dac_nids, |
| 15058 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15059 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15060 | .input_mux = &alc861vd_capture_source, |
| 15061 | }, |
| 15062 | [ALC861VD_3ST_DIG] = { |
| 15063 | .mixers = { alc861vd_3st_mixer }, |
| 15064 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15065 | alc861vd_3stack_init_verbs }, |
| 15066 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15067 | .dac_nids = alc861vd_dac_nids, |
| 15068 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15069 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15070 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15071 | .input_mux = &alc861vd_capture_source, |
| 15072 | }, |
| 15073 | [ALC861VD_6ST_DIG] = { |
| 15074 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15075 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15076 | alc861vd_6stack_init_verbs }, |
| 15077 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15078 | .dac_nids = alc861vd_dac_nids, |
| 15079 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15080 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15081 | .channel_mode = alc861vd_6stack_modes, |
| 15082 | .input_mux = &alc861vd_capture_source, |
| 15083 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15084 | [ALC861VD_LENOVO] = { |
| 15085 | .mixers = { alc861vd_lenovo_mixer }, |
| 15086 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15087 | alc861vd_3stack_init_verbs, |
| 15088 | alc861vd_eapd_verbs, |
| 15089 | alc861vd_lenovo_unsol_verbs }, |
| 15090 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15091 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15092 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15093 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15094 | .input_mux = &alc861vd_capture_source, |
| 15095 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15096 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15097 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15098 | [ALC861VD_DALLAS] = { |
| 15099 | .mixers = { alc861vd_dallas_mixer }, |
| 15100 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15101 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15102 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15103 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15104 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15105 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15106 | .unsol_event = alc_automute_amp_unsol_event, |
| 15107 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15108 | }, |
| 15109 | [ALC861VD_HP] = { |
| 15110 | .mixers = { alc861vd_hp_mixer }, |
| 15111 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15112 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15113 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15114 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15115 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15116 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15117 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15118 | .unsol_event = alc_automute_amp_unsol_event, |
| 15119 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15120 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15121 | [ALC660VD_ASUS_V1S] = { |
| 15122 | .mixers = { alc861vd_lenovo_mixer }, |
| 15123 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15124 | alc861vd_3stack_init_verbs, |
| 15125 | alc861vd_eapd_verbs, |
| 15126 | alc861vd_lenovo_unsol_verbs }, |
| 15127 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15128 | .dac_nids = alc660vd_dac_nids, |
| 15129 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15130 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15131 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15132 | .input_mux = &alc861vd_capture_source, |
| 15133 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15134 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15135 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15136 | }; |
| 15137 | |
| 15138 | /* |
| 15139 | * BIOS auto configuration |
| 15140 | */ |
| 15141 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15142 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15143 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15144 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15145 | } |
| 15146 | |
| 15147 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15148 | { |
| 15149 | struct alc_spec *spec = codec->spec; |
| 15150 | int i; |
| 15151 | |
| 15152 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15153 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15154 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15155 | if (nid) |
| 15156 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15157 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15158 | } |
| 15159 | } |
| 15160 | |
| 15161 | |
| 15162 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15163 | { |
| 15164 | struct alc_spec *spec = codec->spec; |
| 15165 | hda_nid_t pin; |
| 15166 | |
| 15167 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15168 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15169 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15170 | pin = spec->autocfg.speaker_pins[0]; |
| 15171 | if (pin) |
| 15172 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15173 | } |
| 15174 | |
| 15175 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15176 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15177 | |
| 15178 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15179 | { |
| 15180 | struct alc_spec *spec = codec->spec; |
| 15181 | int i; |
| 15182 | |
| 15183 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15184 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15185 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15186 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15187 | if (nid != ALC861VD_PIN_CD_NID && |
| 15188 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15189 | snd_hda_codec_write(codec, nid, 0, |
| 15190 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15191 | AMP_OUT_MUTE); |
| 15192 | } |
| 15193 | } |
| 15194 | } |
| 15195 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15196 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15197 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15198 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15199 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15200 | |
| 15201 | /* add playback controls from the parsed DAC table */ |
| 15202 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15203 | * different NIDs for mute/unmute switch and volume control */ |
| 15204 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15205 | const struct auto_pin_cfg *cfg) |
| 15206 | { |
| 15207 | char name[32]; |
| 15208 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15209 | hda_nid_t nid_v, nid_s; |
| 15210 | int i, err; |
| 15211 | |
| 15212 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15213 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15214 | continue; |
| 15215 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15216 | alc880_dac_to_idx( |
| 15217 | spec->multiout.dac_nids[i])); |
| 15218 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15219 | alc880_dac_to_idx( |
| 15220 | spec->multiout.dac_nids[i])); |
| 15221 | |
| 15222 | if (i == 2) { |
| 15223 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15224 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15225 | "Center Playback Volume", |
| 15226 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15227 | HDA_OUTPUT)); |
| 15228 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15229 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15230 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15231 | "LFE Playback Volume", |
| 15232 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15233 | HDA_OUTPUT)); |
| 15234 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15235 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15236 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15237 | "Center Playback Switch", |
| 15238 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15239 | HDA_INPUT)); |
| 15240 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15241 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15242 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15243 | "LFE Playback Switch", |
| 15244 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15245 | HDA_INPUT)); |
| 15246 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15247 | return err; |
| 15248 | } else { |
| 15249 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15250 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15251 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15252 | HDA_OUTPUT)); |
| 15253 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15254 | return err; |
| 15255 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15256 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15257 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15258 | HDA_INPUT)); |
| 15259 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15260 | return err; |
| 15261 | } |
| 15262 | } |
| 15263 | return 0; |
| 15264 | } |
| 15265 | |
| 15266 | /* add playback controls for speaker and HP outputs */ |
| 15267 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15268 | * different NIDs for mute/unmute switch and volume control */ |
| 15269 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15270 | hda_nid_t pin, const char *pfx) |
| 15271 | { |
| 15272 | hda_nid_t nid_v, nid_s; |
| 15273 | int err; |
| 15274 | char name[32]; |
| 15275 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15276 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15277 | return 0; |
| 15278 | |
| 15279 | if (alc880_is_fixed_pin(pin)) { |
| 15280 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15281 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15282 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15283 | spec->multiout.hp_nid = nid_v; |
| 15284 | else |
| 15285 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15286 | /* control HP volume/switch on the output mixer amp */ |
| 15287 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15288 | alc880_fixed_pin_idx(pin)); |
| 15289 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15290 | alc880_fixed_pin_idx(pin)); |
| 15291 | |
| 15292 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15293 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15294 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15295 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15296 | return err; |
| 15297 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15298 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15299 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15300 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15301 | return err; |
| 15302 | } else if (alc880_is_multi_pin(pin)) { |
| 15303 | /* set manual connection */ |
| 15304 | /* we have only a switch on HP-out PIN */ |
| 15305 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15306 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15307 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15308 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15309 | return err; |
| 15310 | } |
| 15311 | return 0; |
| 15312 | } |
| 15313 | |
| 15314 | /* parse the BIOS configuration and set up the alc_spec |
| 15315 | * return 1 if successful, 0 if the proper config is not found, |
| 15316 | * or a negative error code |
| 15317 | * Based on ALC880 version - had to change it to override |
| 15318 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15319 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15320 | { |
| 15321 | struct alc_spec *spec = codec->spec; |
| 15322 | int err; |
| 15323 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15324 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15325 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15326 | alc861vd_ignore); |
| 15327 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15328 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15329 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15330 | return 0; /* can't find valid BIOS pin config */ |
| 15331 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15332 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15333 | if (err < 0) |
| 15334 | return err; |
| 15335 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15336 | if (err < 0) |
| 15337 | return err; |
| 15338 | err = alc861vd_auto_create_extra_out(spec, |
| 15339 | spec->autocfg.speaker_pins[0], |
| 15340 | "Speaker"); |
| 15341 | if (err < 0) |
| 15342 | return err; |
| 15343 | err = alc861vd_auto_create_extra_out(spec, |
| 15344 | spec->autocfg.hp_pins[0], |
| 15345 | "Headphone"); |
| 15346 | if (err < 0) |
| 15347 | return err; |
| 15348 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15349 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15350 | return err; |
| 15351 | |
| 15352 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15353 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15354 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15355 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15356 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15357 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15358 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15359 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15360 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15361 | |
| 15362 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15363 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15364 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15365 | err = alc_auto_add_mic_boost(codec); |
| 15366 | if (err < 0) |
| 15367 | return err; |
| 15368 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15369 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15370 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15371 | return 1; |
| 15372 | } |
| 15373 | |
| 15374 | /* additional initialization for auto-configuration model */ |
| 15375 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15376 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15377 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15378 | alc861vd_auto_init_multi_out(codec); |
| 15379 | alc861vd_auto_init_hp_out(codec); |
| 15380 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15381 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15382 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15383 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15384 | } |
| 15385 | |
| 15386 | static int patch_alc861vd(struct hda_codec *codec) |
| 15387 | { |
| 15388 | struct alc_spec *spec; |
| 15389 | int err, board_config; |
| 15390 | |
| 15391 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15392 | if (spec == NULL) |
| 15393 | return -ENOMEM; |
| 15394 | |
| 15395 | codec->spec = spec; |
| 15396 | |
| 15397 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15398 | alc861vd_models, |
| 15399 | alc861vd_cfg_tbl); |
| 15400 | |
| 15401 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15402 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15403 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15404 | board_config = ALC861VD_AUTO; |
| 15405 | } |
| 15406 | |
| 15407 | if (board_config == ALC861VD_AUTO) { |
| 15408 | /* automatic parse from the BIOS config */ |
| 15409 | err = alc861vd_parse_auto_config(codec); |
| 15410 | if (err < 0) { |
| 15411 | alc_free(codec); |
| 15412 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15413 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15414 | printk(KERN_INFO |
| 15415 | "hda_codec: Cannot set up configuration " |
| 15416 | "from BIOS. Using base mode...\n"); |
| 15417 | board_config = ALC861VD_3ST; |
| 15418 | } |
| 15419 | } |
| 15420 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15421 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15422 | if (err < 0) { |
| 15423 | alc_free(codec); |
| 15424 | return err; |
| 15425 | } |
| 15426 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15427 | if (board_config != ALC861VD_AUTO) |
| 15428 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15429 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15430 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15431 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15432 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15433 | } |
| 15434 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15435 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15436 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15437 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15438 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15439 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15440 | |
| 15441 | spec->adc_nids = alc861vd_adc_nids; |
| 15442 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15443 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15444 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15445 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15446 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15447 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15448 | spec->vmaster_nid = 0x02; |
| 15449 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15450 | codec->patch_ops = alc_patch_ops; |
| 15451 | |
| 15452 | if (board_config == ALC861VD_AUTO) |
| 15453 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15454 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15455 | if (!spec->loopback.amplist) |
| 15456 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15457 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15458 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15459 | |
| 15460 | return 0; |
| 15461 | } |
| 15462 | |
| 15463 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15464 | * ALC662 support |
| 15465 | * |
| 15466 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15467 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15468 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15469 | * 6-channel independent captures. |
| 15470 | * |
| 15471 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15472 | * driver yet). |
| 15473 | */ |
| 15474 | #define ALC662_DIGOUT_NID 0x06 |
| 15475 | #define ALC662_DIGIN_NID 0x0a |
| 15476 | |
| 15477 | static hda_nid_t alc662_dac_nids[4] = { |
| 15478 | /* front, rear, clfe, rear_surr */ |
| 15479 | 0x02, 0x03, 0x04 |
| 15480 | }; |
| 15481 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15482 | static hda_nid_t alc272_dac_nids[2] = { |
| 15483 | 0x02, 0x03 |
| 15484 | }; |
| 15485 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15486 | static hda_nid_t alc662_adc_nids[1] = { |
| 15487 | /* ADC1-2 */ |
| 15488 | 0x09, |
| 15489 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15490 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15491 | static hda_nid_t alc272_adc_nids[1] = { |
| 15492 | /* ADC1-2 */ |
| 15493 | 0x08, |
| 15494 | }; |
| 15495 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15496 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15497 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15498 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15499 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15500 | /* input MUX */ |
| 15501 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15502 | static struct hda_input_mux alc662_capture_source = { |
| 15503 | .num_items = 4, |
| 15504 | .items = { |
| 15505 | { "Mic", 0x0 }, |
| 15506 | { "Front Mic", 0x1 }, |
| 15507 | { "Line", 0x2 }, |
| 15508 | { "CD", 0x4 }, |
| 15509 | }, |
| 15510 | }; |
| 15511 | |
| 15512 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15513 | .num_items = 2, |
| 15514 | .items = { |
| 15515 | { "Mic", 0x1 }, |
| 15516 | { "Line", 0x2 }, |
| 15517 | }, |
| 15518 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15519 | |
| 15520 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15521 | .num_items = 2, |
| 15522 | .items = { |
| 15523 | { "i-Mic", 0x1 }, |
| 15524 | { "e-Mic", 0x0 }, |
| 15525 | }, |
| 15526 | }; |
| 15527 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15528 | static struct hda_input_mux alc663_capture_source = { |
| 15529 | .num_items = 3, |
| 15530 | .items = { |
| 15531 | { "Mic", 0x0 }, |
| 15532 | { "Front Mic", 0x1 }, |
| 15533 | { "Line", 0x2 }, |
| 15534 | }, |
| 15535 | }; |
| 15536 | |
| 15537 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15538 | .num_items = 2, |
| 15539 | .items = { |
| 15540 | { "Ext-Mic", 0x0 }, |
| 15541 | { "D-Mic", 0x9 }, |
| 15542 | }, |
| 15543 | }; |
| 15544 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15545 | #if 1 /* set to 0 for testing other input sources below */ |
| 15546 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15547 | .num_items = 2, |
| 15548 | .items = { |
| 15549 | { "Autoselect Mic", 0x0 }, |
| 15550 | { "Internal Mic", 0x1 }, |
| 15551 | }, |
| 15552 | }; |
| 15553 | #else |
| 15554 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15555 | .num_items = 16, |
| 15556 | .items = { |
| 15557 | { "Autoselect Mic", 0x0 }, |
| 15558 | { "Internal Mic", 0x1 }, |
| 15559 | { "In-0x02", 0x2 }, |
| 15560 | { "In-0x03", 0x3 }, |
| 15561 | { "In-0x04", 0x4 }, |
| 15562 | { "In-0x05", 0x5 }, |
| 15563 | { "In-0x06", 0x6 }, |
| 15564 | { "In-0x07", 0x7 }, |
| 15565 | { "In-0x08", 0x8 }, |
| 15566 | { "In-0x09", 0x9 }, |
| 15567 | { "In-0x0a", 0x0a }, |
| 15568 | { "In-0x0b", 0x0b }, |
| 15569 | { "In-0x0c", 0x0c }, |
| 15570 | { "In-0x0d", 0x0d }, |
| 15571 | { "In-0x0e", 0x0e }, |
| 15572 | { "In-0x0f", 0x0f }, |
| 15573 | }, |
| 15574 | }; |
| 15575 | #endif |
| 15576 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15577 | /* |
| 15578 | * 2ch mode |
| 15579 | */ |
| 15580 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15581 | { 2, NULL } |
| 15582 | }; |
| 15583 | |
| 15584 | /* |
| 15585 | * 2ch mode |
| 15586 | */ |
| 15587 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15588 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15589 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15590 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15591 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15592 | { } /* end */ |
| 15593 | }; |
| 15594 | |
| 15595 | /* |
| 15596 | * 6ch mode |
| 15597 | */ |
| 15598 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15599 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15600 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15601 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15602 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15603 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15604 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15605 | { } /* end */ |
| 15606 | }; |
| 15607 | |
| 15608 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15609 | { 2, alc662_3ST_ch2_init }, |
| 15610 | { 6, alc662_3ST_ch6_init }, |
| 15611 | }; |
| 15612 | |
| 15613 | /* |
| 15614 | * 2ch mode |
| 15615 | */ |
| 15616 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15617 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15618 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15619 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15620 | { } /* end */ |
| 15621 | }; |
| 15622 | |
| 15623 | /* |
| 15624 | * 6ch mode |
| 15625 | */ |
| 15626 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15627 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15628 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15629 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15630 | { } /* end */ |
| 15631 | }; |
| 15632 | |
| 15633 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15634 | { 2, alc662_sixstack_ch6_init }, |
| 15635 | { 6, alc662_sixstack_ch8_init }, |
| 15636 | }; |
| 15637 | |
| 15638 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15639 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15640 | */ |
| 15641 | |
| 15642 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15643 | /* output mixer control */ |
| 15644 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15645 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15646 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15647 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15648 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15649 | 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] | 15650 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15651 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15652 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15653 | |
| 15654 | /*Input mixer control */ |
| 15655 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15656 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15657 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15658 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15660 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15661 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15662 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15663 | { } /* end */ |
| 15664 | }; |
| 15665 | |
| 15666 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15667 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15668 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15669 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15670 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15671 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15673 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15674 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15676 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15677 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15678 | { } /* end */ |
| 15679 | }; |
| 15680 | |
| 15681 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15682 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15683 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15684 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15685 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15686 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15687 | 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] | 15688 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15689 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15690 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15691 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15692 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15693 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15694 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15695 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15696 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15697 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15698 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15699 | { } /* end */ |
| 15700 | }; |
| 15701 | |
| 15702 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15703 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15704 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15705 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15706 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15707 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15708 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15709 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15711 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15712 | { } /* end */ |
| 15713 | }; |
| 15714 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15715 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15716 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15717 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15718 | |
| 15719 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15720 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15721 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15722 | |
| 15723 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15724 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15725 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15726 | { } /* end */ |
| 15727 | }; |
| 15728 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15729 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15730 | ALC262_HIPPO_MASTER_SWITCH, |
| 15731 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15732 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15733 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15734 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15735 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15736 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15737 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15739 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15740 | { } /* end */ |
| 15741 | }; |
| 15742 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15743 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15744 | .ops = &snd_hda_bind_vol, |
| 15745 | .values = { |
| 15746 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15747 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15748 | 0 |
| 15749 | }, |
| 15750 | }; |
| 15751 | |
| 15752 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15753 | .ops = &snd_hda_bind_sw, |
| 15754 | .values = { |
| 15755 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15756 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15757 | 0 |
| 15758 | }, |
| 15759 | }; |
| 15760 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15761 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15762 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15763 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15766 | { } /* end */ |
| 15767 | }; |
| 15768 | |
| 15769 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15770 | .ops = &snd_hda_bind_sw, |
| 15771 | .values = { |
| 15772 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15773 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15774 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15775 | 0 |
| 15776 | }, |
| 15777 | }; |
| 15778 | |
| 15779 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15780 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15781 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15782 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15784 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15785 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15786 | |
| 15787 | { } /* end */ |
| 15788 | }; |
| 15789 | |
| 15790 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15791 | .ops = &snd_hda_bind_sw, |
| 15792 | .values = { |
| 15793 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15794 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15795 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15796 | 0 |
| 15797 | }, |
| 15798 | }; |
| 15799 | |
| 15800 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15801 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15802 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15805 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15806 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15807 | { } /* end */ |
| 15808 | }; |
| 15809 | |
| 15810 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15811 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15812 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15814 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15816 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15817 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15818 | { } /* end */ |
| 15819 | }; |
| 15820 | |
| 15821 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15822 | .ops = &snd_hda_bind_vol, |
| 15823 | .values = { |
| 15824 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15825 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15826 | 0 |
| 15827 | }, |
| 15828 | }; |
| 15829 | |
| 15830 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15831 | .ops = &snd_hda_bind_sw, |
| 15832 | .values = { |
| 15833 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15834 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15835 | 0 |
| 15836 | }, |
| 15837 | }; |
| 15838 | |
| 15839 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15840 | HDA_BIND_VOL("Master Playback Volume", |
| 15841 | &alc663_asus_two_bind_master_vol), |
| 15842 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15843 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15847 | { } /* end */ |
| 15848 | }; |
| 15849 | |
| 15850 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15851 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15852 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15853 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15857 | { } /* end */ |
| 15858 | }; |
| 15859 | |
| 15860 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15861 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15862 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15864 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15866 | |
| 15867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15869 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15870 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15871 | { } /* end */ |
| 15872 | }; |
| 15873 | |
| 15874 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15875 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15876 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15878 | |
| 15879 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15880 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15881 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15882 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15883 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15884 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15885 | { } /* end */ |
| 15886 | }; |
| 15887 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15888 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15889 | { |
| 15890 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15891 | .name = "Channel Mode", |
| 15892 | .info = alc_ch_mode_info, |
| 15893 | .get = alc_ch_mode_get, |
| 15894 | .put = alc_ch_mode_put, |
| 15895 | }, |
| 15896 | { } /* end */ |
| 15897 | }; |
| 15898 | |
| 15899 | static struct hda_verb alc662_init_verbs[] = { |
| 15900 | /* ADC: mute amp left and right */ |
| 15901 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15902 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15903 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15904 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15906 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15907 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15910 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15915 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15916 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15917 | |
| 15918 | /* Front Pin: output 0 (0x0c) */ |
| 15919 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15920 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15921 | |
| 15922 | /* Rear Pin: output 1 (0x0d) */ |
| 15923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15925 | |
| 15926 | /* CLFE Pin: output 2 (0x0e) */ |
| 15927 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15928 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15929 | |
| 15930 | /* Mic (rear) pin: input vref at 80% */ |
| 15931 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15932 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15933 | /* Front Mic pin: input vref at 80% */ |
| 15934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15935 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15936 | /* Line In pin: input */ |
| 15937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15938 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15939 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15943 | /* CD pin widget for input */ |
| 15944 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15945 | |
| 15946 | /* FIXME: use matrix-type input source selection */ |
| 15947 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15948 | /* Input mixer */ |
| 15949 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15950 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15951 | |
| 15952 | /* always trun on EAPD */ |
| 15953 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15954 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15955 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15956 | { } |
| 15957 | }; |
| 15958 | |
| 15959 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15960 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15961 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15962 | {} |
| 15963 | }; |
| 15964 | |
| 15965 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15966 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15967 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15968 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15969 | }; |
| 15970 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15971 | /* Set Unsolicited Event*/ |
| 15972 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15973 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15974 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15975 | {} |
| 15976 | }; |
| 15977 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15978 | /* |
| 15979 | * generic initialization of ADC, input mixers and output mixers |
| 15980 | */ |
| 15981 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15982 | /* |
| 15983 | * Unmute ADC and set the default input to mic-in |
| 15984 | */ |
| 15985 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15987 | |
| 15988 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15989 | * mixer widget |
| 15990 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15991 | * panel mic (mic 2) |
| 15992 | */ |
| 15993 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15994 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15995 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15996 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15997 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15998 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15999 | |
| 16000 | /* |
| 16001 | * Set up output mixers (0x0c - 0x0f) |
| 16002 | */ |
| 16003 | /* set vol=0 to output mixers */ |
| 16004 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16005 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16006 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16007 | |
| 16008 | /* set up input amps for analog loopback */ |
| 16009 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16010 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16011 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16012 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16013 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16014 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16015 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16016 | |
| 16017 | |
| 16018 | /* FIXME: use matrix-type input source selection */ |
| 16019 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16020 | /* Input mixer */ |
| 16021 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16022 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16023 | { } |
| 16024 | }; |
| 16025 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16026 | /* additional verbs for ALC663 */ |
| 16027 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16028 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16029 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16030 | { } |
| 16031 | }; |
| 16032 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16033 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16035 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16036 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16037 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16038 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16039 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16041 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16042 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16043 | {} |
| 16044 | }; |
| 16045 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16046 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16047 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16048 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16049 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16050 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16051 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16052 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16053 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16054 | {} |
| 16055 | }; |
| 16056 | |
| 16057 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16058 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16059 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16060 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16061 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16064 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16065 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16066 | {} |
| 16067 | }; |
| 16068 | |
| 16069 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16070 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16072 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16074 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16075 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16076 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16077 | {} |
| 16078 | }; |
| 16079 | |
| 16080 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16081 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16082 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16083 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16084 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16085 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16086 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16087 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16089 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16090 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16091 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16092 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16093 | {} |
| 16094 | }; |
| 16095 | |
| 16096 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16097 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16098 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16099 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16100 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16101 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16102 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16103 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16104 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16105 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16106 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16107 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16108 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16109 | {} |
| 16110 | }; |
| 16111 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16112 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16113 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16114 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16115 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16116 | |
| 16117 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16118 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16119 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16120 | |
| 16121 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16122 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16123 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16124 | {} |
| 16125 | }; |
| 16126 | |
| 16127 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16128 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16129 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16130 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16131 | |
| 16132 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16133 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16134 | {} |
| 16135 | }; |
| 16136 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16137 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16138 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16140 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16141 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16142 | {} |
| 16143 | }; |
| 16144 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16145 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16146 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16147 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16148 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16149 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16150 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16151 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16152 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16154 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16155 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16156 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16157 | {} |
| 16158 | }; |
| 16159 | |
| 16160 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16161 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16162 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16163 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16164 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16165 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16166 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16167 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16168 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16169 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16170 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16171 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16172 | {} |
| 16173 | }; |
| 16174 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16175 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16176 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16177 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16178 | { } /* end */ |
| 16179 | }; |
| 16180 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16181 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16182 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16183 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16184 | { } /* end */ |
| 16185 | }; |
| 16186 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16187 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16188 | { |
| 16189 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16190 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16191 | |
| 16192 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16193 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16194 | bits = present ? HDA_AMP_MUTE : 0; |
| 16195 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16196 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16197 | } |
| 16198 | |
| 16199 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16200 | { |
| 16201 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16202 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16203 | |
| 16204 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16205 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16206 | bits = present ? HDA_AMP_MUTE : 0; |
| 16207 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16208 | HDA_AMP_MUTE, bits); |
| 16209 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16210 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16211 | } |
| 16212 | |
| 16213 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16214 | unsigned int res) |
| 16215 | { |
| 16216 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16217 | alc662_lenovo_101e_all_automute(codec); |
| 16218 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16219 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16220 | } |
| 16221 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16222 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16223 | { |
| 16224 | unsigned int present; |
| 16225 | |
| 16226 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16227 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16228 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16229 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16230 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16231 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16232 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16233 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16234 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16235 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16236 | } |
| 16237 | |
| 16238 | /* unsolicited event for HP jack sensing */ |
| 16239 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16240 | unsigned int res) |
| 16241 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16242 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16243 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16244 | else |
| 16245 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16246 | } |
| 16247 | |
| 16248 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16249 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16250 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16251 | alc662_eeepc_mic_automute(codec); |
| 16252 | } |
| 16253 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16254 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16255 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16256 | struct alc_spec *spec = codec->spec; |
| 16257 | |
| 16258 | spec->autocfg.hp_pins[0] = 0x14; |
| 16259 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16260 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16261 | } |
| 16262 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16263 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16264 | { |
| 16265 | unsigned int present; |
| 16266 | unsigned char bits; |
| 16267 | |
| 16268 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16269 | AC_VERB_GET_PIN_SENSE, 0) |
| 16270 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16271 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16272 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16273 | AMP_IN_MUTE(0), bits); |
| 16274 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16275 | AMP_IN_MUTE(0), bits); |
| 16276 | } |
| 16277 | |
| 16278 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16279 | { |
| 16280 | unsigned int present; |
| 16281 | unsigned char bits; |
| 16282 | |
| 16283 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16284 | AC_VERB_GET_PIN_SENSE, 0) |
| 16285 | & AC_PINSENSE_PRESENCE; |
| 16286 | bits = present ? HDA_AMP_MUTE : 0; |
| 16287 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16288 | AMP_IN_MUTE(0), bits); |
| 16289 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16290 | AMP_IN_MUTE(0), bits); |
| 16291 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16292 | AMP_IN_MUTE(0), bits); |
| 16293 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16294 | AMP_IN_MUTE(0), bits); |
| 16295 | } |
| 16296 | |
| 16297 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16298 | { |
| 16299 | unsigned int present; |
| 16300 | unsigned char bits; |
| 16301 | |
| 16302 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16303 | AC_VERB_GET_PIN_SENSE, 0) |
| 16304 | & AC_PINSENSE_PRESENCE; |
| 16305 | bits = present ? HDA_AMP_MUTE : 0; |
| 16306 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16307 | AMP_IN_MUTE(0), bits); |
| 16308 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16309 | AMP_IN_MUTE(0), bits); |
| 16310 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16311 | AMP_IN_MUTE(0), bits); |
| 16312 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16313 | AMP_IN_MUTE(0), bits); |
| 16314 | } |
| 16315 | |
| 16316 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16317 | { |
| 16318 | unsigned int present; |
| 16319 | unsigned char bits; |
| 16320 | |
| 16321 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16322 | AC_VERB_GET_PIN_SENSE, 0) |
| 16323 | & AC_PINSENSE_PRESENCE; |
| 16324 | bits = present ? 0 : PIN_OUT; |
| 16325 | snd_hda_codec_write(codec, 0x14, 0, |
| 16326 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16327 | } |
| 16328 | |
| 16329 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16330 | { |
| 16331 | unsigned int present1, present2; |
| 16332 | |
| 16333 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16334 | AC_VERB_GET_PIN_SENSE, 0) |
| 16335 | & AC_PINSENSE_PRESENCE; |
| 16336 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16337 | AC_VERB_GET_PIN_SENSE, 0) |
| 16338 | & AC_PINSENSE_PRESENCE; |
| 16339 | |
| 16340 | if (present1 || present2) { |
| 16341 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16342 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16343 | } else { |
| 16344 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16345 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16346 | } |
| 16347 | } |
| 16348 | |
| 16349 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16350 | { |
| 16351 | unsigned int present1, present2; |
| 16352 | |
| 16353 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16354 | AC_VERB_GET_PIN_SENSE, 0) |
| 16355 | & AC_PINSENSE_PRESENCE; |
| 16356 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16357 | AC_VERB_GET_PIN_SENSE, 0) |
| 16358 | & AC_PINSENSE_PRESENCE; |
| 16359 | |
| 16360 | if (present1 || present2) { |
| 16361 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16362 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16363 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16364 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16365 | } else { |
| 16366 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16367 | AMP_IN_MUTE(0), 0); |
| 16368 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16369 | AMP_IN_MUTE(0), 0); |
| 16370 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16371 | } |
| 16372 | |
| 16373 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16374 | { |
| 16375 | unsigned int present; |
| 16376 | |
| 16377 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16378 | AC_VERB_GET_PIN_SENSE, 0) |
| 16379 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16380 | 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] | 16381 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16382 | 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] | 16383 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16384 | 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] | 16385 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16386 | 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] | 16387 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16388 | } |
| 16389 | |
| 16390 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16391 | unsigned int res) |
| 16392 | { |
| 16393 | switch (res >> 26) { |
| 16394 | case ALC880_HP_EVENT: |
| 16395 | alc663_m51va_speaker_automute(codec); |
| 16396 | break; |
| 16397 | case ALC880_MIC_EVENT: |
| 16398 | alc663_m51va_mic_automute(codec); |
| 16399 | break; |
| 16400 | } |
| 16401 | } |
| 16402 | |
| 16403 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16404 | { |
| 16405 | alc663_m51va_speaker_automute(codec); |
| 16406 | alc663_m51va_mic_automute(codec); |
| 16407 | } |
| 16408 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16409 | /* ***************** Mode1 ******************************/ |
| 16410 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16411 | unsigned int res) |
| 16412 | { |
| 16413 | switch (res >> 26) { |
| 16414 | case ALC880_HP_EVENT: |
| 16415 | alc663_m51va_speaker_automute(codec); |
| 16416 | break; |
| 16417 | case ALC880_MIC_EVENT: |
| 16418 | alc662_eeepc_mic_automute(codec); |
| 16419 | break; |
| 16420 | } |
| 16421 | } |
| 16422 | |
| 16423 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16424 | { |
| 16425 | alc663_m51va_speaker_automute(codec); |
| 16426 | alc662_eeepc_mic_automute(codec); |
| 16427 | } |
| 16428 | /* ***************** Mode2 ******************************/ |
| 16429 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16430 | unsigned int res) |
| 16431 | { |
| 16432 | switch (res >> 26) { |
| 16433 | case ALC880_HP_EVENT: |
| 16434 | alc662_f5z_speaker_automute(codec); |
| 16435 | break; |
| 16436 | case ALC880_MIC_EVENT: |
| 16437 | alc662_eeepc_mic_automute(codec); |
| 16438 | break; |
| 16439 | } |
| 16440 | } |
| 16441 | |
| 16442 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16443 | { |
| 16444 | alc662_f5z_speaker_automute(codec); |
| 16445 | alc662_eeepc_mic_automute(codec); |
| 16446 | } |
| 16447 | /* ***************** Mode3 ******************************/ |
| 16448 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16449 | unsigned int res) |
| 16450 | { |
| 16451 | switch (res >> 26) { |
| 16452 | case ALC880_HP_EVENT: |
| 16453 | alc663_two_hp_m1_speaker_automute(codec); |
| 16454 | break; |
| 16455 | case ALC880_MIC_EVENT: |
| 16456 | alc662_eeepc_mic_automute(codec); |
| 16457 | break; |
| 16458 | } |
| 16459 | } |
| 16460 | |
| 16461 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16462 | { |
| 16463 | alc663_two_hp_m1_speaker_automute(codec); |
| 16464 | alc662_eeepc_mic_automute(codec); |
| 16465 | } |
| 16466 | /* ***************** Mode4 ******************************/ |
| 16467 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16468 | unsigned int res) |
| 16469 | { |
| 16470 | switch (res >> 26) { |
| 16471 | case ALC880_HP_EVENT: |
| 16472 | alc663_21jd_two_speaker_automute(codec); |
| 16473 | break; |
| 16474 | case ALC880_MIC_EVENT: |
| 16475 | alc662_eeepc_mic_automute(codec); |
| 16476 | break; |
| 16477 | } |
| 16478 | } |
| 16479 | |
| 16480 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16481 | { |
| 16482 | alc663_21jd_two_speaker_automute(codec); |
| 16483 | alc662_eeepc_mic_automute(codec); |
| 16484 | } |
| 16485 | /* ***************** Mode5 ******************************/ |
| 16486 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16487 | unsigned int res) |
| 16488 | { |
| 16489 | switch (res >> 26) { |
| 16490 | case ALC880_HP_EVENT: |
| 16491 | alc663_15jd_two_speaker_automute(codec); |
| 16492 | break; |
| 16493 | case ALC880_MIC_EVENT: |
| 16494 | alc662_eeepc_mic_automute(codec); |
| 16495 | break; |
| 16496 | } |
| 16497 | } |
| 16498 | |
| 16499 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16500 | { |
| 16501 | alc663_15jd_two_speaker_automute(codec); |
| 16502 | alc662_eeepc_mic_automute(codec); |
| 16503 | } |
| 16504 | /* ***************** Mode6 ******************************/ |
| 16505 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16506 | unsigned int res) |
| 16507 | { |
| 16508 | switch (res >> 26) { |
| 16509 | case ALC880_HP_EVENT: |
| 16510 | alc663_two_hp_m2_speaker_automute(codec); |
| 16511 | break; |
| 16512 | case ALC880_MIC_EVENT: |
| 16513 | alc662_eeepc_mic_automute(codec); |
| 16514 | break; |
| 16515 | } |
| 16516 | } |
| 16517 | |
| 16518 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16519 | { |
| 16520 | alc663_two_hp_m2_speaker_automute(codec); |
| 16521 | alc662_eeepc_mic_automute(codec); |
| 16522 | } |
| 16523 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16524 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16525 | { |
| 16526 | unsigned int present; |
| 16527 | unsigned char bits; |
| 16528 | |
| 16529 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16530 | AC_VERB_GET_PIN_SENSE, 0) |
| 16531 | & AC_PINSENSE_PRESENCE; |
| 16532 | bits = present ? HDA_AMP_MUTE : 0; |
| 16533 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16534 | HDA_AMP_MUTE, bits); |
| 16535 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16536 | HDA_AMP_MUTE, bits); |
| 16537 | } |
| 16538 | |
| 16539 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16540 | { |
| 16541 | unsigned int present; |
| 16542 | unsigned char bits; |
| 16543 | |
| 16544 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16545 | AC_VERB_GET_PIN_SENSE, 0) |
| 16546 | & AC_PINSENSE_PRESENCE; |
| 16547 | bits = present ? HDA_AMP_MUTE : 0; |
| 16548 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16549 | HDA_AMP_MUTE, bits); |
| 16550 | } |
| 16551 | |
| 16552 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16553 | unsigned int res) |
| 16554 | { |
| 16555 | switch (res >> 26) { |
| 16556 | case ALC880_HP_EVENT: |
| 16557 | alc663_g71v_hp_automute(codec); |
| 16558 | break; |
| 16559 | case ALC880_FRONT_EVENT: |
| 16560 | alc663_g71v_front_automute(codec); |
| 16561 | break; |
| 16562 | case ALC880_MIC_EVENT: |
| 16563 | alc662_eeepc_mic_automute(codec); |
| 16564 | break; |
| 16565 | } |
| 16566 | } |
| 16567 | |
| 16568 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16569 | { |
| 16570 | alc663_g71v_front_automute(codec); |
| 16571 | alc663_g71v_hp_automute(codec); |
| 16572 | alc662_eeepc_mic_automute(codec); |
| 16573 | } |
| 16574 | |
| 16575 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16576 | unsigned int res) |
| 16577 | { |
| 16578 | switch (res >> 26) { |
| 16579 | case ALC880_HP_EVENT: |
| 16580 | alc663_m51va_speaker_automute(codec); |
| 16581 | break; |
| 16582 | case ALC880_MIC_EVENT: |
| 16583 | alc662_eeepc_mic_automute(codec); |
| 16584 | break; |
| 16585 | } |
| 16586 | } |
| 16587 | |
| 16588 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16589 | { |
| 16590 | alc663_m51va_speaker_automute(codec); |
| 16591 | alc662_eeepc_mic_automute(codec); |
| 16592 | } |
| 16593 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16594 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16595 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16596 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16597 | |
| 16598 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16599 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16600 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16601 | |
| 16602 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16603 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16604 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16605 | { } /* end */ |
| 16606 | }; |
| 16607 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16608 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16609 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16610 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16611 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16612 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16613 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16614 | |
| 16615 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16616 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16617 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16618 | |
| 16619 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16620 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16621 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16622 | { } /* end */ |
| 16623 | }; |
| 16624 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16625 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16626 | #define alc662_loopbacks alc880_loopbacks |
| 16627 | #endif |
| 16628 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16629 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16630 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16631 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16632 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16633 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16634 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16635 | |
| 16636 | /* |
| 16637 | * configuration and preset |
| 16638 | */ |
| 16639 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16640 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16641 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16642 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16643 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16644 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16645 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16646 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16647 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16648 | [ALC663_ASUS_M51VA] = "m51va", |
| 16649 | [ALC663_ASUS_G71V] = "g71v", |
| 16650 | [ALC663_ASUS_H13] = "h13", |
| 16651 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16652 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16653 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16654 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16655 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16656 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16657 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16658 | [ALC272_DELL] = "dell", |
| 16659 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16660 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16661 | [ALC662_AUTO] = "auto", |
| 16662 | }; |
| 16663 | |
| 16664 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16665 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16666 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16667 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16668 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16669 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16670 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16671 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16672 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16673 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16674 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16675 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16676 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16677 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16678 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16679 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16680 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16681 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16682 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16683 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16684 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16685 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16686 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16687 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16688 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16689 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16690 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16691 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16692 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16693 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16694 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16695 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16696 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16697 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16698 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16699 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16700 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16701 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16702 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16703 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16704 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16705 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16706 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16707 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16708 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16709 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16710 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16711 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16712 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16713 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16714 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16715 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16716 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16717 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16718 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16719 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16720 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16721 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16722 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16723 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16724 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16725 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16726 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16727 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16728 | {} |
| 16729 | }; |
| 16730 | |
| 16731 | static struct alc_config_preset alc662_presets[] = { |
| 16732 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16733 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16734 | .init_verbs = { alc662_init_verbs }, |
| 16735 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16736 | .dac_nids = alc662_dac_nids, |
| 16737 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16738 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16739 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16740 | .channel_mode = alc662_3ST_2ch_modes, |
| 16741 | .input_mux = &alc662_capture_source, |
| 16742 | }, |
| 16743 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16744 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16745 | .init_verbs = { alc662_init_verbs }, |
| 16746 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16747 | .dac_nids = alc662_dac_nids, |
| 16748 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16749 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16750 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16751 | .channel_mode = alc662_3ST_6ch_modes, |
| 16752 | .need_dac_fix = 1, |
| 16753 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16754 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16755 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16756 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16757 | .init_verbs = { alc662_init_verbs }, |
| 16758 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16759 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16760 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16761 | .channel_mode = alc662_3ST_6ch_modes, |
| 16762 | .need_dac_fix = 1, |
| 16763 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16764 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16765 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16766 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16767 | .init_verbs = { alc662_init_verbs }, |
| 16768 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16769 | .dac_nids = alc662_dac_nids, |
| 16770 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16771 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16772 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16773 | .channel_mode = alc662_5stack_modes, |
| 16774 | .input_mux = &alc662_capture_source, |
| 16775 | }, |
| 16776 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16777 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16778 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16779 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16780 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16781 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16782 | .channel_mode = alc662_3ST_2ch_modes, |
| 16783 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16784 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16785 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16786 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16787 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16788 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16789 | .init_verbs = { alc662_init_verbs, |
| 16790 | alc662_eeepc_sue_init_verbs }, |
| 16791 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16792 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16793 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16794 | .channel_mode = alc662_3ST_2ch_modes, |
| 16795 | .input_mux = &alc662_eeepc_capture_source, |
| 16796 | .unsol_event = alc662_eeepc_unsol_event, |
| 16797 | .init_hook = alc662_eeepc_inithook, |
| 16798 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16799 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16800 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16801 | alc662_chmode_mixer }, |
| 16802 | .init_verbs = { alc662_init_verbs, |
| 16803 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16804 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16805 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16806 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16807 | .channel_mode = alc662_3ST_6ch_modes, |
| 16808 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16809 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16810 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16811 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16812 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16813 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16814 | .init_verbs = { alc662_init_verbs, |
| 16815 | alc662_ecs_init_verbs }, |
| 16816 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16817 | .dac_nids = alc662_dac_nids, |
| 16818 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16819 | .channel_mode = alc662_3ST_2ch_modes, |
| 16820 | .input_mux = &alc662_eeepc_capture_source, |
| 16821 | .unsol_event = alc662_eeepc_unsol_event, |
| 16822 | .init_hook = alc662_eeepc_inithook, |
| 16823 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16824 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16825 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16826 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16827 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16828 | .dac_nids = alc662_dac_nids, |
| 16829 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16830 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16831 | .channel_mode = alc662_3ST_2ch_modes, |
| 16832 | .input_mux = &alc663_m51va_capture_source, |
| 16833 | .unsol_event = alc663_m51va_unsol_event, |
| 16834 | .init_hook = alc663_m51va_inithook, |
| 16835 | }, |
| 16836 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16837 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16838 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16839 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16840 | .dac_nids = alc662_dac_nids, |
| 16841 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16842 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16843 | .channel_mode = alc662_3ST_2ch_modes, |
| 16844 | .input_mux = &alc662_eeepc_capture_source, |
| 16845 | .unsol_event = alc663_g71v_unsol_event, |
| 16846 | .init_hook = alc663_g71v_inithook, |
| 16847 | }, |
| 16848 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16849 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16850 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16851 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16852 | .dac_nids = alc662_dac_nids, |
| 16853 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16854 | .channel_mode = alc662_3ST_2ch_modes, |
| 16855 | .input_mux = &alc663_m51va_capture_source, |
| 16856 | .unsol_event = alc663_m51va_unsol_event, |
| 16857 | .init_hook = alc663_m51va_inithook, |
| 16858 | }, |
| 16859 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16860 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16861 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16862 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16863 | .dac_nids = alc662_dac_nids, |
| 16864 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16865 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16866 | .channel_mode = alc662_3ST_6ch_modes, |
| 16867 | .input_mux = &alc663_capture_source, |
| 16868 | .unsol_event = alc663_g50v_unsol_event, |
| 16869 | .init_hook = alc663_g50v_inithook, |
| 16870 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16871 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16872 | .mixers = { alc663_m51va_mixer }, |
| 16873 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16874 | .init_verbs = { alc662_init_verbs, |
| 16875 | alc663_21jd_amic_init_verbs }, |
| 16876 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16877 | .hp_nid = 0x03, |
| 16878 | .dac_nids = alc662_dac_nids, |
| 16879 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16880 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16881 | .channel_mode = alc662_3ST_2ch_modes, |
| 16882 | .input_mux = &alc662_eeepc_capture_source, |
| 16883 | .unsol_event = alc663_mode1_unsol_event, |
| 16884 | .init_hook = alc663_mode1_inithook, |
| 16885 | }, |
| 16886 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16887 | .mixers = { alc662_1bjd_mixer }, |
| 16888 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16889 | .init_verbs = { alc662_init_verbs, |
| 16890 | alc662_1bjd_amic_init_verbs }, |
| 16891 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16892 | .dac_nids = alc662_dac_nids, |
| 16893 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16894 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16895 | .channel_mode = alc662_3ST_2ch_modes, |
| 16896 | .input_mux = &alc662_eeepc_capture_source, |
| 16897 | .unsol_event = alc662_mode2_unsol_event, |
| 16898 | .init_hook = alc662_mode2_inithook, |
| 16899 | }, |
| 16900 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16901 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16902 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16903 | .init_verbs = { alc662_init_verbs, |
| 16904 | alc663_two_hp_amic_m1_init_verbs }, |
| 16905 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16906 | .hp_nid = 0x03, |
| 16907 | .dac_nids = alc662_dac_nids, |
| 16908 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16909 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16910 | .channel_mode = alc662_3ST_2ch_modes, |
| 16911 | .input_mux = &alc662_eeepc_capture_source, |
| 16912 | .unsol_event = alc663_mode3_unsol_event, |
| 16913 | .init_hook = alc663_mode3_inithook, |
| 16914 | }, |
| 16915 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16916 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16917 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16918 | .init_verbs = { alc662_init_verbs, |
| 16919 | alc663_21jd_amic_init_verbs}, |
| 16920 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16921 | .hp_nid = 0x03, |
| 16922 | .dac_nids = alc662_dac_nids, |
| 16923 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16924 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16925 | .channel_mode = alc662_3ST_2ch_modes, |
| 16926 | .input_mux = &alc662_eeepc_capture_source, |
| 16927 | .unsol_event = alc663_mode4_unsol_event, |
| 16928 | .init_hook = alc663_mode4_inithook, |
| 16929 | }, |
| 16930 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16931 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16932 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16933 | .init_verbs = { alc662_init_verbs, |
| 16934 | alc663_15jd_amic_init_verbs }, |
| 16935 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16936 | .hp_nid = 0x03, |
| 16937 | .dac_nids = alc662_dac_nids, |
| 16938 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16939 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16940 | .channel_mode = alc662_3ST_2ch_modes, |
| 16941 | .input_mux = &alc662_eeepc_capture_source, |
| 16942 | .unsol_event = alc663_mode5_unsol_event, |
| 16943 | .init_hook = alc663_mode5_inithook, |
| 16944 | }, |
| 16945 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16946 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16947 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16948 | .init_verbs = { alc662_init_verbs, |
| 16949 | alc663_two_hp_amic_m2_init_verbs }, |
| 16950 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16951 | .hp_nid = 0x03, |
| 16952 | .dac_nids = alc662_dac_nids, |
| 16953 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16954 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16955 | .channel_mode = alc662_3ST_2ch_modes, |
| 16956 | .input_mux = &alc662_eeepc_capture_source, |
| 16957 | .unsol_event = alc663_mode6_unsol_event, |
| 16958 | .init_hook = alc663_mode6_inithook, |
| 16959 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16960 | [ALC272_DELL] = { |
| 16961 | .mixers = { alc663_m51va_mixer }, |
| 16962 | .cap_mixer = alc272_auto_capture_mixer, |
| 16963 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16964 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16965 | .dac_nids = alc662_dac_nids, |
| 16966 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16967 | .adc_nids = alc272_adc_nids, |
| 16968 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16969 | .capsrc_nids = alc272_capsrc_nids, |
| 16970 | .channel_mode = alc662_3ST_2ch_modes, |
| 16971 | .input_mux = &alc663_m51va_capture_source, |
| 16972 | .unsol_event = alc663_m51va_unsol_event, |
| 16973 | .init_hook = alc663_m51va_inithook, |
| 16974 | }, |
| 16975 | [ALC272_DELL_ZM1] = { |
| 16976 | .mixers = { alc663_m51va_mixer }, |
| 16977 | .cap_mixer = alc662_auto_capture_mixer, |
| 16978 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16979 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16980 | .dac_nids = alc662_dac_nids, |
| 16981 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16982 | .adc_nids = alc662_adc_nids, |
| 16983 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16984 | .capsrc_nids = alc662_capsrc_nids, |
| 16985 | .channel_mode = alc662_3ST_2ch_modes, |
| 16986 | .input_mux = &alc663_m51va_capture_source, |
| 16987 | .unsol_event = alc663_m51va_unsol_event, |
| 16988 | .init_hook = alc663_m51va_inithook, |
| 16989 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16990 | [ALC272_SAMSUNG_NC10] = { |
| 16991 | .mixers = { alc272_nc10_mixer }, |
| 16992 | .init_verbs = { alc662_init_verbs, |
| 16993 | alc663_21jd_amic_init_verbs }, |
| 16994 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16995 | .dac_nids = alc272_dac_nids, |
| 16996 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16997 | .channel_mode = alc662_3ST_2ch_modes, |
| 16998 | .input_mux = &alc272_nc10_capture_source, |
| 16999 | .unsol_event = alc663_mode4_unsol_event, |
| 17000 | .init_hook = alc663_mode4_inithook, |
| 17001 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17002 | }; |
| 17003 | |
| 17004 | |
| 17005 | /* |
| 17006 | * BIOS auto configuration |
| 17007 | */ |
| 17008 | |
| 17009 | /* add playback controls from the parsed DAC table */ |
| 17010 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17011 | const struct auto_pin_cfg *cfg) |
| 17012 | { |
| 17013 | char name[32]; |
| 17014 | static const char *chname[4] = { |
| 17015 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17016 | }; |
| 17017 | hda_nid_t nid; |
| 17018 | int i, err; |
| 17019 | |
| 17020 | for (i = 0; i < cfg->line_outs; i++) { |
| 17021 | if (!spec->multiout.dac_nids[i]) |
| 17022 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17023 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17024 | if (i == 2) { |
| 17025 | /* Center/LFE */ |
| 17026 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17027 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17028 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17029 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17030 | if (err < 0) |
| 17031 | return err; |
| 17032 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17033 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17034 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17035 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17036 | if (err < 0) |
| 17037 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17038 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17039 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17040 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17041 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17042 | if (err < 0) |
| 17043 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17044 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17045 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17046 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17047 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17048 | if (err < 0) |
| 17049 | return err; |
| 17050 | } else { |
| 17051 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17052 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17053 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17054 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17055 | if (err < 0) |
| 17056 | return err; |
| 17057 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17058 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17059 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17060 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17061 | if (err < 0) |
| 17062 | return err; |
| 17063 | } |
| 17064 | } |
| 17065 | return 0; |
| 17066 | } |
| 17067 | |
| 17068 | /* add playback controls for speaker and HP outputs */ |
| 17069 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17070 | const char *pfx) |
| 17071 | { |
| 17072 | hda_nid_t nid; |
| 17073 | int err; |
| 17074 | char name[32]; |
| 17075 | |
| 17076 | if (!pin) |
| 17077 | return 0; |
| 17078 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17079 | if (pin == 0x17) { |
| 17080 | /* ALC663 has a mono output pin on 0x17 */ |
| 17081 | sprintf(name, "%s Playback Switch", pfx); |
| 17082 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17083 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17084 | return err; |
| 17085 | } |
| 17086 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17087 | if (alc880_is_fixed_pin(pin)) { |
| 17088 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17089 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17090 | /* specify the DAC as the extra output */ |
| 17091 | if (!spec->multiout.hp_nid) |
| 17092 | spec->multiout.hp_nid = nid; |
| 17093 | else |
| 17094 | spec->multiout.extra_out_nid[0] = nid; |
| 17095 | /* control HP volume/switch on the output mixer amp */ |
| 17096 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17097 | sprintf(name, "%s Playback Volume", pfx); |
| 17098 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17099 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17100 | if (err < 0) |
| 17101 | return err; |
| 17102 | sprintf(name, "%s Playback Switch", pfx); |
| 17103 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17104 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17105 | if (err < 0) |
| 17106 | return err; |
| 17107 | } else if (alc880_is_multi_pin(pin)) { |
| 17108 | /* set manual connection */ |
| 17109 | /* we have only a switch on HP-out PIN */ |
| 17110 | sprintf(name, "%s Playback Switch", pfx); |
| 17111 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17112 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17113 | if (err < 0) |
| 17114 | return err; |
| 17115 | } |
| 17116 | return 0; |
| 17117 | } |
| 17118 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17119 | /* return the index of the src widget from the connection list of the nid. |
| 17120 | * return -1 if not found |
| 17121 | */ |
| 17122 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 17123 | hda_nid_t src) |
| 17124 | { |
| 17125 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 17126 | int i, conns; |
| 17127 | |
| 17128 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 17129 | ARRAY_SIZE(conn_list)); |
| 17130 | if (conns < 0) |
| 17131 | return -1; |
| 17132 | for (i = 0; i < conns; i++) |
| 17133 | if (conn_list[i] == src) |
| 17134 | return i; |
| 17135 | return -1; |
| 17136 | } |
| 17137 | |
| 17138 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17139 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17140 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17141 | return (pincap & AC_PINCAP_IN) != 0; |
| 17142 | } |
| 17143 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17144 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17145 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17146 | const struct auto_pin_cfg *cfg) |
| 17147 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17148 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17149 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17150 | int i, err, idx; |
| 17151 | |
| 17152 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17153 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 17154 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 17155 | cfg->input_pins[i]); |
| 17156 | if (idx >= 0) { |
| 17157 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17158 | auto_pin_cfg_labels[i], |
| 17159 | idx, 0x0b); |
| 17160 | if (err < 0) |
| 17161 | return err; |
| 17162 | } |
| 17163 | idx = alc662_input_pin_idx(codec, 0x22, |
| 17164 | cfg->input_pins[i]); |
| 17165 | if (idx >= 0) { |
| 17166 | imux->items[imux->num_items].label = |
| 17167 | auto_pin_cfg_labels[i]; |
| 17168 | imux->items[imux->num_items].index = idx; |
| 17169 | imux->num_items++; |
| 17170 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17171 | } |
| 17172 | } |
| 17173 | return 0; |
| 17174 | } |
| 17175 | |
| 17176 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17177 | hda_nid_t nid, int pin_type, |
| 17178 | int dac_idx) |
| 17179 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17180 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17181 | /* need the manual connection? */ |
| 17182 | if (alc880_is_multi_pin(nid)) { |
| 17183 | struct alc_spec *spec = codec->spec; |
| 17184 | int idx = alc880_multi_pin_idx(nid); |
| 17185 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17186 | AC_VERB_SET_CONNECT_SEL, |
| 17187 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17188 | } |
| 17189 | } |
| 17190 | |
| 17191 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17192 | { |
| 17193 | struct alc_spec *spec = codec->spec; |
| 17194 | int i; |
| 17195 | |
| 17196 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17197 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17198 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17199 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17200 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17201 | i); |
| 17202 | } |
| 17203 | } |
| 17204 | |
| 17205 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17206 | { |
| 17207 | struct alc_spec *spec = codec->spec; |
| 17208 | hda_nid_t pin; |
| 17209 | |
| 17210 | pin = spec->autocfg.hp_pins[0]; |
| 17211 | if (pin) /* connect to front */ |
| 17212 | /* use dac 0 */ |
| 17213 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17214 | pin = spec->autocfg.speaker_pins[0]; |
| 17215 | if (pin) |
| 17216 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17217 | } |
| 17218 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17219 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17220 | |
| 17221 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17222 | { |
| 17223 | struct alc_spec *spec = codec->spec; |
| 17224 | int i; |
| 17225 | |
| 17226 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17227 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17228 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17229 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17230 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17231 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17232 | snd_hda_codec_write(codec, nid, 0, |
| 17233 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17234 | AMP_OUT_MUTE); |
| 17235 | } |
| 17236 | } |
| 17237 | } |
| 17238 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17239 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17240 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17241 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17242 | { |
| 17243 | struct alc_spec *spec = codec->spec; |
| 17244 | int err; |
| 17245 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17246 | |
| 17247 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17248 | alc662_ignore); |
| 17249 | if (err < 0) |
| 17250 | return err; |
| 17251 | if (!spec->autocfg.line_outs) |
| 17252 | return 0; /* can't find valid BIOS pin config */ |
| 17253 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17254 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17255 | if (err < 0) |
| 17256 | return err; |
| 17257 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17258 | if (err < 0) |
| 17259 | return err; |
| 17260 | err = alc662_auto_create_extra_out(spec, |
| 17261 | spec->autocfg.speaker_pins[0], |
| 17262 | "Speaker"); |
| 17263 | if (err < 0) |
| 17264 | return err; |
| 17265 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17266 | "Headphone"); |
| 17267 | if (err < 0) |
| 17268 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17269 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17270 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17271 | return err; |
| 17272 | |
| 17273 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17274 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17275 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17276 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17277 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17278 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17279 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17280 | |
| 17281 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17282 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17283 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17284 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17285 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17286 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17287 | |
| 17288 | err = alc_auto_add_mic_boost(codec); |
| 17289 | if (err < 0) |
| 17290 | return err; |
| 17291 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17292 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17293 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17294 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17295 | } |
| 17296 | |
| 17297 | /* additional initialization for auto-configuration model */ |
| 17298 | static void alc662_auto_init(struct hda_codec *codec) |
| 17299 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17300 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17301 | alc662_auto_init_multi_out(codec); |
| 17302 | alc662_auto_init_hp_out(codec); |
| 17303 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17304 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17305 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17306 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17307 | } |
| 17308 | |
| 17309 | static int patch_alc662(struct hda_codec *codec) |
| 17310 | { |
| 17311 | struct alc_spec *spec; |
| 17312 | int err, board_config; |
| 17313 | |
| 17314 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17315 | if (!spec) |
| 17316 | return -ENOMEM; |
| 17317 | |
| 17318 | codec->spec = spec; |
| 17319 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17320 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17321 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17322 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17323 | alc662_models, |
| 17324 | alc662_cfg_tbl); |
| 17325 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17326 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17327 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17328 | board_config = ALC662_AUTO; |
| 17329 | } |
| 17330 | |
| 17331 | if (board_config == ALC662_AUTO) { |
| 17332 | /* automatic parse from the BIOS config */ |
| 17333 | err = alc662_parse_auto_config(codec); |
| 17334 | if (err < 0) { |
| 17335 | alc_free(codec); |
| 17336 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17337 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17338 | printk(KERN_INFO |
| 17339 | "hda_codec: Cannot set up configuration " |
| 17340 | "from BIOS. Using base mode...\n"); |
| 17341 | board_config = ALC662_3ST_2ch_DIG; |
| 17342 | } |
| 17343 | } |
| 17344 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17345 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17346 | if (err < 0) { |
| 17347 | alc_free(codec); |
| 17348 | return err; |
| 17349 | } |
| 17350 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17351 | if (board_config != ALC662_AUTO) |
| 17352 | setup_preset(spec, &alc662_presets[board_config]); |
| 17353 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17354 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17355 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17356 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17357 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17358 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17359 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17360 | spec->adc_nids = alc662_adc_nids; |
| 17361 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17362 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17363 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17364 | if (!spec->cap_mixer) |
| 17365 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17366 | if (codec->vendor_id == 0x10ec0662) |
| 17367 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17368 | else |
| 17369 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17370 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17371 | spec->vmaster_nid = 0x02; |
| 17372 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17373 | codec->patch_ops = alc_patch_ops; |
| 17374 | if (board_config == ALC662_AUTO) |
| 17375 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17376 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17377 | if (!spec->loopback.amplist) |
| 17378 | spec->loopback.amplist = alc662_loopbacks; |
| 17379 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17380 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17381 | |
| 17382 | return 0; |
| 17383 | } |
| 17384 | |
| 17385 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17386 | * patch entries |
| 17387 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17388 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17389 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17390 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17391 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17392 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17393 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17394 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17395 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17396 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17397 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17398 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17399 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17400 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17401 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17402 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17403 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17404 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17405 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17406 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17407 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17408 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17409 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17410 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17411 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17412 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17413 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17414 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17415 | .patch = patch_alc882 }, |
| 17416 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17417 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17418 | {} /* terminator */ |
| 17419 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17420 | |
| 17421 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17422 | |
| 17423 | MODULE_LICENSE("GPL"); |
| 17424 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17425 | |
| 17426 | static struct hda_codec_preset_list realtek_list = { |
| 17427 | .preset = snd_hda_preset_realtek, |
| 17428 | .owner = THIS_MODULE, |
| 17429 | }; |
| 17430 | |
| 17431 | static int __init patch_realtek_init(void) |
| 17432 | { |
| 17433 | return snd_hda_add_codec_preset(&realtek_list); |
| 17434 | } |
| 17435 | |
| 17436 | static void __exit patch_realtek_exit(void) |
| 17437 | { |
| 17438 | snd_hda_delete_codec_preset(&realtek_list); |
| 17439 | } |
| 17440 | |
| 17441 | module_init(patch_realtek_init) |
| 17442 | module_exit(patch_realtek_exit) |