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 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 261 | struct alc_mic_route { |
| 262 | hda_nid_t pin; |
| 263 | unsigned char mux_idx; |
| 264 | unsigned char amix_idx; |
| 265 | }; |
| 266 | |
| 267 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | struct alc_spec { |
| 270 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 271 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 273 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 274 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 276 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 277 | * don't forget NULL |
| 278 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 279 | */ |
| 280 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 282 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | struct hda_pcm_stream *stream_analog_playback; |
| 284 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 285 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 286 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 288 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | struct hda_pcm_stream *stream_digital_playback; |
| 290 | struct hda_pcm_stream *stream_digital_capture; |
| 291 | |
| 292 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 293 | struct hda_multi_out multiout; /* playback set-up |
| 294 | * max_channels, dacs must be set |
| 295 | * dig_out_nid and hp_nid are optional |
| 296 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 297 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 298 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 299 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
| 301 | /* capture */ |
| 302 | unsigned int num_adc_nids; |
| 303 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 304 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 305 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | |
| 307 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 308 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | const struct hda_input_mux *input_mux; |
| 310 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 311 | struct alc_mic_route ext_mic; |
| 312 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
| 314 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 315 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 317 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 318 | int const_channel_count; |
| 319 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
| 321 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 322 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 323 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 324 | /* dynamic controls, init_verbs and input_mux */ |
| 325 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 326 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 327 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 328 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 329 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 330 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 331 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 332 | /* hooks */ |
| 333 | void (*init_hook)(struct hda_codec *codec); |
| 334 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 335 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 336 | /* for pin sensing */ |
| 337 | unsigned int sense_updated: 1; |
| 338 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 339 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 340 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 341 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 342 | /* other flags */ |
| 343 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 344 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 345 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 346 | /* for virtual master */ |
| 347 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 348 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 349 | struct hda_loopback_check loopback; |
| 350 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 351 | |
| 352 | /* for PLL fix */ |
| 353 | hda_nid_t pll_nid; |
| 354 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 355 | }; |
| 356 | |
| 357 | /* |
| 358 | * configuration template - to be copied to the spec instance |
| 359 | */ |
| 360 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 361 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 362 | * with spec |
| 363 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 364 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 365 | const struct hda_verb *init_verbs[5]; |
| 366 | unsigned int num_dacs; |
| 367 | hda_nid_t *dac_nids; |
| 368 | hda_nid_t dig_out_nid; /* optional */ |
| 369 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 370 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 371 | unsigned int num_adc_nids; |
| 372 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 373 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 374 | hda_nid_t dig_in_nid; |
| 375 | unsigned int num_channel_mode; |
| 376 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 377 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 378 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 379 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 380 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 381 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 382 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 383 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 384 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 385 | struct hda_amp_list *loopbacks; |
| 386 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | }; |
| 388 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | |
| 390 | /* |
| 391 | * input MUX handling |
| 392 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 393 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 394 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | { |
| 396 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 397 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 398 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 399 | if (mux_idx >= spec->num_mux_defs) |
| 400 | mux_idx = 0; |
| 401 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | } |
| 403 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 404 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 405 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | { |
| 407 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 408 | struct alc_spec *spec = codec->spec; |
| 409 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 410 | |
| 411 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 412 | return 0; |
| 413 | } |
| 414 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 415 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 416 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | { |
| 418 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 419 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 420 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 422 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 423 | hda_nid_t nid = spec->capsrc_nids ? |
| 424 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 425 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 427 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 428 | imux = &spec->input_mux[mux_idx]; |
| 429 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 430 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 431 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 432 | /* Matrix-mixer style (e.g. ALC882) */ |
| 433 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 434 | unsigned int i, idx; |
| 435 | |
| 436 | idx = ucontrol->value.enumerated.item[0]; |
| 437 | if (idx >= imux->num_items) |
| 438 | idx = imux->num_items - 1; |
| 439 | if (*cur_val == idx) |
| 440 | return 0; |
| 441 | for (i = 0; i < imux->num_items; i++) { |
| 442 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 443 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 444 | imux->items[i].index, |
| 445 | HDA_AMP_MUTE, v); |
| 446 | } |
| 447 | *cur_val = idx; |
| 448 | return 1; |
| 449 | } else { |
| 450 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 451 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 452 | &spec->cur_mux[adc_idx]); |
| 453 | } |
| 454 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 455 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | /* |
| 457 | * channel mode setting |
| 458 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 460 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | { |
| 462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 463 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 464 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 465 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | { |
| 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 473 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 474 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 475 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | } |
| 477 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 478 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 479 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | { |
| 481 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 482 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 483 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 484 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 485 | &spec->ext_channel_count); |
| 486 | if (err >= 0 && !spec->const_channel_count) { |
| 487 | spec->multiout.max_channels = spec->ext_channel_count; |
| 488 | if (spec->need_dac_fix) |
| 489 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 490 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 491 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | } |
| 493 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 495 | * 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] | 496 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | * being part of a format specifier. Maximum allowed length of a value is |
| 498 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 499 | * |
| 500 | * Note: some retasking pin complexes seem to ignore requests for input |
| 501 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 502 | * are requested. Therefore order this list so that this behaviour will not |
| 503 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 504 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 505 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 506 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 507 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 508 | "Mic 50pc bias", "Mic 80pc bias", |
| 509 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | }; |
| 511 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 512 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 513 | }; |
| 514 | /* 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] | 515 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 516 | * addition, "input" pins may or may not process the mic bias option |
| 517 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 518 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 519 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 520 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 521 | #define ALC_PIN_DIR_IN 0x00 |
| 522 | #define ALC_PIN_DIR_OUT 0x01 |
| 523 | #define ALC_PIN_DIR_INOUT 0x02 |
| 524 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 525 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 526 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 527 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | * For each direction the minimum and maximum values are given. |
| 529 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 530 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 531 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 532 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 533 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 534 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 535 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | }; |
| 537 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 538 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 539 | #define alc_pin_mode_n_items(_dir) \ |
| 540 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 541 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 542 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 543 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 544 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 545 | unsigned int item_num = uinfo->value.enumerated.item; |
| 546 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 547 | |
| 548 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 549 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 550 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 551 | |
| 552 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 553 | item_num = alc_pin_mode_min(dir); |
| 554 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 555 | return 0; |
| 556 | } |
| 557 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 559 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 560 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 563 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 564 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 565 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 566 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 567 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 568 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 569 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 570 | /* Find enumerated value for current pinctl setting */ |
| 571 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 572 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 573 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | *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] | 575 | return 0; |
| 576 | } |
| 577 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 578 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 579 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 580 | { |
| 581 | signed int change; |
| 582 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 583 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 584 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 585 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 586 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 587 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 588 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 589 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 590 | 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] | 591 | val = alc_pin_mode_min(dir); |
| 592 | |
| 593 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 594 | if (change) { |
| 595 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 596 | snd_hda_codec_write_cache(codec, nid, 0, |
| 597 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 598 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 599 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 600 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 601 | * for the requested pin mode. Enum values of 2 or less are |
| 602 | * input modes. |
| 603 | * |
| 604 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 605 | * reduces noise slightly (particularly on input) so we'll |
| 606 | * do it. However, having both input and output buffers |
| 607 | * enabled simultaneously doesn't seem to be problematic if |
| 608 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 609 | */ |
| 610 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 611 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 612 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 613 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 614 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 615 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 616 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 617 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 618 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 619 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 620 | } |
| 621 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 622 | return change; |
| 623 | } |
| 624 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 625 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 626 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 627 | .info = alc_pin_mode_info, \ |
| 628 | .get = alc_pin_mode_get, \ |
| 629 | .put = alc_pin_mode_put, \ |
| 630 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 631 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 632 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 633 | * together using a mask with more than one bit set. This control is |
| 634 | * currently used only by the ALC260 test model. At this stage they are not |
| 635 | * needed for any "production" models. |
| 636 | */ |
| 637 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 638 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 639 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 640 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 641 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 642 | { |
| 643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 644 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 645 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 646 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 647 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 648 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 649 | |
| 650 | *valp = (val & mask) != 0; |
| 651 | return 0; |
| 652 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 653 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 654 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 655 | { |
| 656 | signed int change; |
| 657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 658 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 659 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 660 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 661 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 662 | AC_VERB_GET_GPIO_DATA, |
| 663 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 664 | |
| 665 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 666 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 667 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 668 | gpio_data &= ~mask; |
| 669 | else |
| 670 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 671 | snd_hda_codec_write_cache(codec, nid, 0, |
| 672 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 673 | |
| 674 | return change; |
| 675 | } |
| 676 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 677 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 678 | .info = alc_gpio_data_info, \ |
| 679 | .get = alc_gpio_data_get, \ |
| 680 | .put = alc_gpio_data_put, \ |
| 681 | .private_value = nid | (mask<<16) } |
| 682 | #endif /* CONFIG_SND_DEBUG */ |
| 683 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 684 | /* A switch control to allow the enabling of the digital IO pins on the |
| 685 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 686 | * to provide something in the test model allowing digital outputs to be |
| 687 | * identified if present. If models are found which can utilise these |
| 688 | * outputs a more complete mixer control can be devised for those models if |
| 689 | * necessary. |
| 690 | */ |
| 691 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 692 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 693 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 694 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 695 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 696 | { |
| 697 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 698 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 699 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 700 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 701 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 702 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 703 | |
| 704 | *valp = (val & mask) != 0; |
| 705 | return 0; |
| 706 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 707 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 708 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 709 | { |
| 710 | signed int change; |
| 711 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 712 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 713 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 714 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 715 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 716 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 717 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 718 | |
| 719 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 720 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 721 | if (val==0) |
| 722 | ctrl_data &= ~mask; |
| 723 | else |
| 724 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 725 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 726 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 727 | |
| 728 | return change; |
| 729 | } |
| 730 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 731 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 732 | .info = alc_spdif_ctrl_info, \ |
| 733 | .get = alc_spdif_ctrl_get, \ |
| 734 | .put = alc_spdif_ctrl_put, \ |
| 735 | .private_value = nid | (mask<<16) } |
| 736 | #endif /* CONFIG_SND_DEBUG */ |
| 737 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 738 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 739 | * Again, this is only used in the ALC26x test models to help identify when |
| 740 | * the EAPD line must be asserted for features to work. |
| 741 | */ |
| 742 | #ifdef CONFIG_SND_DEBUG |
| 743 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 744 | |
| 745 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 746 | struct snd_ctl_elem_value *ucontrol) |
| 747 | { |
| 748 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 749 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 750 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 751 | long *valp = ucontrol->value.integer.value; |
| 752 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 753 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 754 | |
| 755 | *valp = (val & mask) != 0; |
| 756 | return 0; |
| 757 | } |
| 758 | |
| 759 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 760 | struct snd_ctl_elem_value *ucontrol) |
| 761 | { |
| 762 | int change; |
| 763 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 764 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 765 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 766 | long val = *ucontrol->value.integer.value; |
| 767 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 768 | AC_VERB_GET_EAPD_BTLENABLE, |
| 769 | 0x00); |
| 770 | |
| 771 | /* Set/unset the masked control bit(s) as needed */ |
| 772 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 773 | if (!val) |
| 774 | ctrl_data &= ~mask; |
| 775 | else |
| 776 | ctrl_data |= mask; |
| 777 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 778 | ctrl_data); |
| 779 | |
| 780 | return change; |
| 781 | } |
| 782 | |
| 783 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 784 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 785 | .info = alc_eapd_ctrl_info, \ |
| 786 | .get = alc_eapd_ctrl_get, \ |
| 787 | .put = alc_eapd_ctrl_put, \ |
| 788 | .private_value = nid | (mask<<16) } |
| 789 | #endif /* CONFIG_SND_DEBUG */ |
| 790 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 791 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 792 | * set up the input pin config (depending on the given auto-pin type) |
| 793 | */ |
| 794 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 795 | int auto_pin_type) |
| 796 | { |
| 797 | unsigned int val = PIN_IN; |
| 798 | |
| 799 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 800 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 801 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 802 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 803 | if (pincap & AC_PINCAP_VREF_80) |
| 804 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 805 | else if (pincap & AC_PINCAP_VREF_50) |
| 806 | val = PIN_VREF50; |
| 807 | else if (pincap & AC_PINCAP_VREF_100) |
| 808 | val = PIN_VREF100; |
| 809 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 810 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 811 | } |
| 812 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 813 | } |
| 814 | |
| 815 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 816 | */ |
| 817 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 818 | { |
| 819 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 820 | return; |
| 821 | spec->mixers[spec->num_mixers++] = mix; |
| 822 | } |
| 823 | |
| 824 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 825 | { |
| 826 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 827 | return; |
| 828 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 829 | } |
| 830 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 831 | #ifdef CONFIG_PROC_FS |
| 832 | /* |
| 833 | * hook for proc |
| 834 | */ |
| 835 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 836 | struct hda_codec *codec, hda_nid_t nid) |
| 837 | { |
| 838 | int coeff; |
| 839 | |
| 840 | if (nid != 0x20) |
| 841 | return; |
| 842 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 843 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 844 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 845 | AC_VERB_GET_COEF_INDEX, 0); |
| 846 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 847 | } |
| 848 | #else |
| 849 | #define print_realtek_coef NULL |
| 850 | #endif |
| 851 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 852 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 853 | * set up from the preset table |
| 854 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 855 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 856 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 857 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 858 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | int i; |
| 860 | |
| 861 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 862 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 863 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 864 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 865 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 866 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 867 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 868 | spec->channel_mode = preset->channel_mode; |
| 869 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 870 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 871 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 872 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 873 | if (preset->const_channel_count) |
| 874 | spec->multiout.max_channels = preset->const_channel_count; |
| 875 | else |
| 876 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 877 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 878 | |
| 879 | spec->multiout.num_dacs = preset->num_dacs; |
| 880 | spec->multiout.dac_nids = preset->dac_nids; |
| 881 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 882 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 883 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 884 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 885 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 886 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 887 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 888 | spec->input_mux = preset->input_mux; |
| 889 | |
| 890 | spec->num_adc_nids = preset->num_adc_nids; |
| 891 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 892 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 893 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 894 | |
| 895 | spec->unsol_event = preset->unsol_event; |
| 896 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 897 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 898 | spec->loopback.amplist = preset->loopbacks; |
| 899 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 900 | |
| 901 | if (preset->setup) |
| 902 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 903 | } |
| 904 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 905 | /* Enable GPIO mask and set output */ |
| 906 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 907 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 908 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 909 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 910 | { } |
| 911 | }; |
| 912 | |
| 913 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 914 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 915 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 916 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 917 | { } |
| 918 | }; |
| 919 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 920 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 921 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 922 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 923 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 924 | { } |
| 925 | }; |
| 926 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 927 | /* |
| 928 | * Fix hardware PLL issue |
| 929 | * On some codecs, the analog PLL gating control must be off while |
| 930 | * the default value is 1. |
| 931 | */ |
| 932 | static void alc_fix_pll(struct hda_codec *codec) |
| 933 | { |
| 934 | struct alc_spec *spec = codec->spec; |
| 935 | unsigned int val; |
| 936 | |
| 937 | if (!spec->pll_nid) |
| 938 | return; |
| 939 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 940 | spec->pll_coef_idx); |
| 941 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 942 | AC_VERB_GET_PROC_COEF, 0); |
| 943 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 944 | spec->pll_coef_idx); |
| 945 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 946 | val & ~(1 << spec->pll_coef_bit)); |
| 947 | } |
| 948 | |
| 949 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 950 | unsigned int coef_idx, unsigned int coef_bit) |
| 951 | { |
| 952 | struct alc_spec *spec = codec->spec; |
| 953 | spec->pll_nid = nid; |
| 954 | spec->pll_coef_idx = coef_idx; |
| 955 | spec->pll_coef_bit = coef_bit; |
| 956 | alc_fix_pll(codec); |
| 957 | } |
| 958 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 959 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 960 | { |
| 961 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 962 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 963 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 964 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 965 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 966 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 967 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 968 | 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] | 969 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 970 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 971 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 972 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 973 | nid = spec->autocfg.speaker_pins[i]; |
| 974 | if (!nid) |
| 975 | break; |
| 976 | snd_hda_codec_write(codec, nid, 0, |
| 977 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 978 | spec->jack_present ? 0 : PIN_OUT); |
| 979 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 980 | } |
| 981 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 982 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 983 | hda_nid_t nid) |
| 984 | { |
| 985 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 986 | int i, nums; |
| 987 | |
| 988 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 989 | for (i = 0; i < nums; i++) |
| 990 | if (conn[i] == nid) |
| 991 | return i; |
| 992 | return -1; |
| 993 | } |
| 994 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 995 | static void alc_mic_automute(struct hda_codec *codec) |
| 996 | { |
| 997 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 998 | struct alc_mic_route *dead, *alive; |
| 999 | unsigned int present, type; |
| 1000 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1001 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1002 | if (!spec->auto_mic) |
| 1003 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1004 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1005 | return; |
| 1006 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1007 | return; |
| 1008 | |
| 1009 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1010 | |
| 1011 | present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0, |
| 1012 | AC_VERB_GET_PIN_SENSE, 0); |
| 1013 | present &= AC_PINSENSE_PRESENCE; |
| 1014 | if (present) { |
| 1015 | alive = &spec->ext_mic; |
| 1016 | dead = &spec->int_mic; |
| 1017 | } else { |
| 1018 | alive = &spec->int_mic; |
| 1019 | dead = &spec->ext_mic; |
| 1020 | } |
| 1021 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1022 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1023 | if (type == AC_WID_AUD_MIX) { |
| 1024 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1025 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1026 | alive->mux_idx, |
| 1027 | HDA_AMP_MUTE, 0); |
| 1028 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1029 | dead->mux_idx, |
| 1030 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1031 | } else { |
| 1032 | /* MUX style (e.g. ALC880) */ |
| 1033 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1034 | AC_VERB_SET_CONNECT_SEL, |
| 1035 | alive->mux_idx); |
| 1036 | } |
| 1037 | |
| 1038 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1039 | } |
| 1040 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1041 | /* unsolicited event for HP jack sensing */ |
| 1042 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1043 | { |
| 1044 | if (codec->vendor_id == 0x10ec0880) |
| 1045 | res >>= 28; |
| 1046 | else |
| 1047 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1048 | switch (res) { |
| 1049 | case ALC880_HP_EVENT: |
| 1050 | alc_automute_pin(codec); |
| 1051 | break; |
| 1052 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1053 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1054 | break; |
| 1055 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1056 | } |
| 1057 | |
| 1058 | static void alc_inithook(struct hda_codec *codec) |
| 1059 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1060 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1061 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1062 | } |
| 1063 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1064 | /* additional initialization for ALC888 variants */ |
| 1065 | static void alc888_coef_init(struct hda_codec *codec) |
| 1066 | { |
| 1067 | unsigned int tmp; |
| 1068 | |
| 1069 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1070 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1071 | 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] | 1072 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1073 | /* alc888S-VC */ |
| 1074 | snd_hda_codec_read(codec, 0x20, 0, |
| 1075 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1076 | else |
| 1077 | /* alc888-VB */ |
| 1078 | snd_hda_codec_read(codec, 0x20, 0, |
| 1079 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1080 | } |
| 1081 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1082 | static void alc889_coef_init(struct hda_codec *codec) |
| 1083 | { |
| 1084 | unsigned int tmp; |
| 1085 | |
| 1086 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1087 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1088 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1089 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1090 | } |
| 1091 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1092 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1093 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1094 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1095 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1096 | switch (type) { |
| 1097 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1098 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1099 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1100 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1101 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1102 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1103 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1104 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1105 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1106 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1107 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1108 | case 0x10ec0260: |
| 1109 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1110 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1111 | snd_hda_codec_write(codec, 0x10, 0, |
| 1112 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1113 | break; |
| 1114 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1115 | case 0x10ec0267: |
| 1116 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1117 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1118 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1119 | case 0x10ec0660: |
| 1120 | case 0x10ec0662: |
| 1121 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1122 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1123 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1124 | snd_hda_codec_write(codec, 0x14, 0, |
| 1125 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1126 | snd_hda_codec_write(codec, 0x15, 0, |
| 1127 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1128 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1129 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | switch (codec->vendor_id) { |
| 1131 | case 0x10ec0260: |
| 1132 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1133 | AC_VERB_SET_COEF_INDEX, 7); |
| 1134 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1135 | AC_VERB_GET_PROC_COEF, 0); |
| 1136 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1137 | AC_VERB_SET_COEF_INDEX, 7); |
| 1138 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1139 | AC_VERB_SET_PROC_COEF, |
| 1140 | tmp | 0x2010); |
| 1141 | break; |
| 1142 | case 0x10ec0262: |
| 1143 | case 0x10ec0880: |
| 1144 | case 0x10ec0882: |
| 1145 | case 0x10ec0883: |
| 1146 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1147 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1148 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1149 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1150 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1151 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1152 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1153 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1154 | case 0x10ec0267: |
| 1155 | case 0x10ec0268: |
| 1156 | snd_hda_codec_write(codec, 0x20, 0, |
| 1157 | AC_VERB_SET_COEF_INDEX, 7); |
| 1158 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1159 | AC_VERB_GET_PROC_COEF, 0); |
| 1160 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1161 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1162 | snd_hda_codec_write(codec, 0x20, 0, |
| 1163 | AC_VERB_SET_PROC_COEF, |
| 1164 | tmp | 0x3000); |
| 1165 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1166 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1167 | break; |
| 1168 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1169 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1170 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1171 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1172 | { |
| 1173 | struct alc_spec *spec = codec->spec; |
| 1174 | |
| 1175 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1176 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1177 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1178 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1179 | if (spec->autocfg.line_out_pins[0] && |
| 1180 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1181 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1182 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1183 | else |
| 1184 | return; |
| 1185 | } |
| 1186 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1187 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1188 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1189 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1190 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1191 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1192 | spec->unsol_event = alc_sku_unsol_event; |
| 1193 | } |
| 1194 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1195 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1196 | { |
| 1197 | struct alc_spec *spec = codec->spec; |
| 1198 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1199 | hda_nid_t fixed, ext; |
| 1200 | int i; |
| 1201 | |
| 1202 | /* there must be only two mic inputs exclusively */ |
| 1203 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1204 | if (cfg->input_pins[i]) |
| 1205 | return; |
| 1206 | |
| 1207 | fixed = ext = 0; |
| 1208 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1209 | hda_nid_t nid = cfg->input_pins[i]; |
| 1210 | unsigned int defcfg; |
| 1211 | if (!nid) |
| 1212 | return; |
| 1213 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1214 | switch (get_defcfg_connect(defcfg)) { |
| 1215 | case AC_JACK_PORT_FIXED: |
| 1216 | if (fixed) |
| 1217 | return; /* already occupied */ |
| 1218 | fixed = nid; |
| 1219 | break; |
| 1220 | case AC_JACK_PORT_COMPLEX: |
| 1221 | if (ext) |
| 1222 | return; /* already occupied */ |
| 1223 | ext = nid; |
| 1224 | break; |
| 1225 | default: |
| 1226 | return; /* invalid entry */ |
| 1227 | } |
| 1228 | } |
| 1229 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1230 | return; /* no unsol support */ |
| 1231 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1232 | ext, fixed); |
| 1233 | spec->ext_mic.pin = ext; |
| 1234 | spec->int_mic.pin = fixed; |
| 1235 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1236 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1237 | spec->auto_mic = 1; |
| 1238 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1239 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1240 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1241 | spec->unsol_event = alc_sku_unsol_event; |
| 1242 | } |
| 1243 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1244 | /* check subsystem ID and set up device-specific initialization; |
| 1245 | * return 1 if initialized, 0 if invalid SSID |
| 1246 | */ |
| 1247 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1248 | * 31 ~ 16 : Manufacture ID |
| 1249 | * 15 ~ 8 : SKU ID |
| 1250 | * 7 ~ 0 : Assembly ID |
| 1251 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1252 | */ |
| 1253 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1254 | hda_nid_t porta, hda_nid_t porte, |
| 1255 | hda_nid_t portd) |
| 1256 | { |
| 1257 | unsigned int ass, tmp, i; |
| 1258 | unsigned nid; |
| 1259 | struct alc_spec *spec = codec->spec; |
| 1260 | |
| 1261 | ass = codec->subsystem_id & 0xffff; |
| 1262 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1263 | goto do_sku; |
| 1264 | |
| 1265 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1266 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1267 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1268 | * 29~21 : reserve |
| 1269 | * 20 : PCBEEP input |
| 1270 | * 19~16 : Check sum (15:1) |
| 1271 | * 15~1 : Custom |
| 1272 | * 0 : override |
| 1273 | */ |
| 1274 | nid = 0x1d; |
| 1275 | if (codec->vendor_id == 0x10ec0260) |
| 1276 | nid = 0x17; |
| 1277 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1278 | snd_printd("realtek: No valid SSID, " |
| 1279 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1280 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1281 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1282 | return 0; |
| 1283 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1284 | return 0; |
| 1285 | |
| 1286 | /* check sum */ |
| 1287 | tmp = 0; |
| 1288 | for (i = 1; i < 16; i++) { |
| 1289 | if ((ass >> i) & 1) |
| 1290 | tmp++; |
| 1291 | } |
| 1292 | if (((ass >> 16) & 0xf) != tmp) |
| 1293 | return 0; |
| 1294 | do_sku: |
| 1295 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1296 | ass & 0xffff, codec->vendor_id); |
| 1297 | /* |
| 1298 | * 0 : override |
| 1299 | * 1 : Swap Jack |
| 1300 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1301 | * 3~5 : External Amplifier control |
| 1302 | * 7~6 : Reserved |
| 1303 | */ |
| 1304 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1305 | switch (tmp) { |
| 1306 | case 1: |
| 1307 | spec->init_amp = ALC_INIT_GPIO1; |
| 1308 | break; |
| 1309 | case 3: |
| 1310 | spec->init_amp = ALC_INIT_GPIO2; |
| 1311 | break; |
| 1312 | case 7: |
| 1313 | spec->init_amp = ALC_INIT_GPIO3; |
| 1314 | break; |
| 1315 | case 5: |
| 1316 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1317 | break; |
| 1318 | } |
| 1319 | |
| 1320 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1321 | * when the external headphone out jack is plugged" |
| 1322 | */ |
| 1323 | if (!(ass & 0x8000)) |
| 1324 | return 1; |
| 1325 | /* |
| 1326 | * 10~8 : Jack location |
| 1327 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1328 | * 14~13: Resvered |
| 1329 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1330 | * when the external headphone out jack is plugged" |
| 1331 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1332 | if (!spec->autocfg.hp_pins[0]) { |
| 1333 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1334 | if (tmp == 0) |
| 1335 | spec->autocfg.hp_pins[0] = porta; |
| 1336 | else if (tmp == 1) |
| 1337 | spec->autocfg.hp_pins[0] = porte; |
| 1338 | else if (tmp == 2) |
| 1339 | spec->autocfg.hp_pins[0] = portd; |
| 1340 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1341 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1342 | } |
| 1343 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1344 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1345 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1346 | return 1; |
| 1347 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1348 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1349 | static void alc_ssid_check(struct hda_codec *codec, |
| 1350 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1351 | { |
| 1352 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1353 | struct alc_spec *spec = codec->spec; |
| 1354 | snd_printd("realtek: " |
| 1355 | "Enable default setup for auto mode as fallback\n"); |
| 1356 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1357 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1358 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1359 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1360 | } |
| 1361 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1362 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1363 | * Fix-up pin default configurations |
| 1364 | */ |
| 1365 | |
| 1366 | struct alc_pincfg { |
| 1367 | hda_nid_t nid; |
| 1368 | u32 val; |
| 1369 | }; |
| 1370 | |
| 1371 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1372 | const struct snd_pci_quirk *quirk, |
| 1373 | const struct alc_pincfg **pinfix) |
| 1374 | { |
| 1375 | const struct alc_pincfg *cfg; |
| 1376 | |
| 1377 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1378 | if (!quirk) |
| 1379 | return; |
| 1380 | |
| 1381 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1382 | for (; cfg->nid; cfg++) |
| 1383 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1384 | } |
| 1385 | |
| 1386 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1387 | * ALC888 |
| 1388 | */ |
| 1389 | |
| 1390 | /* |
| 1391 | * 2ch mode |
| 1392 | */ |
| 1393 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1394 | /* Mic-in jack as mic in */ |
| 1395 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1396 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1397 | /* Line-in jack as Line in */ |
| 1398 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1399 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1400 | /* Line-Out as Front */ |
| 1401 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1402 | { } /* end */ |
| 1403 | }; |
| 1404 | |
| 1405 | /* |
| 1406 | * 4ch mode |
| 1407 | */ |
| 1408 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1409 | /* Mic-in jack as mic in */ |
| 1410 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1411 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1412 | /* Line-in jack as Surround */ |
| 1413 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1414 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1415 | /* Line-Out as Front */ |
| 1416 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1417 | { } /* end */ |
| 1418 | }; |
| 1419 | |
| 1420 | /* |
| 1421 | * 6ch mode |
| 1422 | */ |
| 1423 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1424 | /* Mic-in jack as CLFE */ |
| 1425 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1426 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1427 | /* Line-in jack as Surround */ |
| 1428 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1429 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1430 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1431 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1432 | { } /* end */ |
| 1433 | }; |
| 1434 | |
| 1435 | /* |
| 1436 | * 8ch mode |
| 1437 | */ |
| 1438 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1439 | /* Mic-in jack as CLFE */ |
| 1440 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1441 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1442 | /* Line-in jack as Surround */ |
| 1443 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1444 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1445 | /* Line-Out as Side */ |
| 1446 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1447 | { } /* end */ |
| 1448 | }; |
| 1449 | |
| 1450 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1451 | { 2, alc888_4ST_ch2_intel_init }, |
| 1452 | { 4, alc888_4ST_ch4_intel_init }, |
| 1453 | { 6, alc888_4ST_ch6_intel_init }, |
| 1454 | { 8, alc888_4ST_ch8_intel_init }, |
| 1455 | }; |
| 1456 | |
| 1457 | /* |
| 1458 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1459 | */ |
| 1460 | |
| 1461 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1462 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1463 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1464 | /* Connect Internal HP to Front */ |
| 1465 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1466 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1467 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1468 | /* Connect Bass HP to Front */ |
| 1469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1470 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1471 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1472 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1473 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1474 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1475 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1476 | /* Connect Mic jack to CLFE */ |
| 1477 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1478 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1479 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1480 | /* Connect Line-in jack to Surround */ |
| 1481 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1482 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1483 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1484 | /* Connect HP out jack to Front */ |
| 1485 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1486 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1487 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1488 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1489 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1490 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1491 | {} |
| 1492 | }; |
| 1493 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1494 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1495 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1496 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1497 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1498 | hda_nid_t nid; |
| 1499 | int i; |
| 1500 | |
| 1501 | spec->jack_present = 0; |
| 1502 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1503 | nid = spec->autocfg.hp_pins[i]; |
| 1504 | if (!nid) |
| 1505 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1506 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1507 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1508 | snd_hda_codec_read(codec, nid, 0, |
| 1509 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1510 | val = snd_hda_codec_read(codec, nid, 0, |
| 1511 | AC_VERB_GET_PIN_SENSE, 0); |
| 1512 | if (val & AC_PINSENSE_PRESENCE) { |
| 1513 | spec->jack_present = 1; |
| 1514 | break; |
| 1515 | } |
| 1516 | } |
| 1517 | |
| 1518 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1519 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1520 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1521 | nid = spec->autocfg.speaker_pins[i]; |
| 1522 | if (!nid) |
| 1523 | break; |
| 1524 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1525 | HDA_AMP_MUTE, mute); |
| 1526 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1527 | } |
| 1528 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1529 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1530 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1531 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1532 | if (codec->vendor_id == 0x10ec0880) |
| 1533 | res >>= 28; |
| 1534 | else |
| 1535 | res >>= 26; |
| 1536 | if (res == ALC880_HP_EVENT) |
| 1537 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1538 | } |
| 1539 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1540 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1541 | { |
| 1542 | struct alc_spec *spec = codec->spec; |
| 1543 | |
| 1544 | spec->autocfg.hp_pins[0] = 0x15; |
| 1545 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1546 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1547 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1548 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1549 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1550 | } |
| 1551 | |
| 1552 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1553 | { |
| 1554 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1555 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1556 | } |
| 1557 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1558 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1559 | { |
| 1560 | struct alc_spec *spec = codec->spec; |
| 1561 | |
| 1562 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1563 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1564 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1565 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1566 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1567 | |
| 1568 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1569 | * ALC888 Acer Aspire 4930G model |
| 1570 | */ |
| 1571 | |
| 1572 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1573 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1574 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1575 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1576 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1577 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1578 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1579 | /* Connect Internal HP to front */ |
| 1580 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1581 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1582 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1583 | /* Connect HP out to front */ |
| 1584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1585 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1586 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1587 | { } |
| 1588 | }; |
| 1589 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1590 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1591 | * ALC888 Acer Aspire 6530G model |
| 1592 | */ |
| 1593 | |
| 1594 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1595 | /* Bias voltage on for external mic port */ |
| 1596 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1597 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1598 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1599 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1601 | /* Enable unsolicited event for HP jack */ |
| 1602 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1603 | /* Enable speaker output */ |
| 1604 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1605 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1606 | /* Enable headphone output */ |
| 1607 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1608 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1609 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1610 | { } |
| 1611 | }; |
| 1612 | |
| 1613 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1614 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1615 | */ |
| 1616 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1617 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1618 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1619 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1620 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1622 | /* Enable unsolicited event for HP jack */ |
| 1623 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1624 | /* Connect Internal Front to Front */ |
| 1625 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1626 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1627 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1628 | /* Connect Internal Rear to Rear */ |
| 1629 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1630 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1631 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1632 | /* Connect Internal CLFE to CLFE */ |
| 1633 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1634 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1635 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1636 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1637 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1639 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1640 | /* Enable all DACs */ |
| 1641 | /* DAC DISABLE/MUTE 1? */ |
| 1642 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1643 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1644 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1645 | /* DAC DISABLE/MUTE 2? */ |
| 1646 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1647 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1648 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1649 | /* Enable amplifiers */ |
| 1650 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1651 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1652 | /* DMIC fix |
| 1653 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1654 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1655 | * makes the signal become a difference/sum signal instead of standard |
| 1656 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1657 | * codec replicate the sum signal to both channels, turning it into a |
| 1658 | * normal mono mic. |
| 1659 | */ |
| 1660 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1661 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1662 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1663 | { } |
| 1664 | }; |
| 1665 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1666 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1667 | /* Front mic only available on one ADC */ |
| 1668 | { |
| 1669 | .num_items = 4, |
| 1670 | .items = { |
| 1671 | { "Mic", 0x0 }, |
| 1672 | { "Line", 0x2 }, |
| 1673 | { "CD", 0x4 }, |
| 1674 | { "Front Mic", 0xb }, |
| 1675 | }, |
| 1676 | }, |
| 1677 | { |
| 1678 | .num_items = 3, |
| 1679 | .items = { |
| 1680 | { "Mic", 0x0 }, |
| 1681 | { "Line", 0x2 }, |
| 1682 | { "CD", 0x4 }, |
| 1683 | }, |
| 1684 | } |
| 1685 | }; |
| 1686 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1687 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1688 | /* Interal mic only available on one ADC */ |
| 1689 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1690 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1691 | .items = { |
| 1692 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1693 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1694 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1695 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1696 | { "Int Mic", 0xb }, |
| 1697 | }, |
| 1698 | }, |
| 1699 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1700 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1701 | .items = { |
| 1702 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1703 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1704 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1705 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1706 | }, |
| 1707 | } |
| 1708 | }; |
| 1709 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1710 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1711 | /* Digital mic only available on first "ADC" */ |
| 1712 | { |
| 1713 | .num_items = 5, |
| 1714 | .items = { |
| 1715 | { "Mic", 0x0 }, |
| 1716 | { "Line", 0x2 }, |
| 1717 | { "CD", 0x4 }, |
| 1718 | { "Front Mic", 0xb }, |
| 1719 | { "Input Mix", 0xa }, |
| 1720 | }, |
| 1721 | }, |
| 1722 | { |
| 1723 | .num_items = 4, |
| 1724 | .items = { |
| 1725 | { "Mic", 0x0 }, |
| 1726 | { "Line", 0x2 }, |
| 1727 | { "CD", 0x4 }, |
| 1728 | { "Input Mix", 0xa }, |
| 1729 | }, |
| 1730 | }, |
| 1731 | { |
| 1732 | .num_items = 4, |
| 1733 | .items = { |
| 1734 | { "Mic", 0x0 }, |
| 1735 | { "Line", 0x2 }, |
| 1736 | { "CD", 0x4 }, |
| 1737 | { "Input Mix", 0xa }, |
| 1738 | }, |
| 1739 | } |
| 1740 | }; |
| 1741 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1742 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1743 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1744 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1745 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1746 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1747 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1748 | HDA_OUTPUT), |
| 1749 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1750 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1751 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1752 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1753 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1754 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1755 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1756 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1757 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1759 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1761 | { } /* end */ |
| 1762 | }; |
| 1763 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1764 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1765 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1766 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1767 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1768 | spec->autocfg.hp_pins[0] = 0x15; |
| 1769 | spec->autocfg.speaker_pins[0] = 0x14; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1770 | } |
| 1771 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1772 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1773 | { |
| 1774 | struct alc_spec *spec = codec->spec; |
| 1775 | |
| 1776 | spec->autocfg.hp_pins[0] = 0x15; |
| 1777 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1778 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1779 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1780 | } |
| 1781 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1782 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1783 | { |
| 1784 | struct alc_spec *spec = codec->spec; |
| 1785 | |
| 1786 | spec->autocfg.hp_pins[0] = 0x15; |
| 1787 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1788 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1789 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1790 | } |
| 1791 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1792 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1793 | * ALC880 3-stack model |
| 1794 | * |
| 1795 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1796 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1797 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1798 | */ |
| 1799 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1800 | static hda_nid_t alc880_dac_nids[4] = { |
| 1801 | /* front, rear, clfe, rear_surr */ |
| 1802 | 0x02, 0x05, 0x04, 0x03 |
| 1803 | }; |
| 1804 | |
| 1805 | static hda_nid_t alc880_adc_nids[3] = { |
| 1806 | /* ADC0-2 */ |
| 1807 | 0x07, 0x08, 0x09, |
| 1808 | }; |
| 1809 | |
| 1810 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1811 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1812 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1813 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1814 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1815 | /* ADC1-2 */ |
| 1816 | 0x08, 0x09, |
| 1817 | }; |
| 1818 | |
| 1819 | #define ALC880_DIGOUT_NID 0x06 |
| 1820 | #define ALC880_DIGIN_NID 0x0a |
| 1821 | |
| 1822 | static struct hda_input_mux alc880_capture_source = { |
| 1823 | .num_items = 4, |
| 1824 | .items = { |
| 1825 | { "Mic", 0x0 }, |
| 1826 | { "Front Mic", 0x3 }, |
| 1827 | { "Line", 0x2 }, |
| 1828 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1829 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1830 | }; |
| 1831 | |
| 1832 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1833 | /* 2ch mode */ |
| 1834 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1835 | /* set line-in to input, mute it */ |
| 1836 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1837 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1838 | /* set mic-in to input vref 80%, mute it */ |
| 1839 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1840 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1841 | { } /* end */ |
| 1842 | }; |
| 1843 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1844 | /* 6ch mode */ |
| 1845 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1846 | /* set line-in to output, unmute it */ |
| 1847 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1848 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1849 | /* set mic-in to output, unmute it */ |
| 1850 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1851 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1852 | { } /* end */ |
| 1853 | }; |
| 1854 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1855 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1856 | { 2, alc880_threestack_ch2_init }, |
| 1857 | { 6, alc880_threestack_ch6_init }, |
| 1858 | }; |
| 1859 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1860 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1861 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1862 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1863 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1864 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1865 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1866 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1867 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1868 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1872 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1875 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1876 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1877 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1878 | { |
| 1879 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1880 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1881 | .info = alc_ch_mode_info, |
| 1882 | .get = alc_ch_mode_get, |
| 1883 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1884 | }, |
| 1885 | { } /* end */ |
| 1886 | }; |
| 1887 | |
| 1888 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1889 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1890 | struct snd_ctl_elem_info *uinfo) |
| 1891 | { |
| 1892 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1893 | struct alc_spec *spec = codec->spec; |
| 1894 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1895 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1896 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1897 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1898 | HDA_INPUT); |
| 1899 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1900 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1901 | return err; |
| 1902 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1903 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1904 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1905 | unsigned int size, unsigned int __user *tlv) |
| 1906 | { |
| 1907 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1908 | struct alc_spec *spec = codec->spec; |
| 1909 | int err; |
| 1910 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1911 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1912 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1913 | HDA_INPUT); |
| 1914 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1915 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1916 | return err; |
| 1917 | } |
| 1918 | |
| 1919 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1920 | struct snd_ctl_elem_value *ucontrol); |
| 1921 | |
| 1922 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1923 | struct snd_ctl_elem_value *ucontrol, |
| 1924 | getput_call_t func) |
| 1925 | { |
| 1926 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1927 | struct alc_spec *spec = codec->spec; |
| 1928 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1929 | int err; |
| 1930 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1931 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1932 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1933 | 3, 0, HDA_INPUT); |
| 1934 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1935 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1936 | return err; |
| 1937 | } |
| 1938 | |
| 1939 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1940 | struct snd_ctl_elem_value *ucontrol) |
| 1941 | { |
| 1942 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1943 | snd_hda_mixer_amp_volume_get); |
| 1944 | } |
| 1945 | |
| 1946 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1947 | struct snd_ctl_elem_value *ucontrol) |
| 1948 | { |
| 1949 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1950 | snd_hda_mixer_amp_volume_put); |
| 1951 | } |
| 1952 | |
| 1953 | /* capture mixer elements */ |
| 1954 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1955 | |
| 1956 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1957 | struct snd_ctl_elem_value *ucontrol) |
| 1958 | { |
| 1959 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1960 | snd_hda_mixer_amp_switch_get); |
| 1961 | } |
| 1962 | |
| 1963 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1964 | struct snd_ctl_elem_value *ucontrol) |
| 1965 | { |
| 1966 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1967 | snd_hda_mixer_amp_switch_put); |
| 1968 | } |
| 1969 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1970 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1971 | { \ |
| 1972 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1973 | .name = "Capture Switch", \ |
| 1974 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1975 | .count = num, \ |
| 1976 | .info = alc_cap_sw_info, \ |
| 1977 | .get = alc_cap_sw_get, \ |
| 1978 | .put = alc_cap_sw_put, \ |
| 1979 | }, \ |
| 1980 | { \ |
| 1981 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1982 | .name = "Capture Volume", \ |
| 1983 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1984 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1985 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1986 | .count = num, \ |
| 1987 | .info = alc_cap_vol_info, \ |
| 1988 | .get = alc_cap_vol_get, \ |
| 1989 | .put = alc_cap_vol_put, \ |
| 1990 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1991 | } |
| 1992 | |
| 1993 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1994 | { \ |
| 1995 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1996 | /* .name = "Capture Source", */ \ |
| 1997 | .name = "Input Source", \ |
| 1998 | .count = num, \ |
| 1999 | .info = alc_mux_enum_info, \ |
| 2000 | .get = alc_mux_enum_get, \ |
| 2001 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2002 | } |
| 2003 | |
| 2004 | #define DEFINE_CAPMIX(num) \ |
| 2005 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2006 | _DEFINE_CAPMIX(num), \ |
| 2007 | _DEFINE_CAPSRC(num), \ |
| 2008 | { } /* end */ \ |
| 2009 | } |
| 2010 | |
| 2011 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2012 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2013 | _DEFINE_CAPMIX(num), \ |
| 2014 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2015 | } |
| 2016 | |
| 2017 | /* up to three ADCs */ |
| 2018 | DEFINE_CAPMIX(1); |
| 2019 | DEFINE_CAPMIX(2); |
| 2020 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2021 | DEFINE_CAPMIX_NOSRC(1); |
| 2022 | DEFINE_CAPMIX_NOSRC(2); |
| 2023 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2024 | |
| 2025 | /* |
| 2026 | * ALC880 5-stack model |
| 2027 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2028 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2029 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2030 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2031 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2032 | */ |
| 2033 | |
| 2034 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2035 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2036 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2037 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2038 | { } /* end */ |
| 2039 | }; |
| 2040 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2041 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2042 | /* 6ch mode */ |
| 2043 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2044 | /* set line-in to input, mute it */ |
| 2045 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2046 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2047 | { } /* end */ |
| 2048 | }; |
| 2049 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2050 | /* 8ch mode */ |
| 2051 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2052 | /* set line-in to output, unmute it */ |
| 2053 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2054 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2055 | { } /* end */ |
| 2056 | }; |
| 2057 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2058 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2059 | { 6, alc880_fivestack_ch6_init }, |
| 2060 | { 8, alc880_fivestack_ch8_init }, |
| 2061 | }; |
| 2062 | |
| 2063 | |
| 2064 | /* |
| 2065 | * ALC880 6-stack model |
| 2066 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2067 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2068 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2069 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2070 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2071 | */ |
| 2072 | |
| 2073 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2074 | /* front, rear, clfe, rear_surr */ |
| 2075 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2076 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2077 | |
| 2078 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2079 | .num_items = 4, |
| 2080 | .items = { |
| 2081 | { "Mic", 0x0 }, |
| 2082 | { "Front Mic", 0x1 }, |
| 2083 | { "Line", 0x2 }, |
| 2084 | { "CD", 0x4 }, |
| 2085 | }, |
| 2086 | }; |
| 2087 | |
| 2088 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2089 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2090 | { 8, NULL }, |
| 2091 | }; |
| 2092 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2093 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2094 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2095 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2096 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2097 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2098 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2099 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2100 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2101 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2103 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2105 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2106 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2107 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2110 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2111 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2112 | { |
| 2113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2114 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2115 | .info = alc_ch_mode_info, |
| 2116 | .get = alc_ch_mode_get, |
| 2117 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2118 | }, |
| 2119 | { } /* end */ |
| 2120 | }; |
| 2121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2122 | |
| 2123 | /* |
| 2124 | * ALC880 W810 model |
| 2125 | * |
| 2126 | * W810 has rear IO for: |
| 2127 | * Front (DAC 02) |
| 2128 | * Surround (DAC 03) |
| 2129 | * Center/LFE (DAC 04) |
| 2130 | * Digital out (06) |
| 2131 | * |
| 2132 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2133 | * 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] | 2134 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2135 | * There is a variable resistor to control the speaker or headphone |
| 2136 | * volume. This is a hardware-only device without a software API. |
| 2137 | * |
| 2138 | * Plugging headphones in will disable the internal speakers. This is |
| 2139 | * implemented in hardware, not via the driver using jack sense. In |
| 2140 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2141 | * disable both the speakers and headphones. |
| 2142 | * |
| 2143 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2144 | * These may not do anything useful with this driver yet, because I |
| 2145 | * haven't setup any initialization verbs for these yet... |
| 2146 | */ |
| 2147 | |
| 2148 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2149 | /* front, rear/surround, clfe */ |
| 2150 | 0x02, 0x03, 0x04 |
| 2151 | }; |
| 2152 | |
| 2153 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2154 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2155 | { 6, NULL } |
| 2156 | }; |
| 2157 | |
| 2158 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2159 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2160 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2161 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2162 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2163 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2164 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2165 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2166 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2167 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2168 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2169 | { } /* end */ |
| 2170 | }; |
| 2171 | |
| 2172 | |
| 2173 | /* |
| 2174 | * Z710V model |
| 2175 | * |
| 2176 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2177 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2178 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2179 | */ |
| 2180 | |
| 2181 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2182 | 0x02 |
| 2183 | }; |
| 2184 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2185 | |
| 2186 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2187 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2188 | { 2, NULL } |
| 2189 | }; |
| 2190 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2191 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2194 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2195 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2200 | { } /* end */ |
| 2201 | }; |
| 2202 | |
| 2203 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2204 | /* |
| 2205 | * ALC880 F1734 model |
| 2206 | * |
| 2207 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2208 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2209 | */ |
| 2210 | |
| 2211 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2212 | 0x03 |
| 2213 | }; |
| 2214 | #define ALC880_F1734_HP_DAC 0x02 |
| 2215 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2216 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2217 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2218 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2219 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2220 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2221 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2222 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2225 | { } /* end */ |
| 2226 | }; |
| 2227 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2228 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2229 | .num_items = 2, |
| 2230 | .items = { |
| 2231 | { "Mic", 0x1 }, |
| 2232 | { "CD", 0x4 }, |
| 2233 | }, |
| 2234 | }; |
| 2235 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2236 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2237 | /* |
| 2238 | * ALC880 ASUS model |
| 2239 | * |
| 2240 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2241 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2242 | * Mic = 0x18, Line = 0x1a |
| 2243 | */ |
| 2244 | |
| 2245 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2246 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2247 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2248 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2249 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2250 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2251 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2252 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2253 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2254 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2255 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2256 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2257 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2258 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2259 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2260 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2261 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2262 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2263 | { |
| 2264 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2265 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2266 | .info = alc_ch_mode_info, |
| 2267 | .get = alc_ch_mode_get, |
| 2268 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2269 | }, |
| 2270 | { } /* end */ |
| 2271 | }; |
| 2272 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2273 | /* |
| 2274 | * ALC880 ASUS W1V model |
| 2275 | * |
| 2276 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2277 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2278 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2279 | */ |
| 2280 | |
| 2281 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2282 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2283 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | { } /* end */ |
| 2286 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2287 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2288 | /* TCL S700 */ |
| 2289 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2291 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2292 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2293 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2294 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2296 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2297 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2298 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2299 | { } /* end */ |
| 2300 | }; |
| 2301 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2302 | /* Uniwill */ |
| 2303 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2304 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2305 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2306 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2307 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2308 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2309 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2310 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2311 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2312 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2313 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2314 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2315 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2318 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2319 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2320 | { |
| 2321 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2322 | .name = "Channel Mode", |
| 2323 | .info = alc_ch_mode_info, |
| 2324 | .get = alc_ch_mode_get, |
| 2325 | .put = alc_ch_mode_put, |
| 2326 | }, |
| 2327 | { } /* end */ |
| 2328 | }; |
| 2329 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2330 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2331 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2332 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2333 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2334 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2335 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2336 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2337 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2338 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2339 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2340 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2341 | { } /* end */ |
| 2342 | }; |
| 2343 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2344 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2345 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2346 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2347 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2348 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2350 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2351 | { } /* end */ |
| 2352 | }; |
| 2353 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2354 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2355 | * virtual master controls |
| 2356 | */ |
| 2357 | |
| 2358 | /* |
| 2359 | * slave controls for virtual master |
| 2360 | */ |
| 2361 | static const char *alc_slave_vols[] = { |
| 2362 | "Front Playback Volume", |
| 2363 | "Surround Playback Volume", |
| 2364 | "Center Playback Volume", |
| 2365 | "LFE Playback Volume", |
| 2366 | "Side Playback Volume", |
| 2367 | "Headphone Playback Volume", |
| 2368 | "Speaker Playback Volume", |
| 2369 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2370 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2371 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2372 | NULL, |
| 2373 | }; |
| 2374 | |
| 2375 | static const char *alc_slave_sws[] = { |
| 2376 | "Front Playback Switch", |
| 2377 | "Surround Playback Switch", |
| 2378 | "Center Playback Switch", |
| 2379 | "LFE Playback Switch", |
| 2380 | "Side Playback Switch", |
| 2381 | "Headphone Playback Switch", |
| 2382 | "Speaker Playback Switch", |
| 2383 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2384 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2385 | NULL, |
| 2386 | }; |
| 2387 | |
| 2388 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2389 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2390 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2391 | |
| 2392 | static void alc_free_kctls(struct hda_codec *codec); |
| 2393 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2394 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2395 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2396 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2397 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2398 | { } /* end */ |
| 2399 | }; |
| 2400 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2401 | static int alc_build_controls(struct hda_codec *codec) |
| 2402 | { |
| 2403 | struct alc_spec *spec = codec->spec; |
| 2404 | int err; |
| 2405 | int i; |
| 2406 | |
| 2407 | for (i = 0; i < spec->num_mixers; i++) { |
| 2408 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2409 | if (err < 0) |
| 2410 | return err; |
| 2411 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2412 | if (spec->cap_mixer) { |
| 2413 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2414 | if (err < 0) |
| 2415 | return err; |
| 2416 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2417 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2418 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2419 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2420 | if (err < 0) |
| 2421 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2422 | if (!spec->no_analog) { |
| 2423 | err = snd_hda_create_spdif_share_sw(codec, |
| 2424 | &spec->multiout); |
| 2425 | if (err < 0) |
| 2426 | return err; |
| 2427 | spec->multiout.share_spdif = 1; |
| 2428 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2429 | } |
| 2430 | if (spec->dig_in_nid) { |
| 2431 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2432 | if (err < 0) |
| 2433 | return err; |
| 2434 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2435 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2436 | /* create beep controls if needed */ |
| 2437 | if (spec->beep_amp) { |
| 2438 | struct snd_kcontrol_new *knew; |
| 2439 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2440 | struct snd_kcontrol *kctl; |
| 2441 | kctl = snd_ctl_new1(knew, codec); |
| 2442 | if (!kctl) |
| 2443 | return -ENOMEM; |
| 2444 | kctl->private_value = spec->beep_amp; |
| 2445 | err = snd_hda_ctl_add(codec, kctl); |
| 2446 | if (err < 0) |
| 2447 | return err; |
| 2448 | } |
| 2449 | } |
| 2450 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2451 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2452 | if (!spec->no_analog && |
| 2453 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2454 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2455 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2456 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2457 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2458 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2459 | if (err < 0) |
| 2460 | return err; |
| 2461 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2462 | if (!spec->no_analog && |
| 2463 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2464 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2465 | NULL, alc_slave_sws); |
| 2466 | if (err < 0) |
| 2467 | return err; |
| 2468 | } |
| 2469 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2470 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2471 | return 0; |
| 2472 | } |
| 2473 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2474 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2475 | /* |
| 2476 | * initialize the codec volumes, etc |
| 2477 | */ |
| 2478 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2479 | /* |
| 2480 | * generic initialization of ADC, input mixers and output mixers |
| 2481 | */ |
| 2482 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2483 | /* |
| 2484 | * Unmute ADC0-2 and set the default input to mic-in |
| 2485 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2486 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2488 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2489 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2490 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2491 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2493 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2494 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2495 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2496 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2498 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2499 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2500 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2505 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2506 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2507 | /* |
| 2508 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2509 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2510 | /* set vol=0 to output mixers */ |
| 2511 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2512 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2513 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2514 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2515 | /* set up input amps for analog loopback */ |
| 2516 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2519 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2523 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2524 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2525 | |
| 2526 | { } |
| 2527 | }; |
| 2528 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2529 | /* |
| 2530 | * 3-stack pin configuration: |
| 2531 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2532 | */ |
| 2533 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2534 | /* |
| 2535 | * preset connection lists of input pins |
| 2536 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2537 | */ |
| 2538 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2539 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2540 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2541 | |
| 2542 | /* |
| 2543 | * Set pin mode and muting |
| 2544 | */ |
| 2545 | /* set front pin widgets 0x14 for output */ |
| 2546 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2547 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2548 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2549 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2550 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2551 | /* Mic2 (as headphone out) for HP output */ |
| 2552 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2553 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2554 | /* Line In pin widget for input */ |
| 2555 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2556 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2557 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2559 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2560 | /* CD pin widget for input */ |
| 2561 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2562 | |
| 2563 | { } |
| 2564 | }; |
| 2565 | |
| 2566 | /* |
| 2567 | * 5-stack pin configuration: |
| 2568 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2569 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2570 | */ |
| 2571 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2572 | /* |
| 2573 | * preset connection lists of input pins |
| 2574 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2575 | */ |
| 2576 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2577 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2578 | |
| 2579 | /* |
| 2580 | * Set pin mode and muting |
| 2581 | */ |
| 2582 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2583 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2584 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2585 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2586 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | /* unmute pins for output (no gain on this amp) */ |
| 2588 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2589 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2590 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2591 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2592 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2594 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2596 | /* Mic2 (as headphone out) for HP output */ |
| 2597 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2598 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2599 | /* Line In pin widget for input */ |
| 2600 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2601 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2602 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2603 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2604 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2605 | /* CD pin widget for input */ |
| 2606 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2607 | |
| 2608 | { } |
| 2609 | }; |
| 2610 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2611 | /* |
| 2612 | * W810 pin configuration: |
| 2613 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2614 | */ |
| 2615 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2616 | /* hphone/speaker input selector: front DAC */ |
| 2617 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2618 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2620 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2621 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2623 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2624 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2625 | |
| 2626 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2627 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2628 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2629 | { } |
| 2630 | }; |
| 2631 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | /* |
| 2633 | * Z71V pin configuration: |
| 2634 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2635 | */ |
| 2636 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2637 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2638 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2639 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2641 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2642 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2643 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2644 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2645 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2646 | |
| 2647 | { } |
| 2648 | }; |
| 2649 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2650 | /* |
| 2651 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2652 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2653 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2654 | */ |
| 2655 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2656 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2657 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2658 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2659 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2660 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2661 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2662 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2663 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2664 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2665 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2666 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2667 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2668 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2669 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2671 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2672 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2673 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2674 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2675 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2676 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2677 | { } |
| 2678 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2679 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2680 | /* |
| 2681 | * Uniwill pin configuration: |
| 2682 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2683 | * line = 0x1a |
| 2684 | */ |
| 2685 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2686 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2687 | |
| 2688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2689 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2690 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2692 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2693 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2694 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2695 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2698 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2700 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2701 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2702 | |
| 2703 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2704 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2705 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2706 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2707 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2708 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2709 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2710 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2711 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2712 | |
| 2713 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2714 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2715 | |
| 2716 | { } |
| 2717 | }; |
| 2718 | |
| 2719 | /* |
| 2720 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2721 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2722 | */ |
| 2723 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2724 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2725 | |
| 2726 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2727 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2728 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2730 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2731 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2732 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2733 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2734 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2735 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2737 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2738 | |
| 2739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2741 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2742 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2743 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2744 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2745 | |
| 2746 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2747 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2748 | |
| 2749 | { } |
| 2750 | }; |
| 2751 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2752 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2753 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2754 | { } |
| 2755 | }; |
| 2756 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2757 | /* auto-toggle front mic */ |
| 2758 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2759 | { |
| 2760 | unsigned int present; |
| 2761 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2762 | |
| 2763 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2764 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2765 | bits = present ? HDA_AMP_MUTE : 0; |
| 2766 | 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] | 2767 | } |
| 2768 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2769 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2770 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2771 | struct alc_spec *spec = codec->spec; |
| 2772 | |
| 2773 | spec->autocfg.hp_pins[0] = 0x14; |
| 2774 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2775 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2776 | } |
| 2777 | |
| 2778 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2779 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2780 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2781 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2782 | } |
| 2783 | |
| 2784 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2785 | unsigned int res) |
| 2786 | { |
| 2787 | /* Looks like the unsol event is incompatible with the standard |
| 2788 | * definition. 4bit tag is placed at 28 bit! |
| 2789 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2790 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2791 | case ALC880_MIC_EVENT: |
| 2792 | alc880_uniwill_mic_automute(codec); |
| 2793 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2794 | default: |
| 2795 | alc_automute_amp_unsol_event(codec, res); |
| 2796 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2797 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2798 | } |
| 2799 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2800 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2801 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2802 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2803 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2804 | spec->autocfg.hp_pins[0] = 0x14; |
| 2805 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2806 | } |
| 2807 | |
| 2808 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2809 | { |
| 2810 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2811 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2812 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2813 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2814 | present &= HDA_AMP_VOLMASK; |
| 2815 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2816 | HDA_AMP_VOLMASK, present); |
| 2817 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2818 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2819 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2820 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2821 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2822 | unsigned int res) |
| 2823 | { |
| 2824 | /* Looks like the unsol event is incompatible with the standard |
| 2825 | * definition. 4bit tag is placed at 28 bit! |
| 2826 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2827 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2828 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2829 | else |
| 2830 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2831 | } |
| 2832 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2833 | /* |
| 2834 | * F1734 pin configuration: |
| 2835 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2836 | */ |
| 2837 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2838 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2839 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2840 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2841 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2842 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2843 | |
| 2844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2848 | |
| 2849 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2850 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2851 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2852 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2853 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2854 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2855 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2856 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2857 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2858 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2859 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2860 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2861 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2862 | { } |
| 2863 | }; |
| 2864 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2865 | /* |
| 2866 | * ASUS pin configuration: |
| 2867 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2868 | */ |
| 2869 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2870 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2871 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2872 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2873 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2874 | |
| 2875 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2876 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2877 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2878 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2879 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2880 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2881 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2883 | |
| 2884 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2885 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2886 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2887 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2888 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2889 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2890 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2891 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2892 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2893 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2894 | { } |
| 2895 | }; |
| 2896 | |
| 2897 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2898 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2899 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2900 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2901 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2902 | /* Clevo m520g init */ |
| 2903 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2904 | /* headphone output */ |
| 2905 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2906 | /* line-out */ |
| 2907 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2908 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2909 | /* Line-in */ |
| 2910 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2911 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2912 | /* CD */ |
| 2913 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2914 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2915 | /* Mic1 (rear panel) */ |
| 2916 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2917 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2918 | /* Mic2 (front panel) */ |
| 2919 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2920 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2921 | /* headphone */ |
| 2922 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2923 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2924 | /* change to EAPD mode */ |
| 2925 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2926 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2927 | |
| 2928 | { } |
| 2929 | }; |
| 2930 | |
| 2931 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2932 | /* change to EAPD mode */ |
| 2933 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2934 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2935 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2936 | /* Headphone output */ |
| 2937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2938 | /* Front output*/ |
| 2939 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2940 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2941 | |
| 2942 | /* Line In pin widget for input */ |
| 2943 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2944 | /* CD pin widget for input */ |
| 2945 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2946 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2947 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2948 | |
| 2949 | /* change to EAPD mode */ |
| 2950 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2951 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2952 | |
| 2953 | { } |
| 2954 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2955 | |
| 2956 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2957 | * LG m1 express dual |
| 2958 | * |
| 2959 | * Pin assignment: |
| 2960 | * Rear Line-In/Out (blue): 0x14 |
| 2961 | * Build-in Mic-In: 0x15 |
| 2962 | * Speaker-out: 0x17 |
| 2963 | * HP-Out (green): 0x1b |
| 2964 | * Mic-In/Out (red): 0x19 |
| 2965 | * SPDIF-Out: 0x1e |
| 2966 | */ |
| 2967 | |
| 2968 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2969 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2970 | 0x05, 0x02, 0x03 |
| 2971 | }; |
| 2972 | |
| 2973 | /* seems analog CD is not working */ |
| 2974 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2975 | .num_items = 3, |
| 2976 | .items = { |
| 2977 | { "Mic", 0x1 }, |
| 2978 | { "Line", 0x5 }, |
| 2979 | { "Internal Mic", 0x6 }, |
| 2980 | }, |
| 2981 | }; |
| 2982 | |
| 2983 | /* 2,4,6 channel modes */ |
| 2984 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2985 | /* set line-in and mic-in to input */ |
| 2986 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2987 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2988 | { } |
| 2989 | }; |
| 2990 | |
| 2991 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2992 | /* set line-in to out and mic-in to input */ |
| 2993 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2994 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2995 | { } |
| 2996 | }; |
| 2997 | |
| 2998 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2999 | /* set line-in and mic-in to output */ |
| 3000 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3001 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3002 | { } |
| 3003 | }; |
| 3004 | |
| 3005 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3006 | { 2, alc880_lg_ch2_init }, |
| 3007 | { 4, alc880_lg_ch4_init }, |
| 3008 | { 6, alc880_lg_ch6_init }, |
| 3009 | }; |
| 3010 | |
| 3011 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3012 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3013 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3014 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3015 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3016 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3017 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3018 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3019 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3022 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3023 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3024 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3025 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3026 | { |
| 3027 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3028 | .name = "Channel Mode", |
| 3029 | .info = alc_ch_mode_info, |
| 3030 | .get = alc_ch_mode_get, |
| 3031 | .put = alc_ch_mode_put, |
| 3032 | }, |
| 3033 | { } /* end */ |
| 3034 | }; |
| 3035 | |
| 3036 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3037 | /* set capture source to mic-in */ |
| 3038 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3039 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3040 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3041 | /* mute all amp mixer inputs */ |
| 3042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3045 | /* line-in to input */ |
| 3046 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3047 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3048 | /* built-in mic */ |
| 3049 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3051 | /* speaker-out */ |
| 3052 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3053 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3054 | /* mic-in to input */ |
| 3055 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3056 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3057 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3058 | /* HP-out */ |
| 3059 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3060 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3061 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3062 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3063 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3064 | { } |
| 3065 | }; |
| 3066 | |
| 3067 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3068 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3069 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3070 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3071 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3072 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3073 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3074 | } |
| 3075 | |
| 3076 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3077 | * LG LW20 |
| 3078 | * |
| 3079 | * Pin assignment: |
| 3080 | * Speaker-out: 0x14 |
| 3081 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3082 | * Built-in Mic-In: 0x19 |
| 3083 | * Line-In: 0x1b |
| 3084 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3085 | * SPDIF-Out: 0x1e |
| 3086 | */ |
| 3087 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3088 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3089 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3090 | .items = { |
| 3091 | { "Mic", 0x0 }, |
| 3092 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3093 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3094 | }, |
| 3095 | }; |
| 3096 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3097 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3098 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3099 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3100 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3101 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3102 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3103 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3104 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3105 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3106 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3107 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3108 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3109 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3111 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3112 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3113 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3114 | { |
| 3115 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3116 | .name = "Channel Mode", |
| 3117 | .info = alc_ch_mode_info, |
| 3118 | .get = alc_ch_mode_get, |
| 3119 | .put = alc_ch_mode_put, |
| 3120 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3121 | { } /* end */ |
| 3122 | }; |
| 3123 | |
| 3124 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3125 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3126 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3127 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3128 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3129 | /* set capture source to mic-in */ |
| 3130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3131 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3132 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3134 | /* speaker-out */ |
| 3135 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3136 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3137 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3138 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3139 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3140 | /* mic-in to input */ |
| 3141 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3142 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3143 | /* built-in mic */ |
| 3144 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3145 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3146 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3147 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3148 | { } |
| 3149 | }; |
| 3150 | |
| 3151 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3152 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3153 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3154 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3155 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3156 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3157 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3158 | } |
| 3159 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3160 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3161 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3162 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3163 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3164 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3165 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3166 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3167 | { } /* end */ |
| 3168 | }; |
| 3169 | |
| 3170 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3171 | .num_items = 2, |
| 3172 | .items = { |
| 3173 | { "Mic", 0x0 }, |
| 3174 | { "Internal Mic", 0x1 }, |
| 3175 | }, |
| 3176 | }; |
| 3177 | |
| 3178 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3179 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3180 | |
| 3181 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3182 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3183 | |
| 3184 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3185 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3186 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3187 | /* Mic2 (as headphone out) for HP output */ |
| 3188 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3189 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3190 | /* Internal Speaker */ |
| 3191 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3192 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3193 | |
| 3194 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3195 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3196 | |
| 3197 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3198 | { } |
| 3199 | }; |
| 3200 | |
| 3201 | /* toggle speaker-output according to the hp-jack state */ |
| 3202 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3203 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3204 | struct alc_spec *spec = codec->spec; |
| 3205 | alc_automute_amp(codec); |
| 3206 | /* toggle EAPD */ |
| 3207 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3208 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3209 | else |
| 3210 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3211 | } |
| 3212 | |
| 3213 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3214 | unsigned int res) |
| 3215 | { |
| 3216 | /* Looks like the unsol event is incompatible with the standard |
| 3217 | * definition. 4bit tag is placed at 28 bit! |
| 3218 | */ |
| 3219 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3220 | alc880_medion_rim_automute(codec); |
| 3221 | } |
| 3222 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3223 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3224 | { |
| 3225 | struct alc_spec *spec = codec->spec; |
| 3226 | |
| 3227 | spec->autocfg.hp_pins[0] = 0x14; |
| 3228 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3229 | } |
| 3230 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3231 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3232 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3233 | { 0x0b, HDA_INPUT, 0 }, |
| 3234 | { 0x0b, HDA_INPUT, 1 }, |
| 3235 | { 0x0b, HDA_INPUT, 2 }, |
| 3236 | { 0x0b, HDA_INPUT, 3 }, |
| 3237 | { 0x0b, HDA_INPUT, 4 }, |
| 3238 | { } /* end */ |
| 3239 | }; |
| 3240 | |
| 3241 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3242 | { 0x0b, HDA_INPUT, 1 }, |
| 3243 | { 0x0b, HDA_INPUT, 6 }, |
| 3244 | { 0x0b, HDA_INPUT, 7 }, |
| 3245 | { } /* end */ |
| 3246 | }; |
| 3247 | #endif |
| 3248 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3249 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3250 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3251 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3252 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3253 | static int alc_init(struct hda_codec *codec) |
| 3254 | { |
| 3255 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3256 | unsigned int i; |
| 3257 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3258 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3259 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3260 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3261 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3262 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3263 | |
| 3264 | if (spec->init_hook) |
| 3265 | spec->init_hook(codec); |
| 3266 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3267 | return 0; |
| 3268 | } |
| 3269 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3270 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3271 | { |
| 3272 | struct alc_spec *spec = codec->spec; |
| 3273 | |
| 3274 | if (spec->unsol_event) |
| 3275 | spec->unsol_event(codec, res); |
| 3276 | } |
| 3277 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3278 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3279 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3280 | { |
| 3281 | struct alc_spec *spec = codec->spec; |
| 3282 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3283 | } |
| 3284 | #endif |
| 3285 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3286 | /* |
| 3287 | * Analog playback callbacks |
| 3288 | */ |
| 3289 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3290 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3291 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3292 | { |
| 3293 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3294 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3295 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3296 | } |
| 3297 | |
| 3298 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3299 | struct hda_codec *codec, |
| 3300 | unsigned int stream_tag, |
| 3301 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3302 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3303 | { |
| 3304 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3305 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3306 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3307 | } |
| 3308 | |
| 3309 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3310 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3311 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3312 | { |
| 3313 | struct alc_spec *spec = codec->spec; |
| 3314 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3315 | } |
| 3316 | |
| 3317 | /* |
| 3318 | * Digital out |
| 3319 | */ |
| 3320 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3321 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3322 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3323 | { |
| 3324 | struct alc_spec *spec = codec->spec; |
| 3325 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3326 | } |
| 3327 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3328 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3329 | struct hda_codec *codec, |
| 3330 | unsigned int stream_tag, |
| 3331 | unsigned int format, |
| 3332 | struct snd_pcm_substream *substream) |
| 3333 | { |
| 3334 | struct alc_spec *spec = codec->spec; |
| 3335 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3336 | stream_tag, format, substream); |
| 3337 | } |
| 3338 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3339 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3340 | struct hda_codec *codec, |
| 3341 | struct snd_pcm_substream *substream) |
| 3342 | { |
| 3343 | struct alc_spec *spec = codec->spec; |
| 3344 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3345 | } |
| 3346 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3347 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3348 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3349 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3350 | { |
| 3351 | struct alc_spec *spec = codec->spec; |
| 3352 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3353 | } |
| 3354 | |
| 3355 | /* |
| 3356 | * Analog capture |
| 3357 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3358 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3359 | struct hda_codec *codec, |
| 3360 | unsigned int stream_tag, |
| 3361 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3362 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3363 | { |
| 3364 | struct alc_spec *spec = codec->spec; |
| 3365 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3366 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3367 | stream_tag, 0, format); |
| 3368 | return 0; |
| 3369 | } |
| 3370 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3371 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3372 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3373 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | { |
| 3375 | struct alc_spec *spec = codec->spec; |
| 3376 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3377 | snd_hda_codec_cleanup_stream(codec, |
| 3378 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3379 | return 0; |
| 3380 | } |
| 3381 | |
| 3382 | |
| 3383 | /* |
| 3384 | */ |
| 3385 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3386 | .substreams = 1, |
| 3387 | .channels_min = 2, |
| 3388 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3389 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3390 | .ops = { |
| 3391 | .open = alc880_playback_pcm_open, |
| 3392 | .prepare = alc880_playback_pcm_prepare, |
| 3393 | .cleanup = alc880_playback_pcm_cleanup |
| 3394 | }, |
| 3395 | }; |
| 3396 | |
| 3397 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3398 | .substreams = 1, |
| 3399 | .channels_min = 2, |
| 3400 | .channels_max = 2, |
| 3401 | /* NID is set in alc_build_pcms */ |
| 3402 | }; |
| 3403 | |
| 3404 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3405 | .substreams = 1, |
| 3406 | .channels_min = 2, |
| 3407 | .channels_max = 2, |
| 3408 | /* NID is set in alc_build_pcms */ |
| 3409 | }; |
| 3410 | |
| 3411 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3412 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3413 | .channels_min = 2, |
| 3414 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3415 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3416 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3417 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3418 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3419 | }, |
| 3420 | }; |
| 3421 | |
| 3422 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3423 | .substreams = 1, |
| 3424 | .channels_min = 2, |
| 3425 | .channels_max = 2, |
| 3426 | /* NID is set in alc_build_pcms */ |
| 3427 | .ops = { |
| 3428 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3429 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3430 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3431 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3432 | }, |
| 3433 | }; |
| 3434 | |
| 3435 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3436 | .substreams = 1, |
| 3437 | .channels_min = 2, |
| 3438 | .channels_max = 2, |
| 3439 | /* NID is set in alc_build_pcms */ |
| 3440 | }; |
| 3441 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3442 | /* 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] | 3443 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3444 | .substreams = 0, |
| 3445 | .channels_min = 0, |
| 3446 | .channels_max = 0, |
| 3447 | }; |
| 3448 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3449 | static int alc_build_pcms(struct hda_codec *codec) |
| 3450 | { |
| 3451 | struct alc_spec *spec = codec->spec; |
| 3452 | struct hda_pcm *info = spec->pcm_rec; |
| 3453 | int i; |
| 3454 | |
| 3455 | codec->num_pcms = 1; |
| 3456 | codec->pcm_info = info; |
| 3457 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3458 | if (spec->no_analog) |
| 3459 | goto skip_analog; |
| 3460 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3461 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3462 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3463 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3464 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3465 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3466 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3467 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3468 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3469 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3470 | } |
| 3471 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3472 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3473 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3474 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3475 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3476 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3477 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3478 | if (spec->channel_mode) { |
| 3479 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3480 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3481 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3482 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3483 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3484 | } |
| 3485 | } |
| 3486 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3487 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3488 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3489 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3490 | snprintf(spec->stream_name_digital, |
| 3491 | sizeof(spec->stream_name_digital), |
| 3492 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3493 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3494 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3495 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3496 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3497 | if (spec->dig_out_type) |
| 3498 | info->pcm_type = spec->dig_out_type; |
| 3499 | else |
| 3500 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3501 | if (spec->multiout.dig_out_nid && |
| 3502 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3503 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3504 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3505 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3506 | if (spec->dig_in_nid && |
| 3507 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3508 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3509 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3510 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3511 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3512 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3513 | } |
| 3514 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3515 | if (spec->no_analog) |
| 3516 | return 0; |
| 3517 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3518 | /* If the use of more than one ADC is requested for the current |
| 3519 | * model, configure a second analog capture-only PCM. |
| 3520 | */ |
| 3521 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3522 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3523 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3524 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3525 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3526 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3527 | if (spec->alt_dac_nid) { |
| 3528 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3529 | *spec->stream_analog_alt_playback; |
| 3530 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3531 | spec->alt_dac_nid; |
| 3532 | } else { |
| 3533 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3534 | alc_pcm_null_stream; |
| 3535 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3536 | } |
| 3537 | if (spec->num_adc_nids > 1) { |
| 3538 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3539 | *spec->stream_analog_alt_capture; |
| 3540 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3541 | spec->adc_nids[1]; |
| 3542 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3543 | spec->num_adc_nids - 1; |
| 3544 | } else { |
| 3545 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3546 | alc_pcm_null_stream; |
| 3547 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3548 | } |
| 3549 | } |
| 3550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3551 | return 0; |
| 3552 | } |
| 3553 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3554 | static void alc_free_kctls(struct hda_codec *codec) |
| 3555 | { |
| 3556 | struct alc_spec *spec = codec->spec; |
| 3557 | |
| 3558 | if (spec->kctls.list) { |
| 3559 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3560 | int i; |
| 3561 | for (i = 0; i < spec->kctls.used; i++) |
| 3562 | kfree(kctl[i].name); |
| 3563 | } |
| 3564 | snd_array_free(&spec->kctls); |
| 3565 | } |
| 3566 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3567 | static void alc_free(struct hda_codec *codec) |
| 3568 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3569 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3570 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3571 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3572 | return; |
| 3573 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3574 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3575 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3576 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3577 | } |
| 3578 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3579 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3580 | static int alc_resume(struct hda_codec *codec) |
| 3581 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3582 | codec->patch_ops.init(codec); |
| 3583 | snd_hda_codec_resume_amp(codec); |
| 3584 | snd_hda_codec_resume_cache(codec); |
| 3585 | return 0; |
| 3586 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3587 | #endif |
| 3588 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3589 | /* |
| 3590 | */ |
| 3591 | static struct hda_codec_ops alc_patch_ops = { |
| 3592 | .build_controls = alc_build_controls, |
| 3593 | .build_pcms = alc_build_pcms, |
| 3594 | .init = alc_init, |
| 3595 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3596 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3597 | #ifdef SND_HDA_NEEDS_RESUME |
| 3598 | .resume = alc_resume, |
| 3599 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3600 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3601 | .check_power_status = alc_check_power_status, |
| 3602 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3603 | }; |
| 3604 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3605 | |
| 3606 | /* |
| 3607 | * Test configuration for debugging |
| 3608 | * |
| 3609 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3610 | * enum controls. |
| 3611 | */ |
| 3612 | #ifdef CONFIG_SND_DEBUG |
| 3613 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3614 | 0x02, 0x03, 0x04, 0x05 |
| 3615 | }; |
| 3616 | |
| 3617 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3618 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3619 | .items = { |
| 3620 | { "In-1", 0x0 }, |
| 3621 | { "In-2", 0x1 }, |
| 3622 | { "In-3", 0x2 }, |
| 3623 | { "In-4", 0x3 }, |
| 3624 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3625 | { "Front", 0x5 }, |
| 3626 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3627 | }, |
| 3628 | }; |
| 3629 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3630 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3631 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3632 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3633 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3634 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3635 | }; |
| 3636 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3637 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3638 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3639 | { |
| 3640 | static char *texts[] = { |
| 3641 | "N/A", "Line Out", "HP Out", |
| 3642 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3643 | }; |
| 3644 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3645 | uinfo->count = 1; |
| 3646 | uinfo->value.enumerated.items = 8; |
| 3647 | if (uinfo->value.enumerated.item >= 8) |
| 3648 | uinfo->value.enumerated.item = 7; |
| 3649 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3650 | return 0; |
| 3651 | } |
| 3652 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3653 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3654 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3655 | { |
| 3656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3657 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3658 | unsigned int pin_ctl, item = 0; |
| 3659 | |
| 3660 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3661 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3662 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3663 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3664 | item = 2; |
| 3665 | else |
| 3666 | item = 1; |
| 3667 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3668 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3669 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3670 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3671 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3672 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3673 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3674 | } |
| 3675 | } |
| 3676 | ucontrol->value.enumerated.item[0] = item; |
| 3677 | return 0; |
| 3678 | } |
| 3679 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3680 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3681 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3682 | { |
| 3683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3684 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3685 | static unsigned int ctls[] = { |
| 3686 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3687 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3688 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3689 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3690 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3691 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3692 | }; |
| 3693 | unsigned int old_ctl, new_ctl; |
| 3694 | |
| 3695 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3696 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3697 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3698 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3699 | int val; |
| 3700 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3701 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3702 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3703 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3704 | HDA_AMP_MUTE : 0; |
| 3705 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3706 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3707 | return 1; |
| 3708 | } |
| 3709 | return 0; |
| 3710 | } |
| 3711 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3712 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3713 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3714 | { |
| 3715 | static char *texts[] = { |
| 3716 | "Front", "Surround", "CLFE", "Side" |
| 3717 | }; |
| 3718 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3719 | uinfo->count = 1; |
| 3720 | uinfo->value.enumerated.items = 4; |
| 3721 | if (uinfo->value.enumerated.item >= 4) |
| 3722 | uinfo->value.enumerated.item = 3; |
| 3723 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3724 | return 0; |
| 3725 | } |
| 3726 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3727 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3728 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3729 | { |
| 3730 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3731 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3732 | unsigned int sel; |
| 3733 | |
| 3734 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3735 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3736 | return 0; |
| 3737 | } |
| 3738 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3739 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3740 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3741 | { |
| 3742 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3743 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3744 | unsigned int sel; |
| 3745 | |
| 3746 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3747 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3748 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3749 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3750 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3751 | return 1; |
| 3752 | } |
| 3753 | return 0; |
| 3754 | } |
| 3755 | |
| 3756 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3757 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3758 | .name = xname, \ |
| 3759 | .info = alc_test_pin_ctl_info, \ |
| 3760 | .get = alc_test_pin_ctl_get, \ |
| 3761 | .put = alc_test_pin_ctl_put, \ |
| 3762 | .private_value = nid \ |
| 3763 | } |
| 3764 | |
| 3765 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3766 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3767 | .name = xname, \ |
| 3768 | .info = alc_test_pin_src_info, \ |
| 3769 | .get = alc_test_pin_src_get, \ |
| 3770 | .put = alc_test_pin_src_put, \ |
| 3771 | .private_value = nid \ |
| 3772 | } |
| 3773 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3774 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3775 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3776 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3777 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3778 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3779 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3780 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3781 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3782 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3783 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3784 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3785 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3786 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3787 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3788 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3789 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3790 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3791 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3792 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3793 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3794 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3795 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3796 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3797 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3798 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3799 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3800 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3801 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3802 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3803 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3804 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3805 | { |
| 3806 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3807 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3808 | .info = alc_ch_mode_info, |
| 3809 | .get = alc_ch_mode_get, |
| 3810 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3811 | }, |
| 3812 | { } /* end */ |
| 3813 | }; |
| 3814 | |
| 3815 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3816 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3819 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3820 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3821 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3822 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3823 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3824 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3825 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3826 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3827 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3828 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3829 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3830 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3831 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3833 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3834 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3835 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3836 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3838 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3839 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3840 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3841 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3842 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3843 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3844 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3845 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3846 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3849 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3850 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3851 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3853 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3854 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3855 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3856 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3857 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3858 | /* Analog input/passthru */ |
| 3859 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3860 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3861 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3862 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3863 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3864 | { } |
| 3865 | }; |
| 3866 | #endif |
| 3867 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3868 | /* |
| 3869 | */ |
| 3870 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3871 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3872 | [ALC880_3ST] = "3stack", |
| 3873 | [ALC880_TCL_S700] = "tcl", |
| 3874 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3875 | [ALC880_CLEVO] = "clevo", |
| 3876 | [ALC880_5ST] = "5stack", |
| 3877 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3878 | [ALC880_W810] = "w810", |
| 3879 | [ALC880_Z71V] = "z71v", |
| 3880 | [ALC880_6ST] = "6stack", |
| 3881 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3882 | [ALC880_ASUS] = "asus", |
| 3883 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3884 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3885 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3886 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3887 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3888 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3889 | [ALC880_F1734] = "F1734", |
| 3890 | [ALC880_LG] = "lg", |
| 3891 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3892 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3893 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3894 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3895 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3896 | [ALC880_AUTO] = "auto", |
| 3897 | }; |
| 3898 | |
| 3899 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3900 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3901 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3902 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3903 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3904 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3905 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3906 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3907 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3908 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3909 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3910 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3911 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3912 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3913 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3914 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3915 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3916 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3917 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3918 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3919 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3920 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3921 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3922 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3923 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3924 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3925 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3926 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3927 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3928 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3929 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3930 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3931 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3932 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3933 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3934 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3935 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3936 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3937 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3938 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3939 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3940 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3941 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3942 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3943 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3944 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3945 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3946 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3947 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3948 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3949 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3950 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3951 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3952 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3953 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3954 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3955 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3956 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3957 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3958 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3959 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3960 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3961 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3962 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3963 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3964 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3965 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3966 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3967 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3968 | /* default Intel */ |
| 3969 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3970 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3971 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3972 | {} |
| 3973 | }; |
| 3974 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3975 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3976 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3977 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3978 | static struct alc_config_preset alc880_presets[] = { |
| 3979 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3980 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3981 | .init_verbs = { alc880_volume_init_verbs, |
| 3982 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3983 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3984 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3985 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3986 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3987 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3988 | .input_mux = &alc880_capture_source, |
| 3989 | }, |
| 3990 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3991 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3992 | .init_verbs = { alc880_volume_init_verbs, |
| 3993 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3994 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3995 | .dac_nids = alc880_dac_nids, |
| 3996 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3997 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3998 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3999 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4000 | .input_mux = &alc880_capture_source, |
| 4001 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4002 | [ALC880_TCL_S700] = { |
| 4003 | .mixers = { alc880_tcl_s700_mixer }, |
| 4004 | .init_verbs = { alc880_volume_init_verbs, |
| 4005 | alc880_pin_tcl_S700_init_verbs, |
| 4006 | alc880_gpio2_init_verbs }, |
| 4007 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4008 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4009 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4010 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | .hp_nid = 0x03, |
| 4012 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4013 | .channel_mode = alc880_2_jack_modes, |
| 4014 | .input_mux = &alc880_capture_source, |
| 4015 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4016 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4017 | .mixers = { alc880_three_stack_mixer, |
| 4018 | alc880_five_stack_mixer}, |
| 4019 | .init_verbs = { alc880_volume_init_verbs, |
| 4020 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4021 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4022 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4023 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4024 | .channel_mode = alc880_fivestack_modes, |
| 4025 | .input_mux = &alc880_capture_source, |
| 4026 | }, |
| 4027 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4028 | .mixers = { alc880_three_stack_mixer, |
| 4029 | alc880_five_stack_mixer }, |
| 4030 | .init_verbs = { alc880_volume_init_verbs, |
| 4031 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4032 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4033 | .dac_nids = alc880_dac_nids, |
| 4034 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4035 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4036 | .channel_mode = alc880_fivestack_modes, |
| 4037 | .input_mux = &alc880_capture_source, |
| 4038 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4039 | [ALC880_6ST] = { |
| 4040 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4041 | .init_verbs = { alc880_volume_init_verbs, |
| 4042 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4043 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4044 | .dac_nids = alc880_6st_dac_nids, |
| 4045 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4046 | .channel_mode = alc880_sixstack_modes, |
| 4047 | .input_mux = &alc880_6stack_capture_source, |
| 4048 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4049 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4050 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4051 | .init_verbs = { alc880_volume_init_verbs, |
| 4052 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4053 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4054 | .dac_nids = alc880_6st_dac_nids, |
| 4055 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4056 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4057 | .channel_mode = alc880_sixstack_modes, |
| 4058 | .input_mux = &alc880_6stack_capture_source, |
| 4059 | }, |
| 4060 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4061 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4062 | .init_verbs = { alc880_volume_init_verbs, |
| 4063 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4064 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4065 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4066 | .dac_nids = alc880_w810_dac_nids, |
| 4067 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4068 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4069 | .channel_mode = alc880_w810_modes, |
| 4070 | .input_mux = &alc880_capture_source, |
| 4071 | }, |
| 4072 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4073 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4074 | .init_verbs = { alc880_volume_init_verbs, |
| 4075 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4076 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4077 | .dac_nids = alc880_z71v_dac_nids, |
| 4078 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4079 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4080 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4081 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4082 | .input_mux = &alc880_capture_source, |
| 4083 | }, |
| 4084 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4085 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4086 | .init_verbs = { alc880_volume_init_verbs, |
| 4087 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4088 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4089 | .dac_nids = alc880_f1734_dac_nids, |
| 4090 | .hp_nid = 0x02, |
| 4091 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4092 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4093 | .input_mux = &alc880_f1734_capture_source, |
| 4094 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4095 | .setup = alc880_uniwill_p53_setup, |
| 4096 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4097 | }, |
| 4098 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4099 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4100 | .init_verbs = { alc880_volume_init_verbs, |
| 4101 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4102 | alc880_gpio1_init_verbs }, |
| 4103 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4104 | .dac_nids = alc880_asus_dac_nids, |
| 4105 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4106 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4107 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4108 | .input_mux = &alc880_capture_source, |
| 4109 | }, |
| 4110 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4111 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4112 | .init_verbs = { alc880_volume_init_verbs, |
| 4113 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4114 | alc880_gpio1_init_verbs }, |
| 4115 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4116 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4117 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4118 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4119 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4120 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4121 | .input_mux = &alc880_capture_source, |
| 4122 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4123 | [ALC880_ASUS_DIG2] = { |
| 4124 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4125 | .init_verbs = { alc880_volume_init_verbs, |
| 4126 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4127 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4128 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4129 | .dac_nids = alc880_asus_dac_nids, |
| 4130 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4131 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4132 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4133 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4134 | .input_mux = &alc880_capture_source, |
| 4135 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4136 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4137 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4138 | .init_verbs = { alc880_volume_init_verbs, |
| 4139 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4140 | alc880_gpio1_init_verbs }, |
| 4141 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4142 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4143 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4144 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4145 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4146 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4147 | .input_mux = &alc880_capture_source, |
| 4148 | }, |
| 4149 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4150 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4151 | .init_verbs = { alc880_volume_init_verbs, |
| 4152 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4153 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4154 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4155 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4156 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4157 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4158 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4159 | .input_mux = &alc880_capture_source, |
| 4160 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4161 | [ALC880_UNIWILL] = { |
| 4162 | .mixers = { alc880_uniwill_mixer }, |
| 4163 | .init_verbs = { alc880_volume_init_verbs, |
| 4164 | alc880_uniwill_init_verbs }, |
| 4165 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4166 | .dac_nids = alc880_asus_dac_nids, |
| 4167 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4168 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4169 | .channel_mode = alc880_threestack_modes, |
| 4170 | .need_dac_fix = 1, |
| 4171 | .input_mux = &alc880_capture_source, |
| 4172 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4173 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4174 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4175 | }, |
| 4176 | [ALC880_UNIWILL_P53] = { |
| 4177 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4178 | .init_verbs = { alc880_volume_init_verbs, |
| 4179 | alc880_uniwill_p53_init_verbs }, |
| 4180 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4181 | .dac_nids = alc880_asus_dac_nids, |
| 4182 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4183 | .channel_mode = alc880_threestack_modes, |
| 4184 | .input_mux = &alc880_capture_source, |
| 4185 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4186 | .setup = alc880_uniwill_p53_setup, |
| 4187 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4188 | }, |
| 4189 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4190 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4191 | .init_verbs = { alc880_volume_init_verbs, |
| 4192 | alc880_uniwill_p53_init_verbs, |
| 4193 | alc880_beep_init_verbs }, |
| 4194 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4195 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4196 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4197 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4198 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4199 | .input_mux = &alc880_capture_source, |
| 4200 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4201 | .setup = alc880_uniwill_p53_setup, |
| 4202 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4203 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4204 | [ALC880_CLEVO] = { |
| 4205 | .mixers = { alc880_three_stack_mixer }, |
| 4206 | .init_verbs = { alc880_volume_init_verbs, |
| 4207 | alc880_pin_clevo_init_verbs }, |
| 4208 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4209 | .dac_nids = alc880_dac_nids, |
| 4210 | .hp_nid = 0x03, |
| 4211 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4212 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4213 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4214 | .input_mux = &alc880_capture_source, |
| 4215 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4216 | [ALC880_LG] = { |
| 4217 | .mixers = { alc880_lg_mixer }, |
| 4218 | .init_verbs = { alc880_volume_init_verbs, |
| 4219 | alc880_lg_init_verbs }, |
| 4220 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4221 | .dac_nids = alc880_lg_dac_nids, |
| 4222 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4223 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4224 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4225 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4226 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4227 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4228 | .setup = alc880_lg_setup, |
| 4229 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4230 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4231 | .loopbacks = alc880_lg_loopbacks, |
| 4232 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4233 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4234 | [ALC880_LG_LW] = { |
| 4235 | .mixers = { alc880_lg_lw_mixer }, |
| 4236 | .init_verbs = { alc880_volume_init_verbs, |
| 4237 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4238 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4239 | .dac_nids = alc880_dac_nids, |
| 4240 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4241 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4242 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4243 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4244 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4245 | .setup = alc880_lg_lw_setup, |
| 4246 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4247 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4248 | [ALC880_MEDION_RIM] = { |
| 4249 | .mixers = { alc880_medion_rim_mixer }, |
| 4250 | .init_verbs = { alc880_volume_init_verbs, |
| 4251 | alc880_medion_rim_init_verbs, |
| 4252 | alc_gpio2_init_verbs }, |
| 4253 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4254 | .dac_nids = alc880_dac_nids, |
| 4255 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4256 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4257 | .channel_mode = alc880_2_jack_modes, |
| 4258 | .input_mux = &alc880_medion_rim_capture_source, |
| 4259 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4260 | .setup = alc880_medion_rim_setup, |
| 4261 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4262 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4263 | #ifdef CONFIG_SND_DEBUG |
| 4264 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4265 | .mixers = { alc880_test_mixer }, |
| 4266 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4267 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4268 | .dac_nids = alc880_test_dac_nids, |
| 4269 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4270 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4271 | .channel_mode = alc880_test_modes, |
| 4272 | .input_mux = &alc880_test_capture_source, |
| 4273 | }, |
| 4274 | #endif |
| 4275 | }; |
| 4276 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4277 | /* |
| 4278 | * Automatic parse of I/O pins from the BIOS configuration |
| 4279 | */ |
| 4280 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4281 | enum { |
| 4282 | ALC_CTL_WIDGET_VOL, |
| 4283 | ALC_CTL_WIDGET_MUTE, |
| 4284 | ALC_CTL_BIND_MUTE, |
| 4285 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4286 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4287 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4288 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4289 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4290 | }; |
| 4291 | |
| 4292 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4293 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4294 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4295 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4296 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4297 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4298 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4299 | knew = snd_array_new(&spec->kctls); |
| 4300 | if (!knew) |
| 4301 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4302 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4303 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4304 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4305 | return -ENOMEM; |
| 4306 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4307 | return 0; |
| 4308 | } |
| 4309 | |
| 4310 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4311 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4312 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4313 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4314 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4315 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4316 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4317 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4318 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4319 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4320 | #define ALC880_PIN_CD_NID 0x1c |
| 4321 | |
| 4322 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4323 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4324 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4325 | { |
| 4326 | hda_nid_t nid; |
| 4327 | int assigned[4]; |
| 4328 | int i, j; |
| 4329 | |
| 4330 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4331 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4332 | |
| 4333 | /* check the pins hardwired to audio widget */ |
| 4334 | for (i = 0; i < cfg->line_outs; i++) { |
| 4335 | nid = cfg->line_out_pins[i]; |
| 4336 | if (alc880_is_fixed_pin(nid)) { |
| 4337 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4338 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4339 | assigned[idx] = 1; |
| 4340 | } |
| 4341 | } |
| 4342 | /* left pins can be connect to any audio widget */ |
| 4343 | for (i = 0; i < cfg->line_outs; i++) { |
| 4344 | nid = cfg->line_out_pins[i]; |
| 4345 | if (alc880_is_fixed_pin(nid)) |
| 4346 | continue; |
| 4347 | /* search for an empty channel */ |
| 4348 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4349 | if (!assigned[j]) { |
| 4350 | spec->multiout.dac_nids[i] = |
| 4351 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4352 | assigned[j] = 1; |
| 4353 | break; |
| 4354 | } |
| 4355 | } |
| 4356 | } |
| 4357 | spec->multiout.num_dacs = cfg->line_outs; |
| 4358 | return 0; |
| 4359 | } |
| 4360 | |
| 4361 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4363 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4364 | { |
| 4365 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4366 | static const char *chname[4] = { |
| 4367 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4368 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4369 | hda_nid_t nid; |
| 4370 | int i, err; |
| 4371 | |
| 4372 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4373 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | continue; |
| 4375 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4376 | if (i == 2) { |
| 4377 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4378 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4379 | "Center Playback Volume", |
| 4380 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4381 | HDA_OUTPUT)); |
| 4382 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4383 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4384 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4385 | "LFE Playback Volume", |
| 4386 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4387 | HDA_OUTPUT)); |
| 4388 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4389 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4390 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4391 | "Center Playback Switch", |
| 4392 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4393 | HDA_INPUT)); |
| 4394 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4395 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4396 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4397 | "LFE Playback Switch", |
| 4398 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4399 | HDA_INPUT)); |
| 4400 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4401 | return err; |
| 4402 | } else { |
| 4403 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4404 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4405 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4406 | HDA_OUTPUT)); |
| 4407 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4408 | return err; |
| 4409 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4410 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4411 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4412 | HDA_INPUT)); |
| 4413 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4414 | return err; |
| 4415 | } |
| 4416 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4417 | return 0; |
| 4418 | } |
| 4419 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4420 | /* add playback controls for speaker and HP outputs */ |
| 4421 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4422 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4423 | { |
| 4424 | hda_nid_t nid; |
| 4425 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4426 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4427 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4428 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | return 0; |
| 4430 | |
| 4431 | if (alc880_is_fixed_pin(pin)) { |
| 4432 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4433 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4434 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4435 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4436 | else |
| 4437 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4438 | /* control HP volume/switch on the output mixer amp */ |
| 4439 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4440 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4441 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4442 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4443 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4444 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4445 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4446 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4447 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4448 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4449 | return err; |
| 4450 | } else if (alc880_is_multi_pin(pin)) { |
| 4451 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4452 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4453 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4454 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4455 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4456 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4457 | return err; |
| 4458 | } |
| 4459 | return 0; |
| 4460 | } |
| 4461 | |
| 4462 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4463 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4464 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4465 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4466 | { |
| 4467 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4468 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4469 | |
| 4470 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4471 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4472 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4473 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4474 | return err; |
| 4475 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4476 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4477 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4478 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4479 | return err; |
| 4480 | return 0; |
| 4481 | } |
| 4482 | |
| 4483 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4484 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4485 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4486 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4487 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4488 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4489 | |
| 4490 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4491 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4492 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4493 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4494 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4495 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4496 | if (err < 0) |
| 4497 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4498 | imux->items[imux->num_items].label = |
| 4499 | auto_pin_cfg_labels[i]; |
| 4500 | imux->items[imux->num_items].index = |
| 4501 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4502 | imux->num_items++; |
| 4503 | } |
| 4504 | } |
| 4505 | return 0; |
| 4506 | } |
| 4507 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4508 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4509 | unsigned int pin_type) |
| 4510 | { |
| 4511 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4512 | pin_type); |
| 4513 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4514 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4515 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4516 | } |
| 4517 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4518 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4519 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4520 | int dac_idx) |
| 4521 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4522 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4523 | /* need the manual connection? */ |
| 4524 | if (alc880_is_multi_pin(nid)) { |
| 4525 | struct alc_spec *spec = codec->spec; |
| 4526 | int idx = alc880_multi_pin_idx(nid); |
| 4527 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4528 | AC_VERB_SET_CONNECT_SEL, |
| 4529 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4530 | } |
| 4531 | } |
| 4532 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4533 | static int get_pin_type(int line_out_type) |
| 4534 | { |
| 4535 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4536 | return PIN_HP; |
| 4537 | else |
| 4538 | return PIN_OUT; |
| 4539 | } |
| 4540 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4541 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4542 | { |
| 4543 | struct alc_spec *spec = codec->spec; |
| 4544 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4545 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4546 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4547 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4548 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4549 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4550 | } |
| 4551 | } |
| 4552 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4553 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4554 | { |
| 4555 | struct alc_spec *spec = codec->spec; |
| 4556 | hda_nid_t pin; |
| 4557 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4558 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4559 | if (pin) /* connect to front */ |
| 4560 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4561 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4562 | if (pin) /* connect to front */ |
| 4563 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4564 | } |
| 4565 | |
| 4566 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4567 | { |
| 4568 | struct alc_spec *spec = codec->spec; |
| 4569 | int i; |
| 4570 | |
| 4571 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4572 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4573 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4574 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4575 | if (nid != ALC880_PIN_CD_NID && |
| 4576 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4577 | snd_hda_codec_write(codec, nid, 0, |
| 4578 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4579 | AMP_OUT_MUTE); |
| 4580 | } |
| 4581 | } |
| 4582 | } |
| 4583 | |
| 4584 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4585 | /* return 1 if successful, 0 if the proper config is not found, |
| 4586 | * or a negative error code |
| 4587 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4588 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4589 | { |
| 4590 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4591 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4592 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4593 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4594 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4595 | alc880_ignore); |
| 4596 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4597 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4598 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4599 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4600 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4601 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4602 | if (err < 0) |
| 4603 | return err; |
| 4604 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4605 | if (err < 0) |
| 4606 | return err; |
| 4607 | err = alc880_auto_create_extra_out(spec, |
| 4608 | spec->autocfg.speaker_pins[0], |
| 4609 | "Speaker"); |
| 4610 | if (err < 0) |
| 4611 | return err; |
| 4612 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4613 | "Headphone"); |
| 4614 | if (err < 0) |
| 4615 | return err; |
| 4616 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4617 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4618 | return err; |
| 4619 | |
| 4620 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4621 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4622 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4623 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4624 | hda_nid_t dig_nid; |
| 4625 | err = snd_hda_get_connections(codec, |
| 4626 | spec->autocfg.dig_out_pins[i], |
| 4627 | &dig_nid, 1); |
| 4628 | if (err < 0) |
| 4629 | continue; |
| 4630 | if (!i) |
| 4631 | spec->multiout.dig_out_nid = dig_nid; |
| 4632 | else { |
| 4633 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4634 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4635 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4636 | break; |
| 4637 | } |
| 4638 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4639 | if (spec->autocfg.dig_in_pin) |
| 4640 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4641 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4642 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4643 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4644 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4645 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4646 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4647 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4648 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4649 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4650 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4651 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4652 | return 1; |
| 4653 | } |
| 4654 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4655 | /* additional initialization for auto-configuration model */ |
| 4656 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4657 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4658 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4659 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4660 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4661 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4662 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4663 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4664 | } |
| 4665 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4666 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4667 | * one of two digital mic pins, e.g. on ALC272 |
| 4668 | */ |
| 4669 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4670 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4671 | struct alc_spec *spec = codec->spec; |
| 4672 | int i; |
| 4673 | |
| 4674 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4675 | hda_nid_t cap = spec->capsrc_nids ? |
| 4676 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4677 | int iidx, eidx; |
| 4678 | |
| 4679 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4680 | if (iidx < 0) |
| 4681 | continue; |
| 4682 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4683 | if (eidx < 0) |
| 4684 | continue; |
| 4685 | spec->int_mic.mux_idx = iidx; |
| 4686 | spec->ext_mic.mux_idx = eidx; |
| 4687 | if (spec->capsrc_nids) |
| 4688 | spec->capsrc_nids += i; |
| 4689 | spec->adc_nids += i; |
| 4690 | spec->num_adc_nids = 1; |
| 4691 | return; |
| 4692 | } |
| 4693 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4694 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4695 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4696 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4697 | } |
| 4698 | |
| 4699 | static void set_capture_mixer(struct hda_codec *codec) |
| 4700 | { |
| 4701 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4702 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4703 | { alc_capture_mixer_nosrc1, |
| 4704 | alc_capture_mixer_nosrc2, |
| 4705 | alc_capture_mixer_nosrc3 }, |
| 4706 | { alc_capture_mixer1, |
| 4707 | alc_capture_mixer2, |
| 4708 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4709 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4710 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4711 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4712 | if (spec->auto_mic) { |
| 4713 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4714 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4715 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4716 | mux = 1; |
| 4717 | else |
| 4718 | mux = 0; |
| 4719 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4720 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4721 | } |
| 4722 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4723 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4724 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4725 | |
| 4726 | /* |
| 4727 | * OK, here we have finally the patch for ALC880 |
| 4728 | */ |
| 4729 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4730 | static int patch_alc880(struct hda_codec *codec) |
| 4731 | { |
| 4732 | struct alc_spec *spec; |
| 4733 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4734 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4735 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4736 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4737 | if (spec == NULL) |
| 4738 | return -ENOMEM; |
| 4739 | |
| 4740 | codec->spec = spec; |
| 4741 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4742 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4743 | alc880_models, |
| 4744 | alc880_cfg_tbl); |
| 4745 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4746 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4747 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4748 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4749 | } |
| 4750 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4751 | if (board_config == ALC880_AUTO) { |
| 4752 | /* automatic parse from the BIOS config */ |
| 4753 | err = alc880_parse_auto_config(codec); |
| 4754 | if (err < 0) { |
| 4755 | alc_free(codec); |
| 4756 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4757 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4758 | printk(KERN_INFO |
| 4759 | "hda_codec: Cannot set up configuration " |
| 4760 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4761 | board_config = ALC880_3ST; |
| 4762 | } |
| 4763 | } |
| 4764 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4765 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4766 | if (err < 0) { |
| 4767 | alc_free(codec); |
| 4768 | return err; |
| 4769 | } |
| 4770 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4771 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 4772 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4773 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4774 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4775 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4776 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4777 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4778 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4779 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4780 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4781 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4782 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4783 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4784 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4785 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4786 | if (wcap != AC_WID_AUD_IN) { |
| 4787 | spec->adc_nids = alc880_adc_nids_alt; |
| 4788 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4789 | } else { |
| 4790 | spec->adc_nids = alc880_adc_nids; |
| 4791 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4792 | } |
| 4793 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4794 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4795 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4796 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4797 | spec->vmaster_nid = 0x0c; |
| 4798 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4799 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4800 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4801 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4802 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4803 | if (!spec->loopback.amplist) |
| 4804 | spec->loopback.amplist = alc880_loopbacks; |
| 4805 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4806 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4807 | |
| 4808 | return 0; |
| 4809 | } |
| 4810 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4811 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4812 | /* |
| 4813 | * ALC260 support |
| 4814 | */ |
| 4815 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4816 | static hda_nid_t alc260_dac_nids[1] = { |
| 4817 | /* front */ |
| 4818 | 0x02, |
| 4819 | }; |
| 4820 | |
| 4821 | static hda_nid_t alc260_adc_nids[1] = { |
| 4822 | /* ADC0 */ |
| 4823 | 0x04, |
| 4824 | }; |
| 4825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4826 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4827 | /* ADC1 */ |
| 4828 | 0x05, |
| 4829 | }; |
| 4830 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4831 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4832 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4833 | */ |
| 4834 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4835 | /* ADC0, ADC1 */ |
| 4836 | 0x04, 0x05 |
| 4837 | }; |
| 4838 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4839 | #define ALC260_DIGOUT_NID 0x03 |
| 4840 | #define ALC260_DIGIN_NID 0x06 |
| 4841 | |
| 4842 | static struct hda_input_mux alc260_capture_source = { |
| 4843 | .num_items = 4, |
| 4844 | .items = { |
| 4845 | { "Mic", 0x0 }, |
| 4846 | { "Front Mic", 0x1 }, |
| 4847 | { "Line", 0x2 }, |
| 4848 | { "CD", 0x4 }, |
| 4849 | }, |
| 4850 | }; |
| 4851 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4852 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4853 | * headphone jack and the internal CD lines since these are the only pins at |
| 4854 | * which audio can appear. For flexibility, also allow the option of |
| 4855 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4856 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4857 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4858 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4859 | { |
| 4860 | .num_items = 3, |
| 4861 | .items = { |
| 4862 | { "Mic/Line", 0x0 }, |
| 4863 | { "CD", 0x4 }, |
| 4864 | { "Headphone", 0x2 }, |
| 4865 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4866 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4867 | { |
| 4868 | .num_items = 4, |
| 4869 | .items = { |
| 4870 | { "Mic/Line", 0x0 }, |
| 4871 | { "CD", 0x4 }, |
| 4872 | { "Headphone", 0x2 }, |
| 4873 | { "Mixer", 0x5 }, |
| 4874 | }, |
| 4875 | }, |
| 4876 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4877 | }; |
| 4878 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4879 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4880 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4881 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4882 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4883 | { |
| 4884 | .num_items = 4, |
| 4885 | .items = { |
| 4886 | { "Mic", 0x0 }, |
| 4887 | { "Line", 0x2 }, |
| 4888 | { "CD", 0x4 }, |
| 4889 | { "Headphone", 0x5 }, |
| 4890 | }, |
| 4891 | }, |
| 4892 | { |
| 4893 | .num_items = 5, |
| 4894 | .items = { |
| 4895 | { "Mic", 0x0 }, |
| 4896 | { "Line", 0x2 }, |
| 4897 | { "CD", 0x4 }, |
| 4898 | { "Headphone", 0x6 }, |
| 4899 | { "Mixer", 0x5 }, |
| 4900 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4901 | }, |
| 4902 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4903 | |
| 4904 | /* Maxdata Favorit 100XS */ |
| 4905 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4906 | { |
| 4907 | .num_items = 2, |
| 4908 | .items = { |
| 4909 | { "Line/Mic", 0x0 }, |
| 4910 | { "CD", 0x4 }, |
| 4911 | }, |
| 4912 | }, |
| 4913 | { |
| 4914 | .num_items = 3, |
| 4915 | .items = { |
| 4916 | { "Line/Mic", 0x0 }, |
| 4917 | { "CD", 0x4 }, |
| 4918 | { "Mixer", 0x5 }, |
| 4919 | }, |
| 4920 | }, |
| 4921 | }; |
| 4922 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4923 | /* |
| 4924 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4925 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4926 | * element which allows changing the channel mode, so the verb list is |
| 4927 | * never used. |
| 4928 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4929 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4930 | { 2, NULL }, |
| 4931 | }; |
| 4932 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4933 | |
| 4934 | /* Mixer combinations |
| 4935 | * |
| 4936 | * basic: base_output + input + pc_beep + capture |
| 4937 | * HP: base_output + input + capture_alt |
| 4938 | * HP_3013: hp_3013 + input + capture |
| 4939 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4940 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4941 | */ |
| 4942 | |
| 4943 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4944 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4945 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4947 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4948 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4949 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4950 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4951 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4952 | |
| 4953 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4954 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4955 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4956 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4957 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4958 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4959 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4960 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4961 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4962 | { } /* end */ |
| 4963 | }; |
| 4964 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4965 | /* update HP, line and mono out pins according to the master switch */ |
| 4966 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4967 | hda_nid_t hp, hda_nid_t line, |
| 4968 | hda_nid_t mono) |
| 4969 | { |
| 4970 | struct alc_spec *spec = codec->spec; |
| 4971 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4972 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4973 | 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] | 4974 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4975 | 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] | 4976 | val); |
| 4977 | /* mono (speaker) depending on the HP jack sense */ |
| 4978 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4979 | 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] | 4980 | val); |
| 4981 | } |
| 4982 | |
| 4983 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4984 | struct snd_ctl_elem_value *ucontrol) |
| 4985 | { |
| 4986 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4987 | struct alc_spec *spec = codec->spec; |
| 4988 | *ucontrol->value.integer.value = spec->master_sw; |
| 4989 | return 0; |
| 4990 | } |
| 4991 | |
| 4992 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4993 | struct snd_ctl_elem_value *ucontrol) |
| 4994 | { |
| 4995 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4996 | struct alc_spec *spec = codec->spec; |
| 4997 | int val = !!*ucontrol->value.integer.value; |
| 4998 | hda_nid_t hp, line, mono; |
| 4999 | |
| 5000 | if (val == spec->master_sw) |
| 5001 | return 0; |
| 5002 | spec->master_sw = val; |
| 5003 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5004 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5005 | mono = kcontrol->private_value & 0xff; |
| 5006 | alc260_hp_master_update(codec, hp, line, mono); |
| 5007 | return 1; |
| 5008 | } |
| 5009 | |
| 5010 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5011 | { |
| 5012 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5013 | .name = "Master Playback Switch", |
| 5014 | .info = snd_ctl_boolean_mono_info, |
| 5015 | .get = alc260_hp_master_sw_get, |
| 5016 | .put = alc260_hp_master_sw_put, |
| 5017 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5018 | }, |
| 5019 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5020 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5021 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5022 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5023 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5024 | HDA_OUTPUT), |
| 5025 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5026 | { } /* end */ |
| 5027 | }; |
| 5028 | |
| 5029 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5030 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5031 | {}, |
| 5032 | }; |
| 5033 | |
| 5034 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5035 | { |
| 5036 | struct alc_spec *spec = codec->spec; |
| 5037 | unsigned int present; |
| 5038 | |
| 5039 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5040 | AC_VERB_GET_PIN_SENSE, 0); |
| 5041 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 5042 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5043 | } |
| 5044 | |
| 5045 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5046 | { |
| 5047 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5048 | alc260_hp_automute(codec); |
| 5049 | } |
| 5050 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5051 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5052 | { |
| 5053 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5054 | .name = "Master Playback Switch", |
| 5055 | .info = snd_ctl_boolean_mono_info, |
| 5056 | .get = alc260_hp_master_sw_get, |
| 5057 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5058 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5059 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5061 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5062 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5063 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5064 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5065 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5066 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5067 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5068 | { } /* end */ |
| 5069 | }; |
| 5070 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5071 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5072 | .ops = &snd_hda_bind_vol, |
| 5073 | .values = { |
| 5074 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5075 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5076 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5077 | 0 |
| 5078 | }, |
| 5079 | }; |
| 5080 | |
| 5081 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5082 | .ops = &snd_hda_bind_sw, |
| 5083 | .values = { |
| 5084 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5085 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5086 | 0 |
| 5087 | }, |
| 5088 | }; |
| 5089 | |
| 5090 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5091 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5092 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5093 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5094 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5095 | { } /* end */ |
| 5096 | }; |
| 5097 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5098 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5099 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5100 | {}, |
| 5101 | }; |
| 5102 | |
| 5103 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5104 | { |
| 5105 | struct alc_spec *spec = codec->spec; |
| 5106 | unsigned int present; |
| 5107 | |
| 5108 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5109 | AC_VERB_GET_PIN_SENSE, 0); |
| 5110 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5111 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5112 | } |
| 5113 | |
| 5114 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5115 | unsigned int res) |
| 5116 | { |
| 5117 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5118 | alc260_hp_3013_automute(codec); |
| 5119 | } |
| 5120 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5121 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5122 | { |
| 5123 | unsigned int present, bits; |
| 5124 | |
| 5125 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5126 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 5127 | |
| 5128 | bits = present ? 0 : PIN_OUT; |
| 5129 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5130 | bits); |
| 5131 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5132 | bits); |
| 5133 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5134 | bits); |
| 5135 | } |
| 5136 | |
| 5137 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5138 | unsigned int res) |
| 5139 | { |
| 5140 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5141 | alc260_hp_3012_automute(codec); |
| 5142 | } |
| 5143 | |
| 5144 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5145 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5146 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5147 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5148 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5149 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5150 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5151 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5152 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5153 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5154 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5155 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5156 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5157 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5158 | { } /* end */ |
| 5159 | }; |
| 5160 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5161 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5162 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5163 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5164 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5165 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5166 | * revisions available in early 2006. Therefore for now allow the |
| 5167 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5168 | * that the lack of mic bias for this NID is intentional we could change the |
| 5169 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5170 | * |
| 5171 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5172 | * don't appear to make the mic bias available from the "line" jack, even |
| 5173 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5174 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5175 | * and the output jack. If this turns out to be the case for all such |
| 5176 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5177 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5178 | * |
| 5179 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5180 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5181 | * controls for such models. On models without a "mono speaker" the control |
| 5182 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5183 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5184 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5185 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5186 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5187 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5188 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5189 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5190 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5191 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5192 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5193 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5194 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5196 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5197 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5198 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5199 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5200 | { } /* end */ |
| 5201 | }; |
| 5202 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5203 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5204 | */ |
| 5205 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5206 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5207 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5208 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5209 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5210 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5211 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5212 | { } /* end */ |
| 5213 | }; |
| 5214 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5215 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5216 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5217 | */ |
| 5218 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5219 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5220 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5223 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5225 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5226 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5228 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5229 | { } /* end */ |
| 5230 | }; |
| 5231 | |
| 5232 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5233 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5234 | */ |
| 5235 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5236 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5237 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5240 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5241 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5242 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5243 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5244 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5245 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5246 | { } /* end */ |
| 5247 | }; |
| 5248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5249 | /* |
| 5250 | * initialization verbs |
| 5251 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5252 | static struct hda_verb alc260_init_verbs[] = { |
| 5253 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5254 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5255 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5256 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5257 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5258 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5259 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5260 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5261 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5262 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5263 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5264 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5265 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5266 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5267 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5268 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5269 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5270 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5271 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5272 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5273 | /* set connection select to line in (default select for this ADC) */ |
| 5274 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5275 | /* mute capture amp left and right */ |
| 5276 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5277 | /* set connection select to line in (default select for this ADC) */ |
| 5278 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5279 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5280 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5281 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5283 | /* set vol=0 HP mixer amp left and right */ |
| 5284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5285 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5286 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5287 | /* set vol=0 Mono mixer amp left and right */ |
| 5288 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5289 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5290 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5291 | /* unmute LINE-2 out pin */ |
| 5292 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5293 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5294 | * Line In 2 = 0x03 |
| 5295 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5296 | /* mute analog inputs */ |
| 5297 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5298 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5299 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5300 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5301 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5302 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5303 | /* mute Front out path */ |
| 5304 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5305 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5306 | /* mute Headphone out path */ |
| 5307 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5308 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5309 | /* mute Mono out path */ |
| 5310 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5311 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5312 | { } |
| 5313 | }; |
| 5314 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5315 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5316 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5317 | /* Headphone and output */ |
| 5318 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5319 | /* mono output */ |
| 5320 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5321 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5322 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5323 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5324 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5325 | /* Line In pin widget for input */ |
| 5326 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5327 | /* Line-2 pin widget for output */ |
| 5328 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5329 | /* CD pin widget for input */ |
| 5330 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5331 | /* unmute amp left and right */ |
| 5332 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5333 | /* set connection select to line in (default select for this ADC) */ |
| 5334 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5335 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5336 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5337 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5338 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5339 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5340 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5341 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5342 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5343 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5344 | * Line In 2 = 0x03 |
| 5345 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5346 | /* mute analog inputs */ |
| 5347 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5348 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5349 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5350 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5351 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5352 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5353 | /* Unmute Front out path */ |
| 5354 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5356 | /* Unmute Headphone out path */ |
| 5357 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5358 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5359 | /* Unmute Mono out path */ |
| 5360 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5361 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5362 | { } |
| 5363 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5364 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5365 | |
| 5366 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5367 | /* Line out and output */ |
| 5368 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5369 | /* mono output */ |
| 5370 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5371 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5372 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5373 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5374 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5375 | /* Line In pin widget for input */ |
| 5376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5377 | /* Headphone pin widget for output */ |
| 5378 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5379 | /* CD pin widget for input */ |
| 5380 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5381 | /* unmute amp left and right */ |
| 5382 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5383 | /* set connection select to line in (default select for this ADC) */ |
| 5384 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5385 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5386 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5387 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5388 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5389 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5390 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5391 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5392 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5393 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5394 | * Line In 2 = 0x03 |
| 5395 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5396 | /* mute analog inputs */ |
| 5397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5402 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5403 | /* Unmute Front out path */ |
| 5404 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5405 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5406 | /* Unmute Headphone out path */ |
| 5407 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5408 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5409 | /* Unmute Mono out path */ |
| 5410 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5411 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5412 | { } |
| 5413 | }; |
| 5414 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5415 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5416 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5417 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5418 | */ |
| 5419 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5420 | /* Disable all GPIOs */ |
| 5421 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5422 | /* Internal speaker is connected to headphone pin */ |
| 5423 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5424 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5425 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5426 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5427 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5428 | /* Ensure all other unused pins are disabled and muted. */ |
| 5429 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5430 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5431 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5432 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5433 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5434 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5435 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5436 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5437 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5438 | /* Disable digital (SPDIF) pins */ |
| 5439 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5440 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5441 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5442 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5443 | * when acting as an output. |
| 5444 | */ |
| 5445 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5446 | |
| 5447 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5448 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5449 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5450 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5451 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5452 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5453 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5454 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5455 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5456 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5457 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5458 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5459 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5460 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5461 | * If the pin mode is changed by the user the pin mode control will |
| 5462 | * take care of enabling the pin's input/output buffers as needed. |
| 5463 | * Therefore there's no need to enable the input buffer at this |
| 5464 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5465 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5466 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5467 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5468 | * mixer ctrl) |
| 5469 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5470 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5471 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5472 | /* Mute capture amp left and right */ |
| 5473 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5474 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5475 | * in (on mic1 pin) |
| 5476 | */ |
| 5477 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5478 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5479 | /* Do the same for the second ADC: mute capture input amp and |
| 5480 | * set ADC connection to line in (on mic1 pin) |
| 5481 | */ |
| 5482 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5483 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5484 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5485 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5486 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5490 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5491 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5492 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5493 | {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] | 5494 | |
| 5495 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5496 | }; |
| 5497 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5498 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5499 | * similar laptops (adapted from Fujitsu init verbs). |
| 5500 | */ |
| 5501 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5502 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5503 | * the headphone jack. Turn this on and rely on the standard mute |
| 5504 | * methods whenever the user wants to turn these outputs off. |
| 5505 | */ |
| 5506 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5507 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5508 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5509 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5510 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5511 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5512 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5513 | /* Line In jack is connected to Line1 pin */ |
| 5514 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5515 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5516 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5517 | /* Ensure all other unused pins are disabled and muted. */ |
| 5518 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5519 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5520 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5521 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5522 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5523 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5524 | /* Disable digital (SPDIF) pins */ |
| 5525 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5526 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5527 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5528 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5529 | * bus when acting as outputs. |
| 5530 | */ |
| 5531 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5532 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5533 | |
| 5534 | /* Start with output sum widgets muted and their output gains at min */ |
| 5535 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5536 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5537 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5538 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5539 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5540 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5541 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5542 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5543 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5544 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5545 | /* Unmute Line-out pin widget amp left and right |
| 5546 | * (no equiv mixer ctrl) |
| 5547 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5548 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5549 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5550 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5551 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5552 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5553 | * will take care of enabling the pin's input/output buffers as needed. |
| 5554 | * Therefore there's no need to enable the input buffer at this |
| 5555 | * stage. |
| 5556 | */ |
| 5557 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5558 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5559 | |
| 5560 | /* Mute capture amp left and right */ |
| 5561 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5562 | /* Set ADC connection select to match default mixer setting - mic |
| 5563 | * (on mic1 pin) |
| 5564 | */ |
| 5565 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5566 | |
| 5567 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5568 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5569 | */ |
| 5570 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5571 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5572 | |
| 5573 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5575 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5576 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5577 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5578 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5579 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5580 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5581 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5582 | |
| 5583 | { } |
| 5584 | }; |
| 5585 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5586 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5587 | * (adapted from Acer init verbs). |
| 5588 | */ |
| 5589 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5590 | /* GPIO 0 enables the output jack. |
| 5591 | * Turn this on and rely on the standard mute |
| 5592 | * methods whenever the user wants to turn these outputs off. |
| 5593 | */ |
| 5594 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5595 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5596 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5597 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5598 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5599 | /* Ensure all other unused pins are disabled and muted. */ |
| 5600 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5601 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5602 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5603 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5604 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5605 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5608 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5609 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5610 | /* Disable digital (SPDIF) pins */ |
| 5611 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5612 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5613 | |
| 5614 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5615 | * bus when acting as outputs. |
| 5616 | */ |
| 5617 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5618 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5619 | |
| 5620 | /* Start with output sum widgets muted and their output gains at min */ |
| 5621 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5622 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5623 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5624 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5625 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5626 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5627 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5628 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5629 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5630 | |
| 5631 | /* Unmute Line-out pin widget amp left and right |
| 5632 | * (no equiv mixer ctrl) |
| 5633 | */ |
| 5634 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5635 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5636 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5637 | * will take care of enabling the pin's input/output buffers as needed. |
| 5638 | * Therefore there's no need to enable the input buffer at this |
| 5639 | * stage. |
| 5640 | */ |
| 5641 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5642 | |
| 5643 | /* Mute capture amp left and right */ |
| 5644 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5645 | /* Set ADC connection select to match default mixer setting - mic |
| 5646 | * (on mic1 pin) |
| 5647 | */ |
| 5648 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5649 | |
| 5650 | /* Do similar with the second ADC: mute capture input amp and |
| 5651 | * set ADC connection to mic to match ALSA's default state. |
| 5652 | */ |
| 5653 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5654 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5655 | |
| 5656 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5657 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5658 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5659 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5660 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5661 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5662 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5663 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5664 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5665 | |
| 5666 | { } |
| 5667 | }; |
| 5668 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5669 | static struct hda_verb alc260_will_verbs[] = { |
| 5670 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5671 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5672 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5673 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5674 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5675 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5676 | {} |
| 5677 | }; |
| 5678 | |
| 5679 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5680 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5681 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5682 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5683 | |
| 5684 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5685 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5686 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5687 | |
| 5688 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5689 | {} |
| 5690 | }; |
| 5691 | |
| 5692 | /* toggle speaker-output according to the hp-jack state */ |
| 5693 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5694 | { |
| 5695 | unsigned int present; |
| 5696 | |
| 5697 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5698 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5699 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5700 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5701 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5702 | AC_VERB_SET_GPIO_DATA, 1); |
| 5703 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5704 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5705 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5706 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5707 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5708 | AC_VERB_SET_GPIO_DATA, 0); |
| 5709 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5710 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5711 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5712 | } |
| 5713 | } |
| 5714 | |
| 5715 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5716 | unsigned int res) |
| 5717 | { |
| 5718 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5719 | alc260_replacer_672v_automute(codec); |
| 5720 | } |
| 5721 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5722 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5723 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5724 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5725 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5726 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5727 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5728 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5729 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5730 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5731 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5732 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5733 | {} |
| 5734 | }; |
| 5735 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5736 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5737 | * configuration. |
| 5738 | */ |
| 5739 | #ifdef CONFIG_SND_DEBUG |
| 5740 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5741 | 0x02, |
| 5742 | }; |
| 5743 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5744 | 0x04, 0x05, |
| 5745 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5746 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5747 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5748 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5749 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5750 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5751 | { |
| 5752 | .num_items = 7, |
| 5753 | .items = { |
| 5754 | { "MIC1 pin", 0x0 }, |
| 5755 | { "MIC2 pin", 0x1 }, |
| 5756 | { "LINE1 pin", 0x2 }, |
| 5757 | { "LINE2 pin", 0x3 }, |
| 5758 | { "CD pin", 0x4 }, |
| 5759 | { "LINE-OUT pin", 0x5 }, |
| 5760 | { "HP-OUT pin", 0x6 }, |
| 5761 | }, |
| 5762 | }, |
| 5763 | { |
| 5764 | .num_items = 8, |
| 5765 | .items = { |
| 5766 | { "MIC1 pin", 0x0 }, |
| 5767 | { "MIC2 pin", 0x1 }, |
| 5768 | { "LINE1 pin", 0x2 }, |
| 5769 | { "LINE2 pin", 0x3 }, |
| 5770 | { "CD pin", 0x4 }, |
| 5771 | { "Mixer", 0x5 }, |
| 5772 | { "LINE-OUT pin", 0x6 }, |
| 5773 | { "HP-OUT pin", 0x7 }, |
| 5774 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5775 | }, |
| 5776 | }; |
| 5777 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5778 | /* Output driver widgets */ |
| 5779 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5780 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5781 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5782 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5783 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5784 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5785 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5786 | /* Modes for retasking pin widgets |
| 5787 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5788 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5789 | * mention this restriction. At this stage it's not clear whether |
| 5790 | * this behaviour is intentional or is a hardware bug in chip |
| 5791 | * revisions available at least up until early 2006. Therefore for |
| 5792 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5793 | * choices, but if it turns out that the lack of mic bias for these |
| 5794 | * NIDs is intentional we could change their modes from |
| 5795 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5796 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5797 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5798 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5799 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5800 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5801 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5802 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5803 | |
| 5804 | /* Loopback mixer controls */ |
| 5805 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5806 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5807 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5808 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5809 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5810 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5811 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5812 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5813 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5814 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5815 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5816 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5817 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5818 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5819 | |
| 5820 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5821 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5822 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5823 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5824 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5825 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5826 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5827 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5828 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5829 | */ |
| 5830 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5831 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5832 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5833 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5834 | * this output to turn on an external amplifier. |
| 5835 | */ |
| 5836 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5837 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5838 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5839 | { } /* end */ |
| 5840 | }; |
| 5841 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5842 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5843 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5844 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5845 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5846 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5847 | /* Enable retasking pins as output, initially without power amp */ |
| 5848 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5849 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5850 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5851 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5852 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5853 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5854 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5855 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5856 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5857 | * payload also sets the generation to 0, output to be in "consumer" |
| 5858 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5859 | * control. |
| 5860 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5861 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5862 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5863 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5864 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5865 | * OUT1 sum bus when acting as an output. |
| 5866 | */ |
| 5867 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5868 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5869 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5870 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5871 | |
| 5872 | /* Start with output sum widgets muted and their output gains at min */ |
| 5873 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5874 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5875 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5876 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5877 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5878 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5879 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5880 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5881 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5882 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5883 | /* Unmute retasking pin widget output buffers since the default |
| 5884 | * state appears to be output. As the pin mode is changed by the |
| 5885 | * user the pin mode control will take care of enabling the pin's |
| 5886 | * input/output buffers as needed. |
| 5887 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5888 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5889 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5891 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5892 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5893 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5894 | /* Also unmute the mono-out pin widget */ |
| 5895 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5896 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5897 | /* Mute capture amp left and right */ |
| 5898 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5899 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5900 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5901 | */ |
| 5902 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5903 | |
| 5904 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5905 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5906 | */ |
| 5907 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5908 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5909 | |
| 5910 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5911 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5912 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5913 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5914 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5915 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5919 | |
| 5920 | { } |
| 5921 | }; |
| 5922 | #endif |
| 5923 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5924 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5925 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5926 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5927 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5928 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5929 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5930 | /* |
| 5931 | * for BIOS auto-configuration |
| 5932 | */ |
| 5933 | |
| 5934 | 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] | 5935 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5936 | { |
| 5937 | hda_nid_t nid_vol; |
| 5938 | unsigned long vol_val, sw_val; |
| 5939 | char name[32]; |
| 5940 | int err; |
| 5941 | |
| 5942 | if (nid >= 0x0f && nid < 0x11) { |
| 5943 | nid_vol = nid - 0x7; |
| 5944 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5945 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5946 | } else if (nid == 0x11) { |
| 5947 | nid_vol = nid - 0x7; |
| 5948 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5949 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5950 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5951 | nid_vol = 0x08; |
| 5952 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5953 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5954 | } else |
| 5955 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5956 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5957 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5958 | /* first control for the volume widget */ |
| 5959 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5960 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5961 | if (err < 0) |
| 5962 | return err; |
| 5963 | *vol_bits |= (1 << nid_vol); |
| 5964 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5965 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5966 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5967 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5968 | return err; |
| 5969 | return 1; |
| 5970 | } |
| 5971 | |
| 5972 | /* add playback controls from the parsed DAC table */ |
| 5973 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5974 | const struct auto_pin_cfg *cfg) |
| 5975 | { |
| 5976 | hda_nid_t nid; |
| 5977 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5978 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5979 | |
| 5980 | spec->multiout.num_dacs = 1; |
| 5981 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5982 | spec->multiout.dac_nids[0] = 0x02; |
| 5983 | |
| 5984 | nid = cfg->line_out_pins[0]; |
| 5985 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5986 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5987 | if (err < 0) |
| 5988 | return err; |
| 5989 | } |
| 5990 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5991 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5992 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5993 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5994 | if (err < 0) |
| 5995 | return err; |
| 5996 | } |
| 5997 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5998 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5999 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6000 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6001 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6002 | if (err < 0) |
| 6003 | return err; |
| 6004 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6005 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6006 | } |
| 6007 | |
| 6008 | /* create playback/capture controls for input pins */ |
| 6009 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 6010 | const struct auto_pin_cfg *cfg) |
| 6011 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6012 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6013 | int i, err, idx; |
| 6014 | |
| 6015 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6016 | if (cfg->input_pins[i] >= 0x12) { |
| 6017 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6018 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6019 | auto_pin_cfg_labels[i], idx, |
| 6020 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6021 | if (err < 0) |
| 6022 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6023 | imux->items[imux->num_items].label = |
| 6024 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6025 | imux->items[imux->num_items].index = idx; |
| 6026 | imux->num_items++; |
| 6027 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6028 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6029 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6030 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6031 | auto_pin_cfg_labels[i], idx, |
| 6032 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6033 | if (err < 0) |
| 6034 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6035 | imux->items[imux->num_items].label = |
| 6036 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6037 | imux->items[imux->num_items].index = idx; |
| 6038 | imux->num_items++; |
| 6039 | } |
| 6040 | } |
| 6041 | return 0; |
| 6042 | } |
| 6043 | |
| 6044 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6045 | hda_nid_t nid, int pin_type, |
| 6046 | int sel_idx) |
| 6047 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6048 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6049 | /* need the manual connection? */ |
| 6050 | if (nid >= 0x12) { |
| 6051 | int idx = nid - 0x12; |
| 6052 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6053 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6054 | } |
| 6055 | } |
| 6056 | |
| 6057 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6058 | { |
| 6059 | struct alc_spec *spec = codec->spec; |
| 6060 | hda_nid_t nid; |
| 6061 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6062 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6063 | if (nid) { |
| 6064 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6065 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6066 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6067 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6068 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6069 | if (nid) |
| 6070 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6071 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6072 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6073 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6074 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6075 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6076 | |
| 6077 | #define ALC260_PIN_CD_NID 0x16 |
| 6078 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6079 | { |
| 6080 | struct alc_spec *spec = codec->spec; |
| 6081 | int i; |
| 6082 | |
| 6083 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6084 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6085 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6086 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6087 | if (nid != ALC260_PIN_CD_NID && |
| 6088 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6089 | snd_hda_codec_write(codec, nid, 0, |
| 6090 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6091 | AMP_OUT_MUTE); |
| 6092 | } |
| 6093 | } |
| 6094 | } |
| 6095 | |
| 6096 | /* |
| 6097 | * generic initialization of ADC, input mixers and output mixers |
| 6098 | */ |
| 6099 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6100 | /* |
| 6101 | * Unmute ADC0-1 and set the default input to mic-in |
| 6102 | */ |
| 6103 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6104 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6105 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6106 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6107 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6108 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6109 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6110 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6111 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6112 | */ |
| 6113 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6114 | /* mute analog inputs */ |
| 6115 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6116 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6117 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6119 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6120 | |
| 6121 | /* |
| 6122 | * Set up output mixers (0x08 - 0x0a) |
| 6123 | */ |
| 6124 | /* set vol=0 to output mixers */ |
| 6125 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6126 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6127 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6128 | /* set up input amps for analog loopback */ |
| 6129 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6130 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6131 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6132 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6133 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6134 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6135 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6136 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6137 | { } |
| 6138 | }; |
| 6139 | |
| 6140 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6141 | { |
| 6142 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6143 | int err; |
| 6144 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6145 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6146 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6147 | alc260_ignore); |
| 6148 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6150 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6151 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6152 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6153 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6154 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6155 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 6156 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6157 | return err; |
| 6158 | |
| 6159 | spec->multiout.max_channels = 2; |
| 6160 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6161 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6162 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6163 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6164 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6165 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6166 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6167 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6168 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6169 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6170 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6171 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6173 | return 1; |
| 6174 | } |
| 6175 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6176 | /* additional initialization for auto-configuration model */ |
| 6177 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6178 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6179 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6180 | alc260_auto_init_multi_out(codec); |
| 6181 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6182 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6183 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6184 | } |
| 6185 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6186 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6187 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6188 | { 0x07, HDA_INPUT, 0 }, |
| 6189 | { 0x07, HDA_INPUT, 1 }, |
| 6190 | { 0x07, HDA_INPUT, 2 }, |
| 6191 | { 0x07, HDA_INPUT, 3 }, |
| 6192 | { 0x07, HDA_INPUT, 4 }, |
| 6193 | { } /* end */ |
| 6194 | }; |
| 6195 | #endif |
| 6196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6197 | /* |
| 6198 | * ALC260 configurations |
| 6199 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6200 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6201 | [ALC260_BASIC] = "basic", |
| 6202 | [ALC260_HP] = "hp", |
| 6203 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6204 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6205 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6206 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6207 | [ALC260_WILL] = "will", |
| 6208 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6209 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6210 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6211 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6212 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6213 | [ALC260_AUTO] = "auto", |
| 6214 | }; |
| 6215 | |
| 6216 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6217 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6218 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6219 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6220 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6221 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6222 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6223 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6224 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6225 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6226 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6227 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6228 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6229 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6230 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6231 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6232 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6233 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6234 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6235 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6236 | {} |
| 6237 | }; |
| 6238 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6239 | static struct alc_config_preset alc260_presets[] = { |
| 6240 | [ALC260_BASIC] = { |
| 6241 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6242 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6243 | .init_verbs = { alc260_init_verbs }, |
| 6244 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6245 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6246 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6247 | .adc_nids = alc260_adc_nids, |
| 6248 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6249 | .channel_mode = alc260_modes, |
| 6250 | .input_mux = &alc260_capture_source, |
| 6251 | }, |
| 6252 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6253 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6254 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6255 | .init_verbs = { alc260_init_verbs, |
| 6256 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6258 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6259 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6260 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6261 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6262 | .channel_mode = alc260_modes, |
| 6263 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6264 | .unsol_event = alc260_hp_unsol_event, |
| 6265 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6266 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6267 | [ALC260_HP_DC7600] = { |
| 6268 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6269 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6270 | .init_verbs = { alc260_init_verbs, |
| 6271 | alc260_hp_dc7600_verbs }, |
| 6272 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6273 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6274 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6275 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6276 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6277 | .channel_mode = alc260_modes, |
| 6278 | .input_mux = &alc260_capture_source, |
| 6279 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6280 | .init_hook = alc260_hp_3012_automute, |
| 6281 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6282 | [ALC260_HP_3013] = { |
| 6283 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6284 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6285 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6286 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6287 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6288 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6289 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6290 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6291 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6292 | .channel_mode = alc260_modes, |
| 6293 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6294 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6295 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6296 | }, |
| 6297 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6298 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6299 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6300 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6301 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6302 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6303 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6304 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6305 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6306 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6307 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6308 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6309 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6310 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6311 | .init_verbs = { alc260_acer_init_verbs }, |
| 6312 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6313 | .dac_nids = alc260_dac_nids, |
| 6314 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6315 | .adc_nids = alc260_dual_adc_nids, |
| 6316 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6317 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6318 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6319 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6320 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6321 | [ALC260_FAVORIT100] = { |
| 6322 | .mixers = { alc260_favorit100_mixer }, |
| 6323 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6324 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6325 | .dac_nids = alc260_dac_nids, |
| 6326 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6327 | .adc_nids = alc260_dual_adc_nids, |
| 6328 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6329 | .channel_mode = alc260_modes, |
| 6330 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6331 | .input_mux = alc260_favorit100_capture_sources, |
| 6332 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6333 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6334 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6335 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6336 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6337 | .dac_nids = alc260_dac_nids, |
| 6338 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6339 | .adc_nids = alc260_adc_nids, |
| 6340 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6341 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6342 | .channel_mode = alc260_modes, |
| 6343 | .input_mux = &alc260_capture_source, |
| 6344 | }, |
| 6345 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6346 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6347 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6348 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6349 | .dac_nids = alc260_dac_nids, |
| 6350 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6351 | .adc_nids = alc260_adc_nids, |
| 6352 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6353 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6354 | .channel_mode = alc260_modes, |
| 6355 | .input_mux = &alc260_capture_source, |
| 6356 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6357 | .init_hook = alc260_replacer_672v_automute, |
| 6358 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6359 | #ifdef CONFIG_SND_DEBUG |
| 6360 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6361 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6362 | .init_verbs = { alc260_test_init_verbs }, |
| 6363 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6364 | .dac_nids = alc260_test_dac_nids, |
| 6365 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6366 | .adc_nids = alc260_test_adc_nids, |
| 6367 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6368 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6369 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6370 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6371 | }, |
| 6372 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6373 | }; |
| 6374 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6375 | static int patch_alc260(struct hda_codec *codec) |
| 6376 | { |
| 6377 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6378 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6379 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6380 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6381 | if (spec == NULL) |
| 6382 | return -ENOMEM; |
| 6383 | |
| 6384 | codec->spec = spec; |
| 6385 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6386 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6387 | alc260_models, |
| 6388 | alc260_cfg_tbl); |
| 6389 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6390 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6391 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6392 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6393 | } |
| 6394 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6395 | if (board_config == ALC260_AUTO) { |
| 6396 | /* automatic parse from the BIOS config */ |
| 6397 | err = alc260_parse_auto_config(codec); |
| 6398 | if (err < 0) { |
| 6399 | alc_free(codec); |
| 6400 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6401 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6402 | printk(KERN_INFO |
| 6403 | "hda_codec: Cannot set up configuration " |
| 6404 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6405 | board_config = ALC260_BASIC; |
| 6406 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6407 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6408 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6409 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6410 | if (err < 0) { |
| 6411 | alc_free(codec); |
| 6412 | return err; |
| 6413 | } |
| 6414 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6415 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6416 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6417 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6418 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6419 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6420 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6421 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6422 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6423 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6424 | if (!spec->adc_nids && spec->input_mux) { |
| 6425 | /* check whether NID 0x04 is valid */ |
| 6426 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6427 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6428 | /* get type */ |
| 6429 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6430 | spec->adc_nids = alc260_adc_nids_alt; |
| 6431 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6432 | } else { |
| 6433 | spec->adc_nids = alc260_adc_nids; |
| 6434 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6435 | } |
| 6436 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6437 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6438 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6439 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6440 | spec->vmaster_nid = 0x08; |
| 6441 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6442 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6443 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6444 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6445 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6446 | if (!spec->loopback.amplist) |
| 6447 | spec->loopback.amplist = alc260_loopbacks; |
| 6448 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6449 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6450 | |
| 6451 | return 0; |
| 6452 | } |
| 6453 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6455 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6456 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6457 | * |
| 6458 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6459 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6460 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6461 | * 6-channel independent captures. |
| 6462 | * |
| 6463 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6464 | * driver yet). |
| 6465 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6466 | #define ALC882_DIGOUT_NID 0x06 |
| 6467 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6468 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6469 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6470 | #define ALC1200_DIGOUT_NID 0x10 |
| 6471 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6472 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6473 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6474 | { 8, NULL } |
| 6475 | }; |
| 6476 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6477 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6478 | static hda_nid_t alc882_dac_nids[4] = { |
| 6479 | /* front, rear, clfe, rear_surr */ |
| 6480 | 0x02, 0x03, 0x04, 0x05 |
| 6481 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6482 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6483 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6484 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6485 | #define alc882_adc_nids alc880_adc_nids |
| 6486 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6487 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6488 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6489 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6490 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6491 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6492 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6493 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6494 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6495 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6496 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6497 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6498 | /* input MUX */ |
| 6499 | /* FIXME: should be a matrix-type input source selection */ |
| 6500 | |
| 6501 | static struct hda_input_mux alc882_capture_source = { |
| 6502 | .num_items = 4, |
| 6503 | .items = { |
| 6504 | { "Mic", 0x0 }, |
| 6505 | { "Front Mic", 0x1 }, |
| 6506 | { "Line", 0x2 }, |
| 6507 | { "CD", 0x4 }, |
| 6508 | }, |
| 6509 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6510 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6511 | #define alc883_capture_source alc882_capture_source |
| 6512 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6513 | static struct hda_input_mux alc889_capture_source = { |
| 6514 | .num_items = 3, |
| 6515 | .items = { |
| 6516 | { "Front Mic", 0x0 }, |
| 6517 | { "Mic", 0x3 }, |
| 6518 | { "Line", 0x2 }, |
| 6519 | }, |
| 6520 | }; |
| 6521 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6522 | static struct hda_input_mux mb5_capture_source = { |
| 6523 | .num_items = 3, |
| 6524 | .items = { |
| 6525 | { "Mic", 0x1 }, |
| 6526 | { "Line", 0x2 }, |
| 6527 | { "CD", 0x4 }, |
| 6528 | }, |
| 6529 | }; |
| 6530 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6531 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6532 | .num_items = 4, |
| 6533 | .items = { |
| 6534 | { "Mic", 0x1 }, |
| 6535 | { "Front Mic", 0x0 }, |
| 6536 | { "Line", 0x2 }, |
| 6537 | { "CD", 0x4 }, |
| 6538 | }, |
| 6539 | }; |
| 6540 | |
| 6541 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6542 | .num_items = 2, |
| 6543 | .items = { |
| 6544 | { "Mic", 0x1 }, |
| 6545 | { "Line", 0x2 }, |
| 6546 | }, |
| 6547 | }; |
| 6548 | |
| 6549 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6550 | .num_items = 4, |
| 6551 | .items = { |
| 6552 | { "Mic", 0x0 }, |
| 6553 | { "iMic", 0x1 }, |
| 6554 | { "Line", 0x2 }, |
| 6555 | { "CD", 0x4 }, |
| 6556 | }, |
| 6557 | }; |
| 6558 | |
| 6559 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6560 | .num_items = 2, |
| 6561 | .items = { |
| 6562 | { "Mic", 0x0 }, |
| 6563 | { "Int Mic", 0x1 }, |
| 6564 | }, |
| 6565 | }; |
| 6566 | |
| 6567 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6568 | .num_items = 3, |
| 6569 | .items = { |
| 6570 | { "Mic", 0x0 }, |
| 6571 | { "Front Mic", 0x1 }, |
| 6572 | { "Line", 0x4 }, |
| 6573 | }, |
| 6574 | }; |
| 6575 | |
| 6576 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6577 | .num_items = 2, |
| 6578 | .items = { |
| 6579 | { "Mic", 0x0 }, |
| 6580 | { "Line", 0x2 }, |
| 6581 | }, |
| 6582 | }; |
| 6583 | |
| 6584 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6585 | .num_items = 2, |
| 6586 | .items = { |
| 6587 | { "Mic", 0x0 }, |
| 6588 | /* Front Mic (0x01) unused */ |
| 6589 | { "Line", 0x2 }, |
| 6590 | /* Line 2 (0x03) unused */ |
| 6591 | /* CD (0x04) unsused? */ |
| 6592 | }, |
| 6593 | }; |
| 6594 | |
| 6595 | /* |
| 6596 | * 2ch mode |
| 6597 | */ |
| 6598 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6599 | { 2, NULL } |
| 6600 | }; |
| 6601 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6602 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6603 | * 2ch mode |
| 6604 | */ |
| 6605 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6606 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6607 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6608 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6609 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6610 | { } /* end */ |
| 6611 | }; |
| 6612 | |
| 6613 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6614 | * 4ch mode |
| 6615 | */ |
| 6616 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6617 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6618 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6619 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6620 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6621 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6622 | { } /* end */ |
| 6623 | }; |
| 6624 | |
| 6625 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6626 | * 6ch mode |
| 6627 | */ |
| 6628 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6629 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6630 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6631 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6632 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6633 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6634 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6635 | { } /* end */ |
| 6636 | }; |
| 6637 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6638 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6639 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6640 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6641 | { 6, alc882_3ST_ch6_init }, |
| 6642 | }; |
| 6643 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6644 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6645 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6646 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6647 | * 6ch mode |
| 6648 | */ |
| 6649 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6650 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6651 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6652 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6653 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6654 | { } /* end */ |
| 6655 | }; |
| 6656 | |
| 6657 | /* |
| 6658 | * 8ch mode |
| 6659 | */ |
| 6660 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6661 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6662 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6663 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6664 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6665 | { } /* end */ |
| 6666 | }; |
| 6667 | |
| 6668 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6669 | { 6, alc882_sixstack_ch6_init }, |
| 6670 | { 8, alc882_sixstack_ch8_init }, |
| 6671 | }; |
| 6672 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6673 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6674 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6675 | */ |
| 6676 | |
| 6677 | /* |
| 6678 | * 2ch mode |
| 6679 | */ |
| 6680 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6681 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6682 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6683 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6684 | { } /* end */ |
| 6685 | }; |
| 6686 | |
| 6687 | /* |
| 6688 | * 6ch mode |
| 6689 | */ |
| 6690 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6691 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6692 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6693 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6694 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6695 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6696 | { } /* end */ |
| 6697 | }; |
| 6698 | |
| 6699 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6700 | { 2, alc885_mbp_ch2_init }, |
| 6701 | { 6, alc885_mbp_ch6_init }, |
| 6702 | }; |
| 6703 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6704 | /* |
| 6705 | * 2ch |
| 6706 | * Speakers/Woofer/HP = Front |
| 6707 | * LineIn = Input |
| 6708 | */ |
| 6709 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6710 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6712 | { } /* end */ |
| 6713 | }; |
| 6714 | |
| 6715 | /* |
| 6716 | * 6ch mode |
| 6717 | * Speakers/HP = Front |
| 6718 | * Woofer = LFE |
| 6719 | * LineIn = Surround |
| 6720 | */ |
| 6721 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6722 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6723 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6724 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6725 | { } /* end */ |
| 6726 | }; |
| 6727 | |
| 6728 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6729 | { 2, alc885_mb5_ch2_init }, |
| 6730 | { 6, alc885_mb5_ch6_init }, |
| 6731 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6732 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6733 | |
| 6734 | /* |
| 6735 | * 2ch mode |
| 6736 | */ |
| 6737 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6738 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6739 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6740 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6741 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6742 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6743 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6744 | { } /* end */ |
| 6745 | }; |
| 6746 | |
| 6747 | /* |
| 6748 | * 4ch mode |
| 6749 | */ |
| 6750 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6751 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6752 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6753 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6754 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6755 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6756 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6757 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6758 | { } /* end */ |
| 6759 | }; |
| 6760 | |
| 6761 | /* |
| 6762 | * 6ch mode |
| 6763 | */ |
| 6764 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6765 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6766 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6767 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6768 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6769 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6770 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6771 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6772 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6773 | { } /* end */ |
| 6774 | }; |
| 6775 | |
| 6776 | /* |
| 6777 | * 8ch mode |
| 6778 | */ |
| 6779 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6780 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6781 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6782 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6783 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6784 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6785 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6786 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6787 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6788 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6789 | { } /* end */ |
| 6790 | }; |
| 6791 | |
| 6792 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6793 | { 2, alc883_4ST_ch2_init }, |
| 6794 | { 4, alc883_4ST_ch4_init }, |
| 6795 | { 6, alc883_4ST_ch6_init }, |
| 6796 | { 8, alc883_4ST_ch8_init }, |
| 6797 | }; |
| 6798 | |
| 6799 | |
| 6800 | /* |
| 6801 | * 2ch mode |
| 6802 | */ |
| 6803 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6804 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6805 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6806 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6807 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6808 | { } /* end */ |
| 6809 | }; |
| 6810 | |
| 6811 | /* |
| 6812 | * 4ch mode |
| 6813 | */ |
| 6814 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6815 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6816 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6817 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6818 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6819 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6820 | { } /* end */ |
| 6821 | }; |
| 6822 | |
| 6823 | /* |
| 6824 | * 6ch mode |
| 6825 | */ |
| 6826 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6827 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6828 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6829 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6830 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6831 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6832 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6833 | { } /* end */ |
| 6834 | }; |
| 6835 | |
| 6836 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6837 | { 2, alc883_3ST_ch2_intel_init }, |
| 6838 | { 4, alc883_3ST_ch4_intel_init }, |
| 6839 | { 6, alc883_3ST_ch6_intel_init }, |
| 6840 | }; |
| 6841 | |
| 6842 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6843 | * 2ch mode |
| 6844 | */ |
| 6845 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6846 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6847 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6848 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6849 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6850 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6851 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6852 | { } /* end */ |
| 6853 | }; |
| 6854 | |
| 6855 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6856 | * 6ch mode |
| 6857 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6858 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6859 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6860 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6861 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6862 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6863 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6864 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6865 | { } /* end */ |
| 6866 | }; |
| 6867 | |
| 6868 | /* |
| 6869 | * 8ch mode |
| 6870 | */ |
| 6871 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6872 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6873 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6874 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6875 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6876 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6877 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6878 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6879 | { } /* end */ |
| 6880 | }; |
| 6881 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6882 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6883 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6884 | { 6, alc889_ch6_intel_init }, |
| 6885 | { 8, alc889_ch8_intel_init }, |
| 6886 | }; |
| 6887 | |
| 6888 | /* |
| 6889 | * 6ch mode |
| 6890 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6891 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6892 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6893 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6894 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6895 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6896 | { } /* end */ |
| 6897 | }; |
| 6898 | |
| 6899 | /* |
| 6900 | * 8ch mode |
| 6901 | */ |
| 6902 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6903 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6904 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6905 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6906 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6907 | { } /* end */ |
| 6908 | }; |
| 6909 | |
| 6910 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6911 | { 6, alc883_sixstack_ch6_init }, |
| 6912 | { 8, alc883_sixstack_ch8_init }, |
| 6913 | }; |
| 6914 | |
| 6915 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6916 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6917 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6918 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6919 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6920 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6921 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6922 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6923 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6924 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6925 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6926 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6927 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6928 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6929 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6930 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6931 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6932 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6933 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6934 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6936 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6937 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6938 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6939 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6940 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6941 | { } /* end */ |
| 6942 | }; |
| 6943 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6944 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6945 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6946 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6947 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6948 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6949 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6950 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6951 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6952 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6953 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6954 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6955 | { } /* end */ |
| 6956 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6957 | |
| 6958 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6960 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6961 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6962 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6963 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6964 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6965 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6966 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6968 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6970 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6971 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6972 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6973 | { } /* end */ |
| 6974 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6975 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6976 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6977 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6978 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6979 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6980 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6981 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6982 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6983 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6984 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6985 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6986 | { } /* end */ |
| 6987 | }; |
| 6988 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6989 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6991 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6992 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6993 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6994 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6999 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7000 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7001 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7002 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7003 | { } /* end */ |
| 7004 | }; |
| 7005 | |
| 7006 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7007 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7008 | */ |
| 7009 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7010 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7011 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7013 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7014 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7015 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7016 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7017 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7018 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7019 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7022 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7023 | { } /* end */ |
| 7024 | }; |
| 7025 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7026 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7027 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7028 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7029 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7030 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7031 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7032 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7033 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7034 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7035 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7037 | { } /* end */ |
| 7038 | }; |
| 7039 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7040 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7041 | { |
| 7042 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7043 | .name = "Channel Mode", |
| 7044 | .info = alc_ch_mode_info, |
| 7045 | .get = alc_ch_mode_get, |
| 7046 | .put = alc_ch_mode_put, |
| 7047 | }, |
| 7048 | { } /* end */ |
| 7049 | }; |
| 7050 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7051 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7052 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7056 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7058 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7059 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7060 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7061 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7062 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7063 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7064 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7065 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7066 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7067 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7068 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7069 | /* mute analog input loopbacks */ |
| 7070 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7071 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7072 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7073 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7074 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7075 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7076 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7077 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7078 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7079 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7080 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7081 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7082 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7083 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7084 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7085 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7086 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7087 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7088 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7089 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7090 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7091 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7092 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7093 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7094 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7095 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7096 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7097 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7098 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7099 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7100 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7101 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7102 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7103 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7104 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7105 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7106 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7107 | |
| 7108 | /* FIXME: use matrix-type input source selection */ |
| 7109 | /* 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] | 7110 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7111 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7112 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7113 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7114 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7115 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7118 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7119 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7120 | /* ADC2: mute amp left and right */ |
| 7121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7122 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7123 | /* ADC3: mute amp left and right */ |
| 7124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7125 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7126 | |
| 7127 | { } |
| 7128 | }; |
| 7129 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7130 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7131 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7132 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7133 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7134 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7135 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7136 | /* ADC1: mute amp left and right */ |
| 7137 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7138 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7139 | { } |
| 7140 | }; |
| 7141 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7142 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7143 | /* change to EAPD mode */ |
| 7144 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7145 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7146 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7147 | }; |
| 7148 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7149 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7150 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7151 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7152 | { } |
| 7153 | }; |
| 7154 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7155 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7156 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7157 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7158 | {} |
| 7159 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7160 | |
| 7161 | static struct hda_verb alc885_init_verbs[] = { |
| 7162 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7164 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7165 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7166 | /* Rear mixer */ |
| 7167 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7168 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7169 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7170 | /* CLFE mixer */ |
| 7171 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7172 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7173 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7174 | /* Side mixer */ |
| 7175 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7176 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7177 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7178 | |
| 7179 | /* mute analog input loopbacks */ |
| 7180 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7181 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7182 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7183 | |
| 7184 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7186 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7187 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7188 | /* Front Pin: output 0 (0x0c) */ |
| 7189 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7190 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7191 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7192 | /* Rear Pin: output 1 (0x0d) */ |
| 7193 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7194 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7195 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7196 | /* CLFE Pin: output 2 (0x0e) */ |
| 7197 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7198 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7199 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7200 | /* Side Pin: output 3 (0x0f) */ |
| 7201 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7202 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7203 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7204 | /* Mic (rear) pin: input vref at 80% */ |
| 7205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7206 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7207 | /* Front Mic pin: input vref at 80% */ |
| 7208 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7209 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7210 | /* Line In pin: input */ |
| 7211 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7212 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7213 | |
| 7214 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7215 | /* Input mixer1 */ |
| 7216 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7217 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7218 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7219 | /* Input mixer2 */ |
| 7220 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7221 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7222 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7223 | /* Input mixer3 */ |
| 7224 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7225 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7226 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7227 | /* ADC2: mute amp left and right */ |
| 7228 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7229 | /* ADC3: mute amp left and right */ |
| 7230 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7231 | |
| 7232 | { } |
| 7233 | }; |
| 7234 | |
| 7235 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7236 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7237 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7238 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7239 | { } |
| 7240 | }; |
| 7241 | |
| 7242 | |
| 7243 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7244 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7245 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7246 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7247 | { } |
| 7248 | }; |
| 7249 | |
| 7250 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7251 | #define alc883_init_verbs alc882_base_init_verbs |
| 7252 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7253 | /* Mac Pro test */ |
| 7254 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7255 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7256 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7257 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7258 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7259 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7260 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7261 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7262 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7263 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7264 | { } /* end */ |
| 7265 | }; |
| 7266 | |
| 7267 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7268 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7269 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7270 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7271 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7272 | /* Front Pin: output 0 (0x0c) */ |
| 7273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7275 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7276 | /* Front Mic pin: input vref at 80% */ |
| 7277 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7278 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7279 | /* Speaker: output */ |
| 7280 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7281 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7282 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7283 | /* Headphone output (output 0 - 0x0c) */ |
| 7284 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7285 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7286 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7287 | |
| 7288 | /* FIXME: use matrix-type input source selection */ |
| 7289 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7290 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7292 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7294 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7295 | /* Input mixer2 */ |
| 7296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7297 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7299 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7300 | /* Input mixer3 */ |
| 7301 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7304 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7305 | /* ADC1: mute amp left and right */ |
| 7306 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7307 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7308 | /* ADC2: mute amp left and right */ |
| 7309 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7310 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7311 | /* ADC3: mute amp left and right */ |
| 7312 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7313 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7314 | |
| 7315 | { } |
| 7316 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7317 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7318 | /* Macbook 5,1 */ |
| 7319 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7320 | /* DACs */ |
| 7321 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7322 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7323 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7324 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7325 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7326 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7327 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7328 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7329 | /* Surround mixer */ |
| 7330 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7331 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7333 | /* LFE mixer */ |
| 7334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7335 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7336 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7337 | /* HP mixer */ |
| 7338 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7339 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7340 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7341 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7342 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7343 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7344 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7345 | /* LFE Pin (0x0e) */ |
| 7346 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7347 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7348 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7349 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7350 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7351 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7352 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7353 | /* Front Mic pin: input vref at 80% */ |
| 7354 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7355 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7356 | /* Line In pin */ |
| 7357 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7358 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7359 | |
| 7360 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7364 | { } |
| 7365 | }; |
| 7366 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7367 | /* Macbook Pro rev3 */ |
| 7368 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7369 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7371 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7372 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7373 | /* Rear mixer */ |
| 7374 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7375 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7376 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7377 | /* Front Pin: output 0 (0x0c) */ |
| 7378 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7379 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7380 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7381 | /* HP Pin: output 0 (0x0d) */ |
| 7382 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7383 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7384 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7385 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7386 | /* Mic (rear) pin: input vref at 80% */ |
| 7387 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7388 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7389 | /* Front Mic pin: input vref at 80% */ |
| 7390 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7391 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7392 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7393 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7394 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7395 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7396 | |
| 7397 | /* FIXME: use matrix-type input source selection */ |
| 7398 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7399 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7400 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7401 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7402 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7403 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7404 | /* Input mixer2 */ |
| 7405 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7406 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7407 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7409 | /* Input mixer3 */ |
| 7410 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7412 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7414 | /* ADC1: mute amp left and right */ |
| 7415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7416 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7417 | /* ADC2: mute amp left and right */ |
| 7418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7419 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7420 | /* ADC3: mute amp left and right */ |
| 7421 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7422 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7423 | |
| 7424 | { } |
| 7425 | }; |
| 7426 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7427 | /* iMac 24 mixer. */ |
| 7428 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7429 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7430 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7431 | { } /* end */ |
| 7432 | }; |
| 7433 | |
| 7434 | /* iMac 24 init verbs. */ |
| 7435 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7436 | /* Internal speakers: output 0 (0x0c) */ |
| 7437 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7439 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7440 | /* Internal speakers: output 0 (0x0c) */ |
| 7441 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7442 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7443 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7444 | /* Headphone: output 0 (0x0c) */ |
| 7445 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7446 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7447 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7448 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7449 | /* Front Mic: input vref at 80% */ |
| 7450 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7451 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7452 | { } |
| 7453 | }; |
| 7454 | |
| 7455 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7456 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7457 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7458 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7459 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7460 | spec->autocfg.hp_pins[0] = 0x14; |
| 7461 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7462 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7463 | } |
| 7464 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7465 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7466 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7467 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7468 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7469 | spec->autocfg.hp_pins[0] = 0x15; |
| 7470 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7471 | } |
| 7472 | |
| 7473 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7474 | static struct hda_verb alc882_targa_verbs[] = { |
| 7475 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7476 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7477 | |
| 7478 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7479 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7480 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7481 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7482 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7483 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7484 | |
| 7485 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7486 | { } /* end */ |
| 7487 | }; |
| 7488 | |
| 7489 | /* toggle speaker-output according to the hp-jack state */ |
| 7490 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7491 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7492 | struct alc_spec *spec = codec->spec; |
| 7493 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7494 | 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] | 7495 | spec->jack_present ? 1 : 3); |
| 7496 | } |
| 7497 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7498 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7499 | { |
| 7500 | struct alc_spec *spec = codec->spec; |
| 7501 | |
| 7502 | spec->autocfg.hp_pins[0] = 0x14; |
| 7503 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7504 | } |
| 7505 | |
| 7506 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7507 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7508 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7509 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7510 | } |
| 7511 | |
| 7512 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7514 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7515 | |
| 7516 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7517 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7518 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7519 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7520 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7522 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7523 | |
| 7524 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7525 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7526 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7527 | { } /* end */ |
| 7528 | }; |
| 7529 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7530 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7532 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7533 | |
| 7534 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7536 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7537 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7538 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7540 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7541 | |
| 7542 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7543 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7544 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7545 | { } /* end */ |
| 7546 | }; |
| 7547 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7548 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7549 | { |
| 7550 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7551 | |
| 7552 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7553 | AC_VERB_GET_GPIO_DATA, 0); |
| 7554 | |
| 7555 | if (!muted) |
| 7556 | gpiostate |= (1 << pin); |
| 7557 | else |
| 7558 | gpiostate &= ~(1 << pin); |
| 7559 | |
| 7560 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7561 | AC_VERB_GET_GPIO_MASK, 0); |
| 7562 | gpiomask |= (1 << pin); |
| 7563 | |
| 7564 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7565 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7566 | gpiodir |= (1 << pin); |
| 7567 | |
| 7568 | |
| 7569 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7570 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7571 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7572 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7573 | |
| 7574 | msleep(1); |
| 7575 | |
| 7576 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7577 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7578 | } |
| 7579 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7580 | /* set up GPIO at initialization */ |
| 7581 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7582 | { |
| 7583 | alc882_gpio_mute(codec, 0, 0); |
| 7584 | alc882_gpio_mute(codec, 1, 0); |
| 7585 | } |
| 7586 | |
| 7587 | /* set up GPIO and update auto-muting at initialization */ |
| 7588 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7589 | { |
| 7590 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7591 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7592 | } |
| 7593 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7594 | /* |
| 7595 | * generic initialization of ADC, input mixers and output mixers |
| 7596 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7597 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7598 | /* |
| 7599 | * Unmute ADC0-2 and set the default input to mic-in |
| 7600 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7601 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7602 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7603 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7604 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7605 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7606 | /* 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] | 7607 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7608 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7609 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7610 | */ |
| 7611 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7612 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7613 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7614 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7615 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7616 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7617 | |
| 7618 | /* |
| 7619 | * Set up output mixers (0x0c - 0x0f) |
| 7620 | */ |
| 7621 | /* set vol=0 to output mixers */ |
| 7622 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7623 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7624 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7625 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7626 | /* set up input amps for analog loopback */ |
| 7627 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7629 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7630 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7631 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7632 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7633 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7634 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7635 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7636 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7637 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7638 | |
| 7639 | /* FIXME: use matrix-type input source selection */ |
| 7640 | /* 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] | 7641 | /* Input mixer2 */ |
| 7642 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7643 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7644 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7645 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7646 | /* Input mixer3 */ |
| 7647 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7648 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7649 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7650 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7651 | |
| 7652 | { } |
| 7653 | }; |
| 7654 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7655 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7656 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7657 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7658 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7659 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7660 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7661 | { } /* end */ |
| 7662 | }; |
| 7663 | |
| 7664 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7665 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7666 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7667 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7668 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7669 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7670 | { } /* end */ |
| 7671 | }; |
| 7672 | |
| 7673 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7674 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7675 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7676 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7677 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7678 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7679 | { } /* end */ |
| 7680 | }; |
| 7681 | |
| 7682 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7683 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7685 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7686 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7688 | { } /* end */ |
| 7689 | }; |
| 7690 | |
| 7691 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7692 | { 2, alc889A_mb31_ch2_init }, |
| 7693 | { 4, alc889A_mb31_ch4_init }, |
| 7694 | { 5, alc889A_mb31_ch5_init }, |
| 7695 | { 6, alc889A_mb31_ch6_init }, |
| 7696 | }; |
| 7697 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7698 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7699 | /* eanable EAPD on medion laptop */ |
| 7700 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7701 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7702 | { } |
| 7703 | }; |
| 7704 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7705 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7706 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7707 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7708 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7709 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7710 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7711 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7712 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7713 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7714 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7715 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7716 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7717 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7718 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7719 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7720 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7721 | { } /* end */ |
| 7722 | }; |
| 7723 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7724 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7725 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7726 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7727 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7728 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7729 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7730 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7732 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7733 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7734 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7735 | { } /* end */ |
| 7736 | }; |
| 7737 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7738 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7739 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7740 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7741 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7742 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7744 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7745 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7746 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7747 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7748 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7749 | { } /* end */ |
| 7750 | }; |
| 7751 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7752 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7753 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7754 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7755 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7756 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7757 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7758 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7759 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7760 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7761 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7762 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7763 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7764 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7765 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7766 | { } /* end */ |
| 7767 | }; |
| 7768 | |
| 7769 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7770 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7771 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7772 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7773 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7774 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7775 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7776 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7777 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7778 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7780 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7781 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7782 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7784 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7786 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7787 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7788 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7789 | { } /* end */ |
| 7790 | }; |
| 7791 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7792 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7793 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7794 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7795 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7796 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7797 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7798 | HDA_OUTPUT), |
| 7799 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7800 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7801 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7802 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7803 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7804 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7805 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7806 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7807 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7808 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7809 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7810 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7811 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7812 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7813 | { } /* end */ |
| 7814 | }; |
| 7815 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7816 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7817 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7818 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7819 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7820 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7821 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7822 | HDA_OUTPUT), |
| 7823 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7824 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7825 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7826 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7827 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7828 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7829 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7830 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7831 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7832 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7833 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7834 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7835 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7836 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7837 | { } /* end */ |
| 7838 | }; |
| 7839 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7840 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7841 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7842 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7843 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7844 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7845 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7846 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7847 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7848 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7849 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7850 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7851 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7855 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7857 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7858 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7859 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7860 | { } /* end */ |
| 7861 | }; |
| 7862 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7863 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7864 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7866 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7867 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7868 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7869 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7870 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7871 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7872 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7873 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7874 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7875 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7876 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7877 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7878 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7880 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7881 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7882 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7883 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7884 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7886 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7887 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7888 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7889 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7890 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7892 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7893 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7894 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7895 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7896 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7897 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7898 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7899 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7900 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7901 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7902 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7903 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7905 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7907 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7908 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7909 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7910 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7911 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7912 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7913 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7914 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7915 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7916 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7917 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7918 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7919 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7920 | { } /* end */ |
| 7921 | }; |
| 7922 | |
| 7923 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7924 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7926 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7927 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7928 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7931 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7932 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7933 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7934 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7935 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7936 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7937 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7938 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7939 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7940 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7941 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7943 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7944 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7945 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7946 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7947 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7948 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 7949 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7950 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7951 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7952 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 7953 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7954 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7955 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7956 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7958 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7959 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7960 | { } /* end */ |
| 7961 | }; |
| 7962 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7963 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7964 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7965 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7966 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7967 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7968 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7969 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7970 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7971 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7972 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7973 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7974 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7975 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7976 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7977 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7978 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7980 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7981 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7982 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7983 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7984 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7985 | { } /* end */ |
| 7986 | }; |
| 7987 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7988 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 7989 | /* Output mixers */ |
| 7990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7991 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7992 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7993 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7994 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 7995 | HDA_OUTPUT), |
| 7996 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 7997 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 7998 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 7999 | /* Output switches */ |
| 8000 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8001 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8002 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8003 | /* Boost mixers */ |
| 8004 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8005 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8006 | /* Input mixers */ |
| 8007 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8008 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8009 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8010 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8011 | { } /* end */ |
| 8012 | }; |
| 8013 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8014 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8015 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8016 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8017 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8018 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8019 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8021 | { } /* end */ |
| 8022 | }; |
| 8023 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8024 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8025 | .ops = &snd_hda_bind_vol, |
| 8026 | .values = { |
| 8027 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8028 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8029 | 0 |
| 8030 | }, |
| 8031 | }; |
| 8032 | |
| 8033 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8034 | .ops = &snd_hda_bind_sw, |
| 8035 | .values = { |
| 8036 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8037 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8038 | 0 |
| 8039 | }, |
| 8040 | }; |
| 8041 | |
| 8042 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8043 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8044 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8045 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8046 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8047 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8048 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8049 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8050 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8051 | { } /* end */ |
| 8052 | }; |
| 8053 | |
| 8054 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8055 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8056 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8057 | { |
| 8058 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8059 | /* .name = "Capture Source", */ |
| 8060 | .name = "Input Source", |
| 8061 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8062 | .info = alc_mux_enum_info, |
| 8063 | .get = alc_mux_enum_get, |
| 8064 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8065 | }, |
| 8066 | { } /* end */ |
| 8067 | }; |
| 8068 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8069 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8070 | { |
| 8071 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8072 | .name = "Channel Mode", |
| 8073 | .info = alc_ch_mode_info, |
| 8074 | .get = alc_ch_mode_get, |
| 8075 | .put = alc_ch_mode_put, |
| 8076 | }, |
| 8077 | { } /* end */ |
| 8078 | }; |
| 8079 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8080 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8081 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8082 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8083 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8084 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8085 | spec->autocfg.hp_pins[0] = 0x15; |
| 8086 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8087 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8088 | } |
| 8089 | |
| 8090 | /* auto-toggle front mic */ |
| 8091 | /* |
| 8092 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8093 | { |
| 8094 | unsigned int present; |
| 8095 | unsigned char bits; |
| 8096 | |
| 8097 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8098 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8099 | bits = present ? HDA_AMP_MUTE : 0; |
| 8100 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8101 | } |
| 8102 | */ |
| 8103 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8104 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8105 | /* HP */ |
| 8106 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8107 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8108 | /* Subwoofer */ |
| 8109 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8110 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8111 | |
| 8112 | /* enable unsolicited event */ |
| 8113 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8114 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8115 | |
| 8116 | { } /* end */ |
| 8117 | }; |
| 8118 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8119 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8120 | /* HP */ |
| 8121 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8122 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8123 | /* Int speaker */ |
| 8124 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8126 | |
| 8127 | /* enable unsolicited event */ |
| 8128 | {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] | 8129 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8130 | |
| 8131 | { } /* end */ |
| 8132 | }; |
| 8133 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8134 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8135 | /* HP */ |
| 8136 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8137 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8138 | /* Subwoofer */ |
| 8139 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8140 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8141 | |
| 8142 | /* enable unsolicited event */ |
| 8143 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8144 | |
| 8145 | { } /* end */ |
| 8146 | }; |
| 8147 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8148 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8149 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8150 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8151 | |
| 8152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8153 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8154 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8155 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8156 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8157 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8158 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8159 | /* Connect Mic jack to CLFE */ |
| 8160 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8161 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8162 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8163 | /* Connect Line-in jack to Surround */ |
| 8164 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8165 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8166 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8167 | /* Connect HP out jack to Front */ |
| 8168 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8169 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8170 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8171 | |
| 8172 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8173 | |
| 8174 | { } /* end */ |
| 8175 | }; |
| 8176 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8177 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8178 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8179 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8180 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8181 | { } /* end */ |
| 8182 | }; |
| 8183 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8184 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8185 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8186 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8187 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8188 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8189 | { } /* end */ |
| 8190 | }; |
| 8191 | |
| 8192 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8193 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8194 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8195 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8196 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8197 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8198 | { } /* end */ |
| 8199 | }; |
| 8200 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8201 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8202 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8203 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8204 | |
| 8205 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8206 | |
| 8207 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8208 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8209 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8210 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8211 | { } /* end */ |
| 8212 | }; |
| 8213 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8214 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8216 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8217 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8218 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8219 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8220 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8221 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8222 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8223 | { } /* end */ |
| 8224 | }; |
| 8225 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8226 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8227 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8228 | { } |
| 8229 | }; |
| 8230 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8231 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8232 | /* HP */ |
| 8233 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8234 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8235 | |
| 8236 | /* enable unsolicited event */ |
| 8237 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8238 | |
| 8239 | { } /* end */ |
| 8240 | }; |
| 8241 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8242 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8243 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8244 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8245 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8246 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8247 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8248 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8249 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8250 | } |
| 8251 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8252 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8253 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8254 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8255 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8256 | {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] | 8257 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8258 | }; |
| 8259 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8260 | /* |
| 8261 | * 2ch mode |
| 8262 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8263 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8264 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8265 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8266 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8267 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8268 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8269 | }; |
| 8270 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8271 | /* |
| 8272 | * 4ch mode |
| 8273 | */ |
| 8274 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8275 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8276 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8277 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8278 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8279 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8280 | { } /* end */ |
| 8281 | }; |
| 8282 | |
| 8283 | /* |
| 8284 | * 6ch mode |
| 8285 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8286 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8287 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8288 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8289 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8290 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8291 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8292 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8293 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8294 | }; |
| 8295 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8296 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8297 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8298 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8299 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8300 | }; |
| 8301 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8302 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8303 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8304 | { |
| 8305 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8306 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8307 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8308 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8309 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8310 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8311 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8312 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8313 | } |
| 8314 | |
| 8315 | /* toggle RCA according to the front-jack state */ |
| 8316 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8317 | { |
| 8318 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8319 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8320 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8321 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8322 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8323 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8324 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8325 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8326 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8327 | unsigned int res) |
| 8328 | { |
| 8329 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8330 | alc888_lenovo_ms7195_front_automute(codec); |
| 8331 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8332 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8333 | } |
| 8334 | |
| 8335 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8336 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8338 | |
| 8339 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8340 | |
| 8341 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8342 | { } /* end */ |
| 8343 | }; |
| 8344 | |
| 8345 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8346 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8347 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8348 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8349 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8350 | spec->autocfg.hp_pins[0] = 0x14; |
| 8351 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8352 | } |
| 8353 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8354 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8355 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8356 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8357 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8358 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8359 | { |
| 8360 | unsigned int present; |
| 8361 | |
| 8362 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8363 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8364 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8365 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8366 | } |
| 8367 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8368 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8369 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8370 | struct alc_spec *spec = codec->spec; |
| 8371 | |
| 8372 | spec->autocfg.hp_pins[0] = 0x15; |
| 8373 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8374 | } |
| 8375 | |
| 8376 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8377 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8378 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8379 | alc883_clevo_m720_mic_automute(codec); |
| 8380 | } |
| 8381 | |
| 8382 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8383 | unsigned int res) |
| 8384 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8385 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8386 | case ALC880_MIC_EVENT: |
| 8387 | alc883_clevo_m720_mic_automute(codec); |
| 8388 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8389 | default: |
| 8390 | alc_automute_amp_unsol_event(codec, res); |
| 8391 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8392 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8393 | } |
| 8394 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8395 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8396 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8397 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8398 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8399 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8400 | spec->autocfg.hp_pins[0] = 0x14; |
| 8401 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8402 | } |
| 8403 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8404 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8405 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8406 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8407 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8408 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8409 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8410 | } |
| 8411 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8412 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8413 | { |
| 8414 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8415 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8416 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8417 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8418 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8419 | bits = present ? HDA_AMP_MUTE : 0; |
| 8420 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8421 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8422 | } |
| 8423 | |
| 8424 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8425 | { |
| 8426 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8427 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8428 | |
| 8429 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8430 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8431 | bits = present ? HDA_AMP_MUTE : 0; |
| 8432 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8433 | HDA_AMP_MUTE, bits); |
| 8434 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8435 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8436 | } |
| 8437 | |
| 8438 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8439 | unsigned int res) |
| 8440 | { |
| 8441 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8442 | alc883_lenovo_101e_all_automute(codec); |
| 8443 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8444 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8445 | } |
| 8446 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8447 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8448 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8449 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8450 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8451 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8452 | spec->autocfg.hp_pins[0] = 0x14; |
| 8453 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8454 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8455 | } |
| 8456 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8457 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8458 | /* HP Pin: output 0 (0x0c) */ |
| 8459 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8460 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8461 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8462 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8463 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8464 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8465 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8466 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8467 | /* eanable EAPD on medion laptop */ |
| 8468 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8469 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8470 | /* enable unsolicited event */ |
| 8471 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8472 | { } |
| 8473 | }; |
| 8474 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8475 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8476 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8477 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8478 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8479 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8480 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8481 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8482 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8483 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8484 | } |
| 8485 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8486 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8487 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8488 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8489 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8490 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8491 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8492 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8493 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8494 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8495 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8496 | } |
| 8497 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8498 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8499 | { |
| 8500 | struct alc_spec *spec = codec->spec; |
| 8501 | |
| 8502 | spec->autocfg.hp_pins[0] = 0x15; |
| 8503 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8504 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8505 | } |
| 8506 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8507 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8508 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8509 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8510 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8511 | /* enable unsolicited event */ |
| 8512 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8513 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8514 | { } /* end */ |
| 8515 | }; |
| 8516 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8517 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8518 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8519 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8520 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8521 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8522 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8523 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8524 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8525 | spec->ext_mic.pin = 0x18; |
| 8526 | spec->int_mic.pin = 0x19; |
| 8527 | spec->ext_mic.mux_idx = 0; |
| 8528 | spec->int_mic.mux_idx = 1; |
| 8529 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8530 | } |
| 8531 | |
| 8532 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8533 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8534 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8535 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8536 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8537 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8538 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8539 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8540 | /* enable unsolicited event */ |
| 8541 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8542 | { } /* end */ |
| 8543 | }; |
| 8544 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8545 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8546 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8547 | struct alc_spec *spec = codec->spec; |
| 8548 | |
| 8549 | spec->autocfg.hp_pins[0] = 0x14; |
| 8550 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8551 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8552 | } |
| 8553 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8554 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8555 | /* Init rear pin (used as headphone output) */ |
| 8556 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8557 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8558 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8559 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8560 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8561 | /* Init line 2 pin (used as headphone out by default) */ |
| 8562 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8563 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8564 | { } /* end */ |
| 8565 | }; |
| 8566 | |
| 8567 | /* Mute speakers according to the headphone jack state */ |
| 8568 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8569 | { |
| 8570 | unsigned int present; |
| 8571 | |
| 8572 | /* Mute only in 2ch or 4ch mode */ |
| 8573 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8574 | == 0x00) { |
| 8575 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8576 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8577 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8578 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8579 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8580 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8581 | } |
| 8582 | } |
| 8583 | |
| 8584 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8585 | { |
| 8586 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8587 | alc889A_mb31_automute(codec); |
| 8588 | } |
| 8589 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8590 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8591 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8592 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8593 | #endif |
| 8594 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8595 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8596 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8597 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8598 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8599 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8600 | |
| 8601 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8602 | ALC1200_DIGOUT_NID, 0, |
| 8603 | }; |
| 8604 | |
| 8605 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8606 | ALC883_DIGOUT_NID, 0, |
| 8607 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8608 | |
| 8609 | /* |
| 8610 | * configuration and preset |
| 8611 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8612 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8613 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8614 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8615 | [ALC882_ARIMA] = "arima", |
| 8616 | [ALC882_W2JC] = "w2jc", |
| 8617 | [ALC882_TARGA] = "targa", |
| 8618 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8619 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8620 | [ALC885_MACPRO] = "macpro", |
| 8621 | [ALC885_MB5] = "mb5", |
| 8622 | [ALC885_MBP3] = "mbp3", |
| 8623 | [ALC885_IMAC24] = "imac24", |
| 8624 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8625 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8626 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8627 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8628 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8629 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8630 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8631 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8632 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8633 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8634 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8635 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8636 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8637 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8638 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8639 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8640 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8641 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8642 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8643 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8644 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8645 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8646 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8647 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8648 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8649 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8650 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8651 | [ALC889A_INTEL] = "intel-alc889a", |
| 8652 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8653 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8654 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8655 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8656 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8657 | }; |
| 8658 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8659 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8660 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8661 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8662 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8663 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8664 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8665 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8666 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8667 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8668 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8669 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8670 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8671 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8672 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8673 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8674 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8675 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8676 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8677 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8678 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8679 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8680 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8681 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8682 | /* default Acer -- disabled as it causes more problems. |
| 8683 | * model=auto should work fine now |
| 8684 | */ |
| 8685 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8686 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8687 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8688 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8689 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8690 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8691 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8692 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8693 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8694 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8695 | |
| 8696 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8697 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8698 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8699 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8700 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8701 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8702 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8703 | 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] | 8704 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8705 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8706 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8707 | |
| 8708 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8709 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8710 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8711 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8712 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8713 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8714 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8715 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8716 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8717 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8718 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8719 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8720 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8721 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8722 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8723 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8724 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8725 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8726 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8727 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8728 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8729 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8730 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8731 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8732 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8733 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8734 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8735 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8736 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8737 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8738 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8739 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8740 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8741 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8742 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8743 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8744 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8745 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8746 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8747 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8748 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8749 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8750 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8751 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8752 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8753 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8754 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8755 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8756 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8757 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8758 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8759 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8760 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8761 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8762 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8763 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8764 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8765 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8766 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8767 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8768 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8769 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8770 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8771 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8772 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8773 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8774 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8775 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8776 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8777 | {} |
| 8778 | }; |
| 8779 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8780 | /* codec SSID table for Intel Mac */ |
| 8781 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8782 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8783 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8784 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8785 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8786 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8787 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8788 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8789 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8790 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8791 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8792 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8793 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8794 | * no perfect solution yet |
| 8795 | */ |
| 8796 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8797 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8798 | }; |
| 8799 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8800 | static struct alc_config_preset alc882_presets[] = { |
| 8801 | [ALC882_3ST_DIG] = { |
| 8802 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8803 | .init_verbs = { alc882_base_init_verbs, |
| 8804 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8805 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8806 | .dac_nids = alc882_dac_nids, |
| 8807 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8808 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8809 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8810 | .channel_mode = alc882_ch_modes, |
| 8811 | .need_dac_fix = 1, |
| 8812 | .input_mux = &alc882_capture_source, |
| 8813 | }, |
| 8814 | [ALC882_6ST_DIG] = { |
| 8815 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8816 | .init_verbs = { alc882_base_init_verbs, |
| 8817 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8818 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8819 | .dac_nids = alc882_dac_nids, |
| 8820 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8821 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8822 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8823 | .channel_mode = alc882_sixstack_modes, |
| 8824 | .input_mux = &alc882_capture_source, |
| 8825 | }, |
| 8826 | [ALC882_ARIMA] = { |
| 8827 | .mixers = { alc882_base_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 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8830 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8831 | .dac_nids = alc882_dac_nids, |
| 8832 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8833 | .channel_mode = alc882_sixstack_modes, |
| 8834 | .input_mux = &alc882_capture_source, |
| 8835 | }, |
| 8836 | [ALC882_W2JC] = { |
| 8837 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8838 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8839 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8840 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8841 | .dac_nids = alc882_dac_nids, |
| 8842 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8843 | .channel_mode = alc880_threestack_modes, |
| 8844 | .need_dac_fix = 1, |
| 8845 | .input_mux = &alc882_capture_source, |
| 8846 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8847 | }, |
| 8848 | [ALC885_MBP3] = { |
| 8849 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8850 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8851 | alc880_gpio1_init_verbs }, |
| 8852 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8853 | .dac_nids = alc882_dac_nids, |
| 8854 | .channel_mode = alc885_mbp_6ch_modes, |
| 8855 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 8856 | .input_mux = &alc882_capture_source, |
| 8857 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8858 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8859 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8860 | .setup = alc885_mbp3_setup, |
| 8861 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8862 | }, |
| 8863 | [ALC885_MB5] = { |
| 8864 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8865 | .init_verbs = { alc885_mb5_init_verbs, |
| 8866 | alc880_gpio1_init_verbs }, |
| 8867 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8868 | .dac_nids = alc882_dac_nids, |
| 8869 | .channel_mode = alc885_mb5_6ch_modes, |
| 8870 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8871 | .input_mux = &mb5_capture_source, |
| 8872 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8873 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8874 | }, |
| 8875 | [ALC885_MACPRO] = { |
| 8876 | .mixers = { alc882_macpro_mixer }, |
| 8877 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8878 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8879 | .dac_nids = alc882_dac_nids, |
| 8880 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8881 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8882 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8883 | .channel_mode = alc882_ch_modes, |
| 8884 | .input_mux = &alc882_capture_source, |
| 8885 | .init_hook = alc885_macpro_init_hook, |
| 8886 | }, |
| 8887 | [ALC885_IMAC24] = { |
| 8888 | .mixers = { alc885_imac24_mixer }, |
| 8889 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8890 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8891 | .dac_nids = alc882_dac_nids, |
| 8892 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8893 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8894 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8895 | .channel_mode = alc882_ch_modes, |
| 8896 | .input_mux = &alc882_capture_source, |
| 8897 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8898 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8899 | .init_hook = alc885_imac24_init_hook, |
| 8900 | }, |
| 8901 | [ALC882_TARGA] = { |
| 8902 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8903 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 8904 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8905 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8906 | .dac_nids = alc882_dac_nids, |
| 8907 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8908 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8909 | .adc_nids = alc882_adc_nids, |
| 8910 | .capsrc_nids = alc882_capsrc_nids, |
| 8911 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8912 | .channel_mode = alc882_3ST_6ch_modes, |
| 8913 | .need_dac_fix = 1, |
| 8914 | .input_mux = &alc882_capture_source, |
| 8915 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8916 | .setup = alc882_targa_setup, |
| 8917 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8918 | }, |
| 8919 | [ALC882_ASUS_A7J] = { |
| 8920 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8921 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8922 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8923 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8924 | .dac_nids = alc882_dac_nids, |
| 8925 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8926 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8927 | .adc_nids = alc882_adc_nids, |
| 8928 | .capsrc_nids = alc882_capsrc_nids, |
| 8929 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8930 | .channel_mode = alc882_3ST_6ch_modes, |
| 8931 | .need_dac_fix = 1, |
| 8932 | .input_mux = &alc882_capture_source, |
| 8933 | }, |
| 8934 | [ALC882_ASUS_A7M] = { |
| 8935 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8936 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8937 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8938 | alc882_asus_a7m_verbs }, |
| 8939 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8940 | .dac_nids = alc882_dac_nids, |
| 8941 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8942 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8943 | .channel_mode = alc880_threestack_modes, |
| 8944 | .need_dac_fix = 1, |
| 8945 | .input_mux = &alc882_capture_source, |
| 8946 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8947 | [ALC883_3ST_2ch_DIG] = { |
| 8948 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8949 | .init_verbs = { alc883_init_verbs }, |
| 8950 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8951 | .dac_nids = alc883_dac_nids, |
| 8952 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8953 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8954 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8955 | .channel_mode = alc883_3ST_2ch_modes, |
| 8956 | .input_mux = &alc883_capture_source, |
| 8957 | }, |
| 8958 | [ALC883_3ST_6ch_DIG] = { |
| 8959 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8960 | .init_verbs = { alc883_init_verbs }, |
| 8961 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8962 | .dac_nids = alc883_dac_nids, |
| 8963 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8964 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8965 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8966 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8967 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8968 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8969 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8970 | [ALC883_3ST_6ch] = { |
| 8971 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8972 | .init_verbs = { alc883_init_verbs }, |
| 8973 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8974 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8975 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8976 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8977 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8978 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8979 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8980 | [ALC883_3ST_6ch_INTEL] = { |
| 8981 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8982 | .init_verbs = { alc883_init_verbs }, |
| 8983 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8984 | .dac_nids = alc883_dac_nids, |
| 8985 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8986 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8987 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8988 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8989 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8990 | .need_dac_fix = 1, |
| 8991 | .input_mux = &alc883_3stack_6ch_intel, |
| 8992 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8993 | [ALC889A_INTEL] = { |
| 8994 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8995 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 8996 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8997 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8998 | .dac_nids = alc883_dac_nids, |
| 8999 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9000 | .adc_nids = alc889_adc_nids, |
| 9001 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9002 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9003 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9004 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9005 | .channel_mode = alc889_8ch_intel_modes, |
| 9006 | .capsrc_nids = alc889_capsrc_nids, |
| 9007 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9008 | .setup = alc889_automute_setup, |
| 9009 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9010 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9011 | .need_dac_fix = 1, |
| 9012 | }, |
| 9013 | [ALC889_INTEL] = { |
| 9014 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9015 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9016 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9017 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9018 | .dac_nids = alc883_dac_nids, |
| 9019 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9020 | .adc_nids = alc889_adc_nids, |
| 9021 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9022 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9023 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9024 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9025 | .channel_mode = alc889_8ch_intel_modes, |
| 9026 | .capsrc_nids = alc889_capsrc_nids, |
| 9027 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9028 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9029 | .init_hook = alc889_intel_init_hook, |
| 9030 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9031 | .need_dac_fix = 1, |
| 9032 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9033 | [ALC883_6ST_DIG] = { |
| 9034 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9035 | .init_verbs = { alc883_init_verbs }, |
| 9036 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9037 | .dac_nids = alc883_dac_nids, |
| 9038 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9039 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9040 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9041 | .channel_mode = alc883_sixstack_modes, |
| 9042 | .input_mux = &alc883_capture_source, |
| 9043 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9044 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9045 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9046 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9047 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9048 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9049 | .dac_nids = alc883_dac_nids, |
| 9050 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9051 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9052 | .channel_mode = alc883_3ST_6ch_modes, |
| 9053 | .need_dac_fix = 1, |
| 9054 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9055 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9056 | .setup = alc882_targa_setup, |
| 9057 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9058 | }, |
| 9059 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9060 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9061 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9062 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9063 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9064 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9065 | .adc_nids = alc883_adc_nids_alt, |
| 9066 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9067 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9068 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9069 | .channel_mode = alc883_3ST_2ch_modes, |
| 9070 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9071 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9072 | .setup = alc882_targa_setup, |
| 9073 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9074 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9075 | [ALC883_TARGA_8ch_DIG] = { |
| 9076 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9077 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9078 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9079 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9080 | .dac_nids = alc883_dac_nids, |
| 9081 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9082 | .adc_nids = alc883_adc_nids_rev, |
| 9083 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9084 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9085 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9086 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9087 | .channel_mode = alc883_4ST_8ch_modes, |
| 9088 | .need_dac_fix = 1, |
| 9089 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9090 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9091 | .setup = alc882_targa_setup, |
| 9092 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9093 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9094 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9095 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9096 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9097 | * and the headphone jack. Turn this on and rely on the |
| 9098 | * standard mute methods whenever the user wants to turn |
| 9099 | * these outputs off. |
| 9100 | */ |
| 9101 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9102 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9103 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9104 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9105 | .channel_mode = alc883_3ST_2ch_modes, |
| 9106 | .input_mux = &alc883_capture_source, |
| 9107 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9108 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9109 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9110 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9111 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9112 | .dac_nids = alc883_dac_nids, |
| 9113 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9114 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9115 | .channel_mode = alc883_3ST_2ch_modes, |
| 9116 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9117 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9118 | .setup = alc883_acer_aspire_setup, |
| 9119 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9120 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9121 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9122 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9123 | alc883_chmode_mixer }, |
| 9124 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9125 | alc888_acer_aspire_4930g_verbs }, |
| 9126 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9127 | .dac_nids = alc883_dac_nids, |
| 9128 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9129 | .adc_nids = alc883_adc_nids_rev, |
| 9130 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9131 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9132 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9133 | .channel_mode = alc883_3ST_6ch_modes, |
| 9134 | .need_dac_fix = 1, |
| 9135 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9136 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9137 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9138 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9139 | .setup = alc888_acer_aspire_4930g_setup, |
| 9140 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9141 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9142 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9143 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9144 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9145 | alc888_acer_aspire_6530g_verbs }, |
| 9146 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9147 | .dac_nids = alc883_dac_nids, |
| 9148 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9149 | .adc_nids = alc883_adc_nids_rev, |
| 9150 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9151 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9152 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9153 | .channel_mode = alc883_3ST_2ch_modes, |
| 9154 | .num_mux_defs = |
| 9155 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9156 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9157 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9158 | .setup = alc888_acer_aspire_6530g_setup, |
| 9159 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9160 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9161 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9162 | .mixers = { alc888_base_mixer, |
| 9163 | alc883_chmode_mixer }, |
| 9164 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9165 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9166 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9167 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9168 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9169 | .adc_nids = alc889_adc_nids, |
| 9170 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9171 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9172 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9173 | .channel_mode = alc883_3ST_6ch_modes, |
| 9174 | .need_dac_fix = 1, |
| 9175 | .const_channel_count = 6, |
| 9176 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9177 | ARRAY_SIZE(alc889_capture_sources), |
| 9178 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9179 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9180 | .setup = alc889_acer_aspire_8930g_setup, |
| 9181 | .init_hook = alc_automute_amp, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9182 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9183 | [ALC883_MEDION] = { |
| 9184 | .mixers = { alc883_fivestack_mixer, |
| 9185 | alc883_chmode_mixer }, |
| 9186 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9187 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9188 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9189 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9190 | .adc_nids = alc883_adc_nids_alt, |
| 9191 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9192 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9193 | .channel_mode = alc883_sixstack_modes, |
| 9194 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9195 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9196 | [ALC883_MEDION_MD2] = { |
| 9197 | .mixers = { alc883_medion_md2_mixer}, |
| 9198 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9199 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9200 | .dac_nids = alc883_dac_nids, |
| 9201 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9202 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9203 | .channel_mode = alc883_3ST_2ch_modes, |
| 9204 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9205 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9206 | .setup = alc883_medion_md2_setup, |
| 9207 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9208 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9209 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9210 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9211 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9212 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9213 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9215 | .channel_mode = alc883_3ST_2ch_modes, |
| 9216 | .input_mux = &alc883_capture_source, |
| 9217 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9218 | [ALC883_CLEVO_M720] = { |
| 9219 | .mixers = { alc883_clevo_m720_mixer }, |
| 9220 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9221 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9222 | .dac_nids = alc883_dac_nids, |
| 9223 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9224 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9225 | .channel_mode = alc883_3ST_2ch_modes, |
| 9226 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9227 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9228 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9229 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9230 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9231 | [ALC883_LENOVO_101E_2ch] = { |
| 9232 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9233 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9234 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9235 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9236 | .adc_nids = alc883_adc_nids_alt, |
| 9237 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9238 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9239 | .channel_mode = alc883_3ST_2ch_modes, |
| 9240 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9241 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9242 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9243 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9244 | [ALC883_LENOVO_NB0763] = { |
| 9245 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9246 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9247 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9248 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9249 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9250 | .channel_mode = alc883_3ST_2ch_modes, |
| 9251 | .need_dac_fix = 1, |
| 9252 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9253 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9254 | .setup = alc883_medion_md2_setup, |
| 9255 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9256 | }, |
| 9257 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9258 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9259 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9260 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9261 | .dac_nids = alc883_dac_nids, |
| 9262 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9263 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9264 | .channel_mode = alc883_3ST_6ch_modes, |
| 9265 | .need_dac_fix = 1, |
| 9266 | .input_mux = &alc883_capture_source, |
| 9267 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9268 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9269 | }, |
| 9270 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9271 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9272 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9273 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9274 | .dac_nids = alc883_dac_nids, |
| 9275 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9276 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9277 | .channel_mode = alc883_3ST_2ch_modes, |
| 9278 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9279 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9280 | .setup = alc883_haier_w66_setup, |
| 9281 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9282 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9283 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9284 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9285 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9286 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9287 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9288 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9289 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9290 | .need_dac_fix = 1, |
| 9291 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9292 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9293 | .setup = alc888_3st_hp_setup, |
| 9294 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9295 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9296 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9297 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9298 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9299 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9300 | .dac_nids = alc883_dac_nids, |
| 9301 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9302 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9303 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9304 | .channel_mode = alc883_sixstack_modes, |
| 9305 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9306 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9307 | .setup = alc888_6st_dell_setup, |
| 9308 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9309 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9310 | [ALC883_MITAC] = { |
| 9311 | .mixers = { alc883_mitac_mixer }, |
| 9312 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9313 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9314 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9315 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9316 | .channel_mode = alc883_3ST_2ch_modes, |
| 9317 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9318 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9319 | .setup = alc883_mitac_setup, |
| 9320 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9321 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9322 | [ALC883_FUJITSU_PI2515] = { |
| 9323 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9324 | .init_verbs = { alc883_init_verbs, |
| 9325 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9326 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9327 | .dac_nids = alc883_dac_nids, |
| 9328 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9329 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9330 | .channel_mode = alc883_3ST_2ch_modes, |
| 9331 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9332 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9333 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9334 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9335 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9336 | [ALC888_FUJITSU_XA3530] = { |
| 9337 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9338 | .init_verbs = { alc883_init_verbs, |
| 9339 | alc888_fujitsu_xa3530_verbs }, |
| 9340 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9341 | .dac_nids = alc883_dac_nids, |
| 9342 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9343 | .adc_nids = alc883_adc_nids_rev, |
| 9344 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9345 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9346 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9347 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9348 | .num_mux_defs = |
| 9349 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9350 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9351 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9352 | .setup = alc888_fujitsu_xa3530_setup, |
| 9353 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9354 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9355 | [ALC888_LENOVO_SKY] = { |
| 9356 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9357 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9358 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9359 | .dac_nids = alc883_dac_nids, |
| 9360 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9361 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9362 | .channel_mode = alc883_sixstack_modes, |
| 9363 | .need_dac_fix = 1, |
| 9364 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9365 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9366 | .setup = alc888_lenovo_sky_setup, |
| 9367 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9368 | }, |
| 9369 | [ALC888_ASUS_M90V] = { |
| 9370 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9371 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9372 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9373 | .dac_nids = alc883_dac_nids, |
| 9374 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9375 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9376 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9377 | .channel_mode = alc883_3ST_6ch_modes, |
| 9378 | .need_dac_fix = 1, |
| 9379 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9380 | .unsol_event = alc_sku_unsol_event, |
| 9381 | .setup = alc883_mode2_setup, |
| 9382 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9383 | }, |
| 9384 | [ALC888_ASUS_EEE1601] = { |
| 9385 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9386 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9387 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9388 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9389 | .dac_nids = alc883_dac_nids, |
| 9390 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9391 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9392 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9393 | .channel_mode = alc883_3ST_2ch_modes, |
| 9394 | .need_dac_fix = 1, |
| 9395 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9396 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9397 | .init_hook = alc883_eee1601_inithook, |
| 9398 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9399 | [ALC1200_ASUS_P5Q] = { |
| 9400 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9401 | .init_verbs = { alc883_init_verbs }, |
| 9402 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9403 | .dac_nids = alc883_dac_nids, |
| 9404 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9405 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9406 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9407 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9408 | .channel_mode = alc883_sixstack_modes, |
| 9409 | .input_mux = &alc883_capture_source, |
| 9410 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9411 | [ALC889A_MB31] = { |
| 9412 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9413 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9414 | alc880_gpio1_init_verbs }, |
| 9415 | .adc_nids = alc883_adc_nids, |
| 9416 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9417 | .dac_nids = alc883_dac_nids, |
| 9418 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9419 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9420 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9421 | .input_mux = &alc889A_mb31_capture_source, |
| 9422 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9423 | .unsol_event = alc889A_mb31_unsol_event, |
| 9424 | .init_hook = alc889A_mb31_automute, |
| 9425 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9426 | [ALC883_SONY_VAIO_TT] = { |
| 9427 | .mixers = { alc883_vaiott_mixer }, |
| 9428 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9429 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9430 | .dac_nids = alc883_dac_nids, |
| 9431 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9432 | .channel_mode = alc883_3ST_2ch_modes, |
| 9433 | .input_mux = &alc883_capture_source, |
| 9434 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9435 | .setup = alc883_vaiott_setup, |
| 9436 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9437 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9438 | }; |
| 9439 | |
| 9440 | |
| 9441 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9442 | * Pin config fixes |
| 9443 | */ |
| 9444 | enum { |
| 9445 | PINFIX_ABIT_AW9D_MAX |
| 9446 | }; |
| 9447 | |
| 9448 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9449 | { 0x15, 0x01080104 }, /* side */ |
| 9450 | { 0x16, 0x01011012 }, /* rear */ |
| 9451 | { 0x17, 0x01016011 }, /* clfe */ |
| 9452 | { } |
| 9453 | }; |
| 9454 | |
| 9455 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9456 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9457 | }; |
| 9458 | |
| 9459 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9460 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9461 | {} |
| 9462 | }; |
| 9463 | |
| 9464 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9465 | * BIOS auto configuration |
| 9466 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9467 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9468 | hda_nid_t nid, int pin_type, |
| 9469 | int dac_idx) |
| 9470 | { |
| 9471 | /* set as output */ |
| 9472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9473 | int idx; |
| 9474 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9475 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9476 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9477 | idx = 4; |
| 9478 | else |
| 9479 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9480 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9481 | |
| 9482 | } |
| 9483 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9484 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9485 | { |
| 9486 | struct alc_spec *spec = codec->spec; |
| 9487 | int i; |
| 9488 | |
| 9489 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9490 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9491 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9492 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9493 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9494 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9495 | } |
| 9496 | } |
| 9497 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9498 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9499 | { |
| 9500 | struct alc_spec *spec = codec->spec; |
| 9501 | hda_nid_t pin; |
| 9502 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9503 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9504 | if (pin) /* connect to front */ |
| 9505 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9506 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9507 | pin = spec->autocfg.speaker_pins[0]; |
| 9508 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9509 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9510 | } |
| 9511 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9512 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9513 | { |
| 9514 | struct alc_spec *spec = codec->spec; |
| 9515 | int i; |
| 9516 | |
| 9517 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9518 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9519 | if (!nid) |
| 9520 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9521 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9522 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9523 | snd_hda_codec_write(codec, nid, 0, |
| 9524 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9525 | AMP_OUT_MUTE); |
| 9526 | } |
| 9527 | } |
| 9528 | |
| 9529 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9530 | { |
| 9531 | struct alc_spec *spec = codec->spec; |
| 9532 | int c; |
| 9533 | |
| 9534 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9535 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9536 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9537 | unsigned int mux_idx; |
| 9538 | const struct hda_input_mux *imux; |
| 9539 | int conns, mute, idx, item; |
| 9540 | |
| 9541 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9542 | ARRAY_SIZE(conn_list)); |
| 9543 | if (conns < 0) |
| 9544 | continue; |
| 9545 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9546 | imux = &spec->input_mux[mux_idx]; |
| 9547 | for (idx = 0; idx < conns; idx++) { |
| 9548 | /* if the current connection is the selected one, |
| 9549 | * unmute it as default - otherwise mute it |
| 9550 | */ |
| 9551 | mute = AMP_IN_MUTE(idx); |
| 9552 | for (item = 0; item < imux->num_items; item++) { |
| 9553 | if (imux->items[item].index == idx) { |
| 9554 | if (spec->cur_mux[c] == item) |
| 9555 | mute = AMP_IN_UNMUTE(idx); |
| 9556 | break; |
| 9557 | } |
| 9558 | } |
| 9559 | /* check if we have a selector or mixer |
| 9560 | * we could check for the widget type instead, but |
| 9561 | * just check for Amp-In presence (in case of mixer |
| 9562 | * without amp-in there is something wrong, this |
| 9563 | * function shouldn't be used or capsrc nid is wrong) |
| 9564 | */ |
| 9565 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9566 | snd_hda_codec_write(codec, nid, 0, |
| 9567 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9568 | mute); |
| 9569 | else if (mute != AMP_IN_MUTE(idx)) |
| 9570 | snd_hda_codec_write(codec, nid, 0, |
| 9571 | AC_VERB_SET_CONNECT_SEL, |
| 9572 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9573 | } |
| 9574 | } |
| 9575 | } |
| 9576 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9577 | /* add mic boosts if needed */ |
| 9578 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9579 | { |
| 9580 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9581 | int err; |
| 9582 | hda_nid_t nid; |
| 9583 | |
| 9584 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9585 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9586 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9587 | "Mic Boost", |
| 9588 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9589 | if (err < 0) |
| 9590 | return err; |
| 9591 | } |
| 9592 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9593 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9594 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9595 | "Front Mic Boost", |
| 9596 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9597 | if (err < 0) |
| 9598 | return err; |
| 9599 | } |
| 9600 | return 0; |
| 9601 | } |
| 9602 | |
| 9603 | /* almost identical with ALC880 parser... */ |
| 9604 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9605 | { |
| 9606 | struct alc_spec *spec = codec->spec; |
| 9607 | struct auto_pin_cfg *autocfg = &spec->autocfg; |
| 9608 | unsigned int wcap; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9609 | int i; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9610 | int err = alc880_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9611 | |
| 9612 | if (err < 0) |
| 9613 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9614 | else if (!err) |
| 9615 | return 0; /* no config found */ |
| 9616 | |
| 9617 | err = alc_auto_add_mic_boost(codec); |
| 9618 | if (err < 0) |
| 9619 | return err; |
| 9620 | |
| 9621 | /* hack - override the init verbs */ |
| 9622 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9623 | /* if ADC 0x07 is available, initialize it, too */ |
| 9624 | wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9625 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9626 | if (wcap == AC_WID_AUD_IN) |
| 9627 | add_verb(spec, alc882_adc1_init_verbs); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9628 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9629 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9630 | * because it's under 0x18 |
| 9631 | */ |
| 9632 | if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9633 | autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9634 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9635 | for (i = 1; i < 3; i++) |
| 9636 | memcpy(&spec->private_imux[i], |
| 9637 | &spec->private_imux[0], |
| 9638 | sizeof(spec->private_imux[0])); |
| 9639 | imux->items[imux->num_items].label = "Int DMic"; |
| 9640 | imux->items[imux->num_items].index = 0x0b; |
| 9641 | imux->num_items++; |
| 9642 | spec->num_mux_defs = 3; |
| 9643 | spec->input_mux = spec->private_imux; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9644 | } |
| 9645 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9646 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9647 | } |
| 9648 | |
| 9649 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9650 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9651 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9652 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9653 | alc882_auto_init_multi_out(codec); |
| 9654 | alc882_auto_init_hp_out(codec); |
| 9655 | alc882_auto_init_analog_input(codec); |
| 9656 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9657 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9658 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9659 | } |
| 9660 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9661 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9662 | { |
| 9663 | struct alc_spec *spec; |
| 9664 | int err, board_config; |
| 9665 | |
| 9666 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9667 | if (spec == NULL) |
| 9668 | return -ENOMEM; |
| 9669 | |
| 9670 | codec->spec = spec; |
| 9671 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9672 | switch (codec->vendor_id) { |
| 9673 | case 0x10ec0882: |
| 9674 | case 0x10ec0885: |
| 9675 | break; |
| 9676 | default: |
| 9677 | /* ALC883 and variants */ |
| 9678 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9679 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9680 | } |
| 9681 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9682 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9683 | alc882_models, |
| 9684 | alc882_cfg_tbl); |
| 9685 | |
| 9686 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9687 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9688 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9689 | |
| 9690 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9691 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9692 | codec->chip_name); |
| 9693 | board_config = ALC882_AUTO; |
| 9694 | } |
| 9695 | |
| 9696 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9697 | |
| 9698 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9699 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9700 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9701 | if (err < 0) { |
| 9702 | alc_free(codec); |
| 9703 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9704 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9705 | printk(KERN_INFO |
| 9706 | "hda_codec: Cannot set up configuration " |
| 9707 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9708 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9709 | } |
| 9710 | } |
| 9711 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9712 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9713 | if (err < 0) { |
| 9714 | alc_free(codec); |
| 9715 | return err; |
| 9716 | } |
| 9717 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9718 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 9719 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9720 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9721 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9722 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9723 | /* FIXME: setup DAC5 */ |
| 9724 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9725 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9726 | |
| 9727 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9728 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9729 | |
| 9730 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9731 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9732 | |
| 9733 | if (!spec->adc_nids && spec->input_mux) { |
| 9734 | int i; |
| 9735 | spec->num_adc_nids = 0; |
| 9736 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9737 | hda_nid_t cap; |
| 9738 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9739 | unsigned int wcap = get_wcaps(codec, nid); |
| 9740 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9741 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9742 | if (wcap != AC_WID_AUD_IN) |
| 9743 | continue; |
| 9744 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9745 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9746 | if (err < 0) |
| 9747 | continue; |
| 9748 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9749 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9750 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9751 | spec->adc_nids = spec->private_adc_nids; |
| 9752 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9753 | } |
| 9754 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 9755 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9756 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9757 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9758 | spec->vmaster_nid = 0x0c; |
| 9759 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9760 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9761 | if (board_config == ALC882_AUTO) |
| 9762 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9763 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9764 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9765 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9766 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9767 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9768 | |
| 9769 | return 0; |
| 9770 | } |
| 9771 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9772 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9773 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9774 | * ALC262 support |
| 9775 | */ |
| 9776 | |
| 9777 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9778 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9779 | |
| 9780 | #define alc262_dac_nids alc260_dac_nids |
| 9781 | #define alc262_adc_nids alc882_adc_nids |
| 9782 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9783 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9784 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9785 | |
| 9786 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9787 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9788 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9789 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9790 | /* ADC0 */ |
| 9791 | 0x09 |
| 9792 | }; |
| 9793 | |
| 9794 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9795 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9796 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9797 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9798 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9799 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9800 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9801 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9802 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9805 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9806 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9807 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9808 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9809 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9810 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9811 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9812 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9813 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9814 | }; |
| 9815 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9816 | /* update HP, line and mono-out pins according to the master switch */ |
| 9817 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9818 | { |
| 9819 | struct alc_spec *spec = codec->spec; |
| 9820 | int val = spec->master_sw; |
| 9821 | |
| 9822 | /* HP & line-out */ |
| 9823 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9824 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9825 | val ? PIN_HP : 0); |
| 9826 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9827 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9828 | val ? PIN_HP : 0); |
| 9829 | /* mono (speaker) depending on the HP jack sense */ |
| 9830 | val = val && !spec->jack_present; |
| 9831 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9832 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9833 | val ? PIN_OUT : 0); |
| 9834 | } |
| 9835 | |
| 9836 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9837 | { |
| 9838 | struct alc_spec *spec = codec->spec; |
| 9839 | unsigned int presence; |
| 9840 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9841 | AC_VERB_GET_PIN_SENSE, 0); |
| 9842 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9843 | alc262_hp_master_update(codec); |
| 9844 | } |
| 9845 | |
| 9846 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9847 | { |
| 9848 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9849 | return; |
| 9850 | alc262_hp_bpc_automute(codec); |
| 9851 | } |
| 9852 | |
| 9853 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9854 | { |
| 9855 | struct alc_spec *spec = codec->spec; |
| 9856 | unsigned int presence; |
| 9857 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9858 | AC_VERB_GET_PIN_SENSE, 0); |
| 9859 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9860 | alc262_hp_master_update(codec); |
| 9861 | } |
| 9862 | |
| 9863 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9864 | unsigned int res) |
| 9865 | { |
| 9866 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9867 | return; |
| 9868 | alc262_hp_wildwest_automute(codec); |
| 9869 | } |
| 9870 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9871 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9872 | |
| 9873 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9874 | struct snd_ctl_elem_value *ucontrol) |
| 9875 | { |
| 9876 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9877 | struct alc_spec *spec = codec->spec; |
| 9878 | int val = !!*ucontrol->value.integer.value; |
| 9879 | |
| 9880 | if (val == spec->master_sw) |
| 9881 | return 0; |
| 9882 | spec->master_sw = val; |
| 9883 | alc262_hp_master_update(codec); |
| 9884 | return 1; |
| 9885 | } |
| 9886 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9887 | #define ALC262_HP_MASTER_SWITCH \ |
| 9888 | { \ |
| 9889 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9890 | .name = "Master Playback Switch", \ |
| 9891 | .info = snd_ctl_boolean_mono_info, \ |
| 9892 | .get = alc262_hp_master_sw_get, \ |
| 9893 | .put = alc262_hp_master_sw_put, \ |
| 9894 | } |
| 9895 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9896 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9897 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9898 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9899 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9900 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9901 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9902 | HDA_OUTPUT), |
| 9903 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9904 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9905 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9906 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9907 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9908 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9909 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9910 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9911 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9912 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9913 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9914 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9915 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9916 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9917 | { } /* end */ |
| 9918 | }; |
| 9919 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9920 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9921 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9922 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9923 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9924 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9926 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9927 | HDA_OUTPUT), |
| 9928 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9929 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9930 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9931 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9932 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9933 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9934 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9935 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9936 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9937 | { } /* end */ |
| 9938 | }; |
| 9939 | |
| 9940 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9941 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9942 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9943 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9944 | { } /* end */ |
| 9945 | }; |
| 9946 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9947 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9948 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9949 | { |
| 9950 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9951 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9952 | spec->autocfg.hp_pins[0] = 0x15; |
| 9953 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9954 | } |
| 9955 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9956 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9957 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9958 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9959 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9960 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9963 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9964 | { } /* end */ |
| 9965 | }; |
| 9966 | |
| 9967 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9968 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9969 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9970 | |
| 9971 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9972 | { } |
| 9973 | }; |
| 9974 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9975 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9976 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9977 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9978 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9979 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9980 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9981 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9982 | { } /* end */ |
| 9983 | }; |
| 9984 | |
| 9985 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9986 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9987 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9988 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9989 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9990 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9991 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9992 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9995 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9996 | {} |
| 9997 | }; |
| 9998 | |
| 9999 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10000 | .num_items = 1, |
| 10001 | .items = { |
| 10002 | { "Line", 0x1 }, |
| 10003 | }, |
| 10004 | }; |
| 10005 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10006 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10007 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10008 | { |
| 10009 | struct alc_spec *spec = codec->spec; |
| 10010 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10011 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10012 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10013 | unsigned int mute; |
| 10014 | |
| 10015 | /* HP */ |
| 10016 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10017 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10018 | HDA_AMP_MUTE, mute); |
| 10019 | /* mute internal speaker per jack sense */ |
| 10020 | if (spec->jack_present) |
| 10021 | mute = HDA_AMP_MUTE; |
| 10022 | if (line_nid) |
| 10023 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10024 | HDA_AMP_MUTE, mute); |
| 10025 | if (speaker_nid && speaker_nid != line_nid) |
| 10026 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10027 | HDA_AMP_MUTE, mute); |
| 10028 | } |
| 10029 | |
| 10030 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10031 | |
| 10032 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10033 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10034 | { |
| 10035 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10036 | struct alc_spec *spec = codec->spec; |
| 10037 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10038 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10039 | if (val == spec->master_sw) |
| 10040 | return 0; |
| 10041 | spec->master_sw = val; |
| 10042 | alc262_hippo_master_update(codec); |
| 10043 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10044 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10045 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10046 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10047 | { \ |
| 10048 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10049 | .name = "Master Playback Switch", \ |
| 10050 | .info = snd_ctl_boolean_mono_info, \ |
| 10051 | .get = alc262_hippo_master_sw_get, \ |
| 10052 | .put = alc262_hippo_master_sw_put, \ |
| 10053 | } |
| 10054 | |
| 10055 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10056 | ALC262_HIPPO_MASTER_SWITCH, |
| 10057 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10058 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10059 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10060 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10061 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10064 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10065 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10066 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10067 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10068 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10069 | { } /* end */ |
| 10070 | }; |
| 10071 | |
| 10072 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10073 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10074 | ALC262_HIPPO_MASTER_SWITCH, |
| 10075 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10076 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10077 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10078 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10081 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10082 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10083 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10084 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10085 | { } /* end */ |
| 10086 | }; |
| 10087 | |
| 10088 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10089 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10090 | { |
| 10091 | struct alc_spec *spec = codec->spec; |
| 10092 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10093 | unsigned int present; |
| 10094 | |
| 10095 | /* need to execute and sync at first */ |
| 10096 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10097 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10098 | AC_VERB_GET_PIN_SENSE, 0); |
| 10099 | spec->jack_present = (present & 0x80000000) != 0; |
| 10100 | alc262_hippo_master_update(codec); |
| 10101 | } |
| 10102 | |
| 10103 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10104 | { |
| 10105 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10106 | return; |
| 10107 | alc262_hippo_automute(codec); |
| 10108 | } |
| 10109 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10110 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10111 | { |
| 10112 | struct alc_spec *spec = codec->spec; |
| 10113 | |
| 10114 | spec->autocfg.hp_pins[0] = 0x15; |
| 10115 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10116 | } |
| 10117 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10118 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10119 | { |
| 10120 | struct alc_spec *spec = codec->spec; |
| 10121 | |
| 10122 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10123 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10124 | } |
| 10125 | |
| 10126 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10127 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10128 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10129 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10130 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10131 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10132 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10133 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10134 | { } /* end */ |
| 10135 | }; |
| 10136 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10137 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10138 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10139 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10142 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10143 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10144 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10145 | { } /* end */ |
| 10146 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10147 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10148 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10149 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10150 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10151 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10152 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10153 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10154 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10156 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10157 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10158 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10159 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10160 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10161 | { } /* end */ |
| 10162 | }; |
| 10163 | |
| 10164 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10165 | /* Headphone automute */ |
| 10166 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10167 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10168 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10169 | |
| 10170 | /* P11 AUX_IN, white 4-pin connector */ |
| 10171 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10172 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10173 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10174 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10175 | |
| 10176 | {} |
| 10177 | }; |
| 10178 | |
| 10179 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10180 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10181 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10182 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10183 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10184 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10185 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10186 | } |
| 10187 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10189 | #define alc262_capture_mixer alc882_capture_mixer |
| 10190 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10191 | |
| 10192 | /* |
| 10193 | * generic initialization of ADC, input mixers and output mixers |
| 10194 | */ |
| 10195 | static struct hda_verb alc262_init_verbs[] = { |
| 10196 | /* |
| 10197 | * Unmute ADC0-2 and set the default input to mic-in |
| 10198 | */ |
| 10199 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10201 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10202 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10203 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10204 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10205 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10206 | /* 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] | 10207 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10208 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10209 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10210 | */ |
| 10211 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10212 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10213 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10217 | |
| 10218 | /* |
| 10219 | * Set up output mixers (0x0c - 0x0e) |
| 10220 | */ |
| 10221 | /* set vol=0 to output mixers */ |
| 10222 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10223 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10225 | /* set up input amps for analog loopback */ |
| 10226 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10228 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10231 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10233 | |
| 10234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10236 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10237 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10238 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10239 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10240 | |
| 10241 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10242 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10243 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10244 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10245 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10246 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10247 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10248 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10249 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10250 | /* FIXME: use matrix-type input source selection */ |
| 10251 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10252 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10253 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10257 | /* Input mixer2 */ |
| 10258 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10262 | /* Input mixer3 */ |
| 10263 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10264 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10267 | |
| 10268 | { } |
| 10269 | }; |
| 10270 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10271 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10272 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10273 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10274 | { } |
| 10275 | }; |
| 10276 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10277 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10278 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10279 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10280 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10281 | |
| 10282 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10283 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10284 | {} |
| 10285 | }; |
| 10286 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10287 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10288 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10289 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10290 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10291 | |
| 10292 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10293 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10294 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10295 | }; |
| 10296 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10297 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10298 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10299 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10300 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10301 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10302 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10303 | { } /* end */ |
| 10304 | }; |
| 10305 | |
| 10306 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10307 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10309 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10310 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10311 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10312 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10313 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10314 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10315 | {} |
| 10316 | }; |
| 10317 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10318 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10319 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10320 | struct alc_spec *spec = codec->spec; |
| 10321 | |
| 10322 | spec->autocfg.hp_pins[0] = 0x15; |
| 10323 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10324 | spec->ext_mic.pin = 0x18; |
| 10325 | spec->ext_mic.mux_idx = 0; |
| 10326 | spec->int_mic.pin = 0x12; |
| 10327 | spec->int_mic.mux_idx = 9; |
| 10328 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10329 | } |
| 10330 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10331 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10332 | * nec model |
| 10333 | * 0x15 = headphone |
| 10334 | * 0x16 = internal speaker |
| 10335 | * 0x18 = external mic |
| 10336 | */ |
| 10337 | |
| 10338 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10339 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10340 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10341 | |
| 10342 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10343 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10344 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10345 | |
| 10346 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10347 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10348 | { } /* end */ |
| 10349 | }; |
| 10350 | |
| 10351 | static struct hda_verb alc262_nec_verbs[] = { |
| 10352 | /* Unmute Speaker */ |
| 10353 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10354 | |
| 10355 | /* Headphone */ |
| 10356 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10357 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10358 | |
| 10359 | /* External mic to headphone */ |
| 10360 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10361 | /* External mic to speaker */ |
| 10362 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10363 | {} |
| 10364 | }; |
| 10365 | |
| 10366 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10367 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10368 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10369 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10370 | */ |
| 10371 | |
| 10372 | #define ALC_HP_EVENT 0x37 |
| 10373 | |
| 10374 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10375 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10376 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10377 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10378 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10379 | {} |
| 10380 | }; |
| 10381 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10382 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10383 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10384 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10385 | {} |
| 10386 | }; |
| 10387 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10388 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10389 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10390 | .items = { |
| 10391 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10392 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10393 | { "CD", 0x4 }, |
| 10394 | }, |
| 10395 | }; |
| 10396 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10397 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10398 | .num_items = 5, |
| 10399 | .items = { |
| 10400 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10401 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10402 | { "Line", 0x2 }, |
| 10403 | { "CD", 0x4 }, |
| 10404 | { "AUX IN", 0x6 }, |
| 10405 | }, |
| 10406 | }; |
| 10407 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10408 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10409 | .num_items = 4, |
| 10410 | .items = { |
| 10411 | { "Mic", 0x0 }, |
| 10412 | { "Front Mic", 0x2 }, |
| 10413 | { "Line", 0x1 }, |
| 10414 | { "CD", 0x4 }, |
| 10415 | }, |
| 10416 | }; |
| 10417 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10418 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10419 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10420 | { |
| 10421 | struct alc_spec *spec = codec->spec; |
| 10422 | unsigned int mute; |
| 10423 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10424 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10425 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10426 | /* need to execute and sync at first */ |
| 10427 | 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] | 10428 | /* check laptop HP jack */ |
| 10429 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10430 | AC_VERB_GET_PIN_SENSE, 0); |
| 10431 | /* need to execute and sync at first */ |
| 10432 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10433 | /* check docking HP jack */ |
| 10434 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10435 | AC_VERB_GET_PIN_SENSE, 0); |
| 10436 | if (present & AC_PINSENSE_PRESENCE) |
| 10437 | spec->jack_present = 1; |
| 10438 | else |
| 10439 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10440 | spec->sense_updated = 1; |
| 10441 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10442 | /* unmute internal speaker only if both HPs are unplugged and |
| 10443 | * master switch is on |
| 10444 | */ |
| 10445 | if (spec->jack_present) |
| 10446 | mute = HDA_AMP_MUTE; |
| 10447 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10448 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10449 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10450 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10451 | } |
| 10452 | |
| 10453 | /* unsolicited event for HP jack sensing */ |
| 10454 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10455 | unsigned int res) |
| 10456 | { |
| 10457 | if ((res >> 26) != ALC_HP_EVENT) |
| 10458 | return; |
| 10459 | alc262_fujitsu_automute(codec, 1); |
| 10460 | } |
| 10461 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10462 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10463 | { |
| 10464 | alc262_fujitsu_automute(codec, 1); |
| 10465 | } |
| 10466 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10467 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10468 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10469 | .ops = &snd_hda_bind_vol, |
| 10470 | .values = { |
| 10471 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10472 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10473 | 0 |
| 10474 | }, |
| 10475 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10476 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10477 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10478 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10479 | { |
| 10480 | struct alc_spec *spec = codec->spec; |
| 10481 | unsigned int mute; |
| 10482 | |
| 10483 | if (force || !spec->sense_updated) { |
| 10484 | unsigned int present_int_hp; |
| 10485 | /* need to execute and sync at first */ |
| 10486 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10487 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10488 | AC_VERB_GET_PIN_SENSE, 0); |
| 10489 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10490 | spec->sense_updated = 1; |
| 10491 | } |
| 10492 | if (spec->jack_present) { |
| 10493 | /* mute internal speaker */ |
| 10494 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10495 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10496 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10497 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10498 | } else { |
| 10499 | /* unmute internal speaker if necessary */ |
| 10500 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10501 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10502 | HDA_AMP_MUTE, mute); |
| 10503 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10504 | HDA_AMP_MUTE, mute); |
| 10505 | } |
| 10506 | } |
| 10507 | |
| 10508 | /* unsolicited event for HP jack sensing */ |
| 10509 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10510 | unsigned int res) |
| 10511 | { |
| 10512 | if ((res >> 26) != ALC_HP_EVENT) |
| 10513 | return; |
| 10514 | alc262_lenovo_3000_automute(codec, 1); |
| 10515 | } |
| 10516 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10517 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10518 | int dir, int idx, long *valp) |
| 10519 | { |
| 10520 | int i, change = 0; |
| 10521 | |
| 10522 | for (i = 0; i < 2; i++, valp++) |
| 10523 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10524 | HDA_AMP_MUTE, |
| 10525 | *valp ? 0 : HDA_AMP_MUTE); |
| 10526 | return change; |
| 10527 | } |
| 10528 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10529 | /* bind hp and internal speaker mute (with plug check) */ |
| 10530 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10531 | struct snd_ctl_elem_value *ucontrol) |
| 10532 | { |
| 10533 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10534 | long *valp = ucontrol->value.integer.value; |
| 10535 | int change; |
| 10536 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10537 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10538 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10539 | if (change) |
| 10540 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10541 | return change; |
| 10542 | } |
| 10543 | |
| 10544 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10545 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10546 | { |
| 10547 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10548 | .name = "Master Playback Switch", |
| 10549 | .info = snd_hda_mixer_amp_switch_info, |
| 10550 | .get = snd_hda_mixer_amp_switch_get, |
| 10551 | .put = alc262_fujitsu_master_sw_put, |
| 10552 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10553 | }, |
| 10554 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10555 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10556 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10557 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10558 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10559 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10560 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10561 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10562 | { } /* end */ |
| 10563 | }; |
| 10564 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10565 | /* bind hp and internal speaker mute (with plug check) */ |
| 10566 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10567 | struct snd_ctl_elem_value *ucontrol) |
| 10568 | { |
| 10569 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10570 | long *valp = ucontrol->value.integer.value; |
| 10571 | int change; |
| 10572 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10573 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10574 | if (change) |
| 10575 | alc262_lenovo_3000_automute(codec, 0); |
| 10576 | return change; |
| 10577 | } |
| 10578 | |
| 10579 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10580 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10581 | { |
| 10582 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10583 | .name = "Master Playback Switch", |
| 10584 | .info = snd_hda_mixer_amp_switch_info, |
| 10585 | .get = snd_hda_mixer_amp_switch_get, |
| 10586 | .put = alc262_lenovo_3000_master_sw_put, |
| 10587 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10588 | }, |
| 10589 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10590 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10591 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10594 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10595 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10596 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10597 | { } /* end */ |
| 10598 | }; |
| 10599 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10600 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10601 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10602 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10605 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10606 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10607 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10608 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10609 | { } /* end */ |
| 10610 | }; |
| 10611 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10612 | /* additional init verbs for Benq laptops */ |
| 10613 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10614 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10615 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10616 | {} |
| 10617 | }; |
| 10618 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10619 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10620 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10621 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10622 | |
| 10623 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10624 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10625 | {} |
| 10626 | }; |
| 10627 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10628 | /* Samsung Q1 Ultra Vista model setup */ |
| 10629 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10630 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10631 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10634 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10635 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10636 | { } /* end */ |
| 10637 | }; |
| 10638 | |
| 10639 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10640 | /* output mixer */ |
| 10641 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10642 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10643 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10644 | /* speaker */ |
| 10645 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10646 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10647 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10648 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10649 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10650 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10651 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10652 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10653 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10654 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10655 | /* internal mic */ |
| 10656 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10657 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10658 | /* ADC, choose mic */ |
| 10659 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10660 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10661 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10666 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10667 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10668 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10669 | {} |
| 10670 | }; |
| 10671 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10672 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10673 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10674 | { |
| 10675 | struct alc_spec *spec = codec->spec; |
| 10676 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10677 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10678 | mute = 0; |
| 10679 | /* auto-mute only when HP is used as HP */ |
| 10680 | if (!spec->cur_mux[0]) { |
| 10681 | unsigned int present; |
| 10682 | /* need to execute and sync at first */ |
| 10683 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10684 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10685 | AC_VERB_GET_PIN_SENSE, 0); |
| 10686 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10687 | if (spec->jack_present) |
| 10688 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10689 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10690 | /* mute/unmute internal speaker */ |
| 10691 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10692 | HDA_AMP_MUTE, mute); |
| 10693 | /* mute/unmute HP */ |
| 10694 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10695 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10696 | } |
| 10697 | |
| 10698 | /* unsolicited event for HP jack sensing */ |
| 10699 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10700 | unsigned int res) |
| 10701 | { |
| 10702 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10703 | return; |
| 10704 | alc262_ultra_automute(codec); |
| 10705 | } |
| 10706 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10707 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10708 | .num_items = 2, |
| 10709 | .items = { |
| 10710 | { "Mic", 0x1 }, |
| 10711 | { "Headphone", 0x7 }, |
| 10712 | }, |
| 10713 | }; |
| 10714 | |
| 10715 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10716 | struct snd_ctl_elem_value *ucontrol) |
| 10717 | { |
| 10718 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10719 | struct alc_spec *spec = codec->spec; |
| 10720 | int ret; |
| 10721 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10722 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10723 | if (!ret) |
| 10724 | return 0; |
| 10725 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10726 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10727 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10728 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10729 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10730 | return ret; |
| 10731 | } |
| 10732 | |
| 10733 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10734 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10735 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10736 | { |
| 10737 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10738 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10739 | .info = alc_mux_enum_info, |
| 10740 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10741 | .put = alc262_ultra_mux_enum_put, |
| 10742 | }, |
| 10743 | { } /* end */ |
| 10744 | }; |
| 10745 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10746 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10747 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10748 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10749 | { |
| 10750 | hda_nid_t nid; |
| 10751 | int err; |
| 10752 | |
| 10753 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10754 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10755 | spec->multiout.dac_nids[0] = 2; |
| 10756 | |
| 10757 | nid = cfg->line_out_pins[0]; |
| 10758 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10759 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10760 | "Front Playback Volume", |
| 10761 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10762 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10763 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10764 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10765 | "Front Playback Switch", |
| 10766 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10767 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10768 | return err; |
| 10769 | } |
| 10770 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10771 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10772 | if (nid) { |
| 10773 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10774 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10775 | "Speaker Playback Volume", |
| 10776 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10777 | HDA_OUTPUT)); |
| 10778 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10779 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10780 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10781 | "Speaker Playback Switch", |
| 10782 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10783 | HDA_OUTPUT)); |
| 10784 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10785 | return err; |
| 10786 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10787 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10788 | "Speaker Playback Switch", |
| 10789 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10790 | HDA_OUTPUT)); |
| 10791 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10792 | return err; |
| 10793 | } |
| 10794 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10795 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10796 | if (nid) { |
| 10797 | /* spec->multiout.hp_nid = 2; */ |
| 10798 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10799 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10800 | "Headphone Playback Volume", |
| 10801 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10802 | HDA_OUTPUT)); |
| 10803 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10804 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10805 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10806 | "Headphone Playback Switch", |
| 10807 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10808 | HDA_OUTPUT)); |
| 10809 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10810 | return err; |
| 10811 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10812 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10813 | "Headphone Playback Switch", |
| 10814 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10815 | HDA_OUTPUT)); |
| 10816 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10817 | return err; |
| 10818 | } |
| 10819 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10820 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10821 | } |
| 10822 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 10823 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10824 | const struct auto_pin_cfg *cfg) |
| 10825 | { |
| 10826 | int err; |
| 10827 | |
| 10828 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10829 | if (err < 0) |
| 10830 | return err; |
| 10831 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10832 | * because it's under 0x18 |
| 10833 | */ |
| 10834 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10835 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10836 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10837 | imux->items[imux->num_items].label = "Int Mic"; |
| 10838 | imux->items[imux->num_items].index = 0x09; |
| 10839 | imux->num_items++; |
| 10840 | } |
| 10841 | return 0; |
| 10842 | } |
| 10843 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10844 | |
| 10845 | /* |
| 10846 | * generic initialization of ADC, input mixers and output mixers |
| 10847 | */ |
| 10848 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10849 | /* |
| 10850 | * Unmute ADC0-2 and set the default input to mic-in |
| 10851 | */ |
| 10852 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10854 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10855 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10856 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10857 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10858 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10859 | /* 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] | 10860 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10861 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10862 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10863 | */ |
| 10864 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10865 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10866 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10867 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10868 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10869 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10870 | |
| 10871 | /* |
| 10872 | * Set up output mixers (0x0c - 0x0f) |
| 10873 | */ |
| 10874 | /* set vol=0 to output mixers */ |
| 10875 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10876 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10877 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10879 | /* set up input amps for analog loopback */ |
| 10880 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10881 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10882 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10883 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10884 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10885 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10886 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10887 | |
| 10888 | /* FIXME: use matrix-type input source selection */ |
| 10889 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10890 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10891 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10892 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10893 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10894 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10895 | /* Input mixer2 */ |
| 10896 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10897 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10898 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10899 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10900 | /* Input mixer3 */ |
| 10901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10904 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10905 | |
| 10906 | { } |
| 10907 | }; |
| 10908 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10909 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10910 | /* |
| 10911 | * Unmute ADC0-2 and set the default input to mic-in |
| 10912 | */ |
| 10913 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10914 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10915 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10916 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10917 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10918 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10919 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10920 | /* 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] | 10921 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10922 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10923 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10924 | */ |
| 10925 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10933 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10934 | /* |
| 10935 | * Set up output mixers (0x0c - 0x0e) |
| 10936 | */ |
| 10937 | /* set vol=0 to output mixers */ |
| 10938 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10939 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10940 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10941 | |
| 10942 | /* set up input amps for analog loopback */ |
| 10943 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10944 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10945 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10946 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10947 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10948 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10949 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10950 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10952 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10953 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10954 | |
| 10955 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10956 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10957 | |
| 10958 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10959 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10960 | |
| 10961 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10962 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10963 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10964 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10965 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10966 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10967 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10968 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10969 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10970 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10971 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10972 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10973 | |
| 10974 | |
| 10975 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10976 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 10977 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10978 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10979 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10980 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10981 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10982 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10983 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10986 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10987 | /* Input mixer2 */ |
| 10988 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10989 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10990 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10991 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10992 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10993 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10997 | /* Input mixer3 */ |
| 10998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11004 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11005 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11006 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11007 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11008 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11009 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11010 | { } |
| 11011 | }; |
| 11012 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11013 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11014 | /* |
| 11015 | * Unmute ADC0-2 and set the default input to mic-in |
| 11016 | */ |
| 11017 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11018 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11019 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11020 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11021 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11022 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11023 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11024 | /* 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] | 11025 | * mixer widget |
| 11026 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11027 | * panel mic (mic 2) |
| 11028 | */ |
| 11029 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11035 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11036 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11038 | /* |
| 11039 | * Set up output mixers (0x0c - 0x0e) |
| 11040 | */ |
| 11041 | /* set vol=0 to output mixers */ |
| 11042 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11043 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11044 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11045 | |
| 11046 | /* set up input amps for analog loopback */ |
| 11047 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11048 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11049 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11050 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11051 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11052 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11053 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11054 | |
| 11055 | |
| 11056 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11057 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11058 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11059 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11060 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11061 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11062 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11063 | |
| 11064 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11065 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11066 | |
| 11067 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11068 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11069 | |
| 11070 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11071 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11072 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11073 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11074 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11075 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11076 | |
| 11077 | /* FIXME: use matrix-type input source selection */ |
| 11078 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11079 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11085 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11086 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11087 | /* Input mixer2 */ |
| 11088 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11089 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11090 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11091 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11092 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11093 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11094 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11095 | /* Input mixer3 */ |
| 11096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11098 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11099 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11101 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11103 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11104 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11105 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11106 | { } |
| 11107 | }; |
| 11108 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11109 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11110 | |
| 11111 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11112 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11113 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11114 | |
| 11115 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11116 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11117 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11118 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11119 | |
| 11120 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11121 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11122 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11123 | {} |
| 11124 | }; |
| 11125 | |
| 11126 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11127 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11128 | #define alc262_loopbacks alc880_loopbacks |
| 11129 | #endif |
| 11130 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11131 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11132 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11133 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11134 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11135 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11136 | |
| 11137 | /* |
| 11138 | * BIOS auto configuration |
| 11139 | */ |
| 11140 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11141 | { |
| 11142 | struct alc_spec *spec = codec->spec; |
| 11143 | int err; |
| 11144 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11145 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11146 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11147 | alc262_ignore); |
| 11148 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11149 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11150 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11151 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11152 | spec->multiout.max_channels = 2; |
| 11153 | spec->no_analog = 1; |
| 11154 | goto dig_only; |
| 11155 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11156 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11157 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11158 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11159 | if (err < 0) |
| 11160 | return err; |
| 11161 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11162 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11163 | return err; |
| 11164 | |
| 11165 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11166 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11167 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11168 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11169 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11170 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11171 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11172 | if (spec->autocfg.dig_in_pin) |
| 11173 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11174 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11175 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11176 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11177 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11178 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11179 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11180 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11181 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11182 | err = alc_auto_add_mic_boost(codec); |
| 11183 | if (err < 0) |
| 11184 | return err; |
| 11185 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11186 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11188 | return 1; |
| 11189 | } |
| 11190 | |
| 11191 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11192 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11193 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11194 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11195 | |
| 11196 | |
| 11197 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11198 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11199 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11200 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11201 | alc262_auto_init_multi_out(codec); |
| 11202 | alc262_auto_init_hp_out(codec); |
| 11203 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11204 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11205 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11206 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11207 | } |
| 11208 | |
| 11209 | /* |
| 11210 | * configuration and preset |
| 11211 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11212 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11213 | [ALC262_BASIC] = "basic", |
| 11214 | [ALC262_HIPPO] = "hippo", |
| 11215 | [ALC262_HIPPO_1] = "hippo_1", |
| 11216 | [ALC262_FUJITSU] = "fujitsu", |
| 11217 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11218 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11219 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11220 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11221 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11222 | [ALC262_BENQ_T31] = "benq-t31", |
| 11223 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11224 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11225 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11226 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11227 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11228 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11229 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11230 | [ALC262_AUTO] = "auto", |
| 11231 | }; |
| 11232 | |
| 11233 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11234 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11235 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11236 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11237 | ALC262_HP_BPC), |
| 11238 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11239 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11240 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11241 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11242 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11243 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11244 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11245 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11246 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11247 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11248 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11249 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11250 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11251 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11252 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11253 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11254 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11255 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11256 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11257 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11258 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11259 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11260 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11261 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11262 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11263 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11264 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11265 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11266 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11267 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11268 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11269 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11270 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11271 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11272 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11273 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11274 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11275 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11276 | {} |
| 11277 | }; |
| 11278 | |
| 11279 | static struct alc_config_preset alc262_presets[] = { |
| 11280 | [ALC262_BASIC] = { |
| 11281 | .mixers = { alc262_base_mixer }, |
| 11282 | .init_verbs = { alc262_init_verbs }, |
| 11283 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11284 | .dac_nids = alc262_dac_nids, |
| 11285 | .hp_nid = 0x03, |
| 11286 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11287 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11288 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11289 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11290 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11291 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11292 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11293 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11294 | .dac_nids = alc262_dac_nids, |
| 11295 | .hp_nid = 0x03, |
| 11296 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11297 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11298 | .channel_mode = alc262_modes, |
| 11299 | .input_mux = &alc262_capture_source, |
| 11300 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11301 | .setup = alc262_hippo_setup, |
| 11302 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11303 | }, |
| 11304 | [ALC262_HIPPO_1] = { |
| 11305 | .mixers = { alc262_hippo1_mixer }, |
| 11306 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11307 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11308 | .dac_nids = alc262_dac_nids, |
| 11309 | .hp_nid = 0x02, |
| 11310 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11311 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11312 | .channel_mode = alc262_modes, |
| 11313 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11314 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11315 | .setup = alc262_hippo1_setup, |
| 11316 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11317 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11318 | [ALC262_FUJITSU] = { |
| 11319 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11320 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11321 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11322 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11323 | .dac_nids = alc262_dac_nids, |
| 11324 | .hp_nid = 0x03, |
| 11325 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11326 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11327 | .channel_mode = alc262_modes, |
| 11328 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11329 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11330 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11331 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11332 | [ALC262_HP_BPC] = { |
| 11333 | .mixers = { alc262_HP_BPC_mixer }, |
| 11334 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11335 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11336 | .dac_nids = alc262_dac_nids, |
| 11337 | .hp_nid = 0x03, |
| 11338 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11339 | .channel_mode = alc262_modes, |
| 11340 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11341 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11342 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11343 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11344 | [ALC262_HP_BPC_D7000_WF] = { |
| 11345 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11346 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11347 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11348 | .dac_nids = alc262_dac_nids, |
| 11349 | .hp_nid = 0x03, |
| 11350 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11351 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11352 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11353 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11354 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11355 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11356 | [ALC262_HP_BPC_D7000_WL] = { |
| 11357 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11358 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11359 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11360 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11361 | .dac_nids = alc262_dac_nids, |
| 11362 | .hp_nid = 0x03, |
| 11363 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11364 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11365 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11366 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11367 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11368 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11369 | [ALC262_HP_TC_T5735] = { |
| 11370 | .mixers = { alc262_hp_t5735_mixer }, |
| 11371 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11372 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11373 | .dac_nids = alc262_dac_nids, |
| 11374 | .hp_nid = 0x03, |
| 11375 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11376 | .channel_mode = alc262_modes, |
| 11377 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11378 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11379 | .setup = alc262_hp_t5735_setup, |
| 11380 | .init_hook = alc_automute_amp, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11381 | }, |
| 11382 | [ALC262_HP_RP5700] = { |
| 11383 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11384 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11385 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11386 | .dac_nids = alc262_dac_nids, |
| 11387 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11388 | .channel_mode = alc262_modes, |
| 11389 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11390 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11391 | [ALC262_BENQ_ED8] = { |
| 11392 | .mixers = { alc262_base_mixer }, |
| 11393 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11394 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11395 | .dac_nids = alc262_dac_nids, |
| 11396 | .hp_nid = 0x03, |
| 11397 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11398 | .channel_mode = alc262_modes, |
| 11399 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11400 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11401 | [ALC262_SONY_ASSAMD] = { |
| 11402 | .mixers = { alc262_sony_mixer }, |
| 11403 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11404 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11405 | .dac_nids = alc262_dac_nids, |
| 11406 | .hp_nid = 0x02, |
| 11407 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11408 | .channel_mode = alc262_modes, |
| 11409 | .input_mux = &alc262_capture_source, |
| 11410 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11411 | .setup = alc262_hippo_setup, |
| 11412 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11413 | }, |
| 11414 | [ALC262_BENQ_T31] = { |
| 11415 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11416 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11417 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11418 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11419 | .dac_nids = alc262_dac_nids, |
| 11420 | .hp_nid = 0x03, |
| 11421 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11422 | .channel_mode = alc262_modes, |
| 11423 | .input_mux = &alc262_capture_source, |
| 11424 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11425 | .setup = alc262_hippo_setup, |
| 11426 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11427 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11428 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11429 | .mixers = { alc262_ultra_mixer }, |
| 11430 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11431 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11432 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11433 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11434 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11435 | .channel_mode = alc262_modes, |
| 11436 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11437 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11438 | .capsrc_nids = alc262_capsrc_nids, |
| 11439 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11440 | .unsol_event = alc262_ultra_unsol_event, |
| 11441 | .init_hook = alc262_ultra_automute, |
| 11442 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11443 | [ALC262_LENOVO_3000] = { |
| 11444 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11445 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11446 | alc262_lenovo_3000_unsol_verbs }, |
| 11447 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11448 | .dac_nids = alc262_dac_nids, |
| 11449 | .hp_nid = 0x03, |
| 11450 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11451 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11452 | .channel_mode = alc262_modes, |
| 11453 | .input_mux = &alc262_fujitsu_capture_source, |
| 11454 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11455 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11456 | [ALC262_NEC] = { |
| 11457 | .mixers = { alc262_nec_mixer }, |
| 11458 | .init_verbs = { alc262_nec_verbs }, |
| 11459 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11460 | .dac_nids = alc262_dac_nids, |
| 11461 | .hp_nid = 0x03, |
| 11462 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11463 | .channel_mode = alc262_modes, |
| 11464 | .input_mux = &alc262_capture_source, |
| 11465 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11466 | [ALC262_TOSHIBA_S06] = { |
| 11467 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11468 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11469 | alc262_eapd_verbs }, |
| 11470 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11471 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11472 | .dac_nids = alc262_dac_nids, |
| 11473 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11474 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11475 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11476 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11477 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11478 | .unsol_event = alc_sku_unsol_event, |
| 11479 | .setup = alc262_toshiba_s06_setup, |
| 11480 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11481 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11482 | [ALC262_TOSHIBA_RX1] = { |
| 11483 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11484 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11485 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11486 | .dac_nids = alc262_dac_nids, |
| 11487 | .hp_nid = 0x03, |
| 11488 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11489 | .channel_mode = alc262_modes, |
| 11490 | .input_mux = &alc262_capture_source, |
| 11491 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11492 | .setup = alc262_hippo_setup, |
| 11493 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11494 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11495 | [ALC262_TYAN] = { |
| 11496 | .mixers = { alc262_tyan_mixer }, |
| 11497 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11498 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11499 | .dac_nids = alc262_dac_nids, |
| 11500 | .hp_nid = 0x02, |
| 11501 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11502 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11503 | .channel_mode = alc262_modes, |
| 11504 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11505 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11506 | .setup = alc262_tyan_setup, |
| 11507 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11508 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11509 | }; |
| 11510 | |
| 11511 | static int patch_alc262(struct hda_codec *codec) |
| 11512 | { |
| 11513 | struct alc_spec *spec; |
| 11514 | int board_config; |
| 11515 | int err; |
| 11516 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11517 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11518 | if (spec == NULL) |
| 11519 | return -ENOMEM; |
| 11520 | |
| 11521 | codec->spec = spec; |
| 11522 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11523 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11524 | * under-run |
| 11525 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11526 | { |
| 11527 | int tmp; |
| 11528 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11529 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11530 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11531 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11532 | } |
| 11533 | #endif |
| 11534 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11535 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11536 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11537 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11538 | alc262_models, |
| 11539 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11540 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11541 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11542 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11543 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11544 | board_config = ALC262_AUTO; |
| 11545 | } |
| 11546 | |
| 11547 | if (board_config == ALC262_AUTO) { |
| 11548 | /* automatic parse from the BIOS config */ |
| 11549 | err = alc262_parse_auto_config(codec); |
| 11550 | if (err < 0) { |
| 11551 | alc_free(codec); |
| 11552 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11553 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11554 | printk(KERN_INFO |
| 11555 | "hda_codec: Cannot set up configuration " |
| 11556 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11557 | board_config = ALC262_BASIC; |
| 11558 | } |
| 11559 | } |
| 11560 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11561 | if (!spec->no_analog) { |
| 11562 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11563 | if (err < 0) { |
| 11564 | alc_free(codec); |
| 11565 | return err; |
| 11566 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11567 | } |
| 11568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11569 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11570 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11572 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11573 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11574 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11575 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11576 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11577 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11578 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11579 | int i; |
| 11580 | /* check whether the digital-mic has to be supported */ |
| 11581 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11582 | if (spec->input_mux->items[i].index >= 9) |
| 11583 | break; |
| 11584 | } |
| 11585 | if (i < spec->input_mux->num_items) { |
| 11586 | /* use only ADC0 */ |
| 11587 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11588 | spec->num_adc_nids = 1; |
| 11589 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11590 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11591 | /* all analog inputs */ |
| 11592 | /* check whether NID 0x07 is valid */ |
| 11593 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11594 | |
| 11595 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11596 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11597 | if (wcap != AC_WID_AUD_IN) { |
| 11598 | spec->adc_nids = alc262_adc_nids_alt; |
| 11599 | spec->num_adc_nids = |
| 11600 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11601 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11602 | } else { |
| 11603 | spec->adc_nids = alc262_adc_nids; |
| 11604 | spec->num_adc_nids = |
| 11605 | ARRAY_SIZE(alc262_adc_nids); |
| 11606 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11607 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11608 | } |
| 11609 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11610 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11611 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11612 | if (!spec->no_analog) |
| 11613 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11614 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11615 | spec->vmaster_nid = 0x0c; |
| 11616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11617 | codec->patch_ops = alc_patch_ops; |
| 11618 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11619 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11620 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11621 | if (!spec->loopback.amplist) |
| 11622 | spec->loopback.amplist = alc262_loopbacks; |
| 11623 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11624 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11625 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11626 | return 0; |
| 11627 | } |
| 11628 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11629 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11630 | * ALC268 channel source setting (2 channel) |
| 11631 | */ |
| 11632 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11633 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11634 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11635 | static hda_nid_t alc268_dac_nids[2] = { |
| 11636 | /* front, hp */ |
| 11637 | 0x02, 0x03 |
| 11638 | }; |
| 11639 | |
| 11640 | static hda_nid_t alc268_adc_nids[2] = { |
| 11641 | /* ADC0-1 */ |
| 11642 | 0x08, 0x07 |
| 11643 | }; |
| 11644 | |
| 11645 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11646 | /* ADC0 */ |
| 11647 | 0x08 |
| 11648 | }; |
| 11649 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11650 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11651 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11652 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11653 | /* output mixer control */ |
| 11654 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11655 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11656 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11657 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11658 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11659 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11660 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11661 | { } |
| 11662 | }; |
| 11663 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11664 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11665 | /* output mixer control */ |
| 11666 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11667 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11668 | ALC262_HIPPO_MASTER_SWITCH, |
| 11669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11670 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11671 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11672 | { } |
| 11673 | }; |
| 11674 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11675 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11676 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11677 | .ops = &snd_hda_bind_sw, |
| 11678 | .values = { |
| 11679 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11680 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11681 | 0 |
| 11682 | }, |
| 11683 | }; |
| 11684 | |
| 11685 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11686 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11687 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11688 | { } |
| 11689 | }; |
| 11690 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11691 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11692 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11693 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11694 | { } |
| 11695 | }; |
| 11696 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11697 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11698 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11699 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11700 | { } /* end */ |
| 11701 | }; |
| 11702 | |
| 11703 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11704 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11705 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11706 | .ops = &snd_hda_bind_vol, |
| 11707 | .values = { |
| 11708 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11709 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11710 | 0 |
| 11711 | }, |
| 11712 | }; |
| 11713 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11714 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11715 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11716 | { |
| 11717 | struct alc_spec *spec = codec->spec; |
| 11718 | unsigned int mute; |
| 11719 | |
| 11720 | if (force || !spec->sense_updated) { |
| 11721 | unsigned int present; |
| 11722 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11723 | AC_VERB_GET_PIN_SENSE, 0); |
| 11724 | spec->jack_present = (present & 0x80000000) != 0; |
| 11725 | spec->sense_updated = 1; |
| 11726 | } |
| 11727 | if (spec->jack_present) |
| 11728 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11729 | else /* unmute internal speaker if necessary */ |
| 11730 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11731 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11732 | HDA_AMP_MUTE, mute); |
| 11733 | } |
| 11734 | |
| 11735 | |
| 11736 | /* bind hp and internal speaker mute (with plug check) */ |
| 11737 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11738 | struct snd_ctl_elem_value *ucontrol) |
| 11739 | { |
| 11740 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11741 | long *valp = ucontrol->value.integer.value; |
| 11742 | int change; |
| 11743 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11744 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11745 | if (change) |
| 11746 | alc268_acer_automute(codec, 0); |
| 11747 | return change; |
| 11748 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11749 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11750 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11751 | /* output mixer control */ |
| 11752 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11753 | { |
| 11754 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11755 | .name = "Master Playback Switch", |
| 11756 | .info = snd_hda_mixer_amp_switch_info, |
| 11757 | .get = snd_hda_mixer_amp_switch_get, |
| 11758 | .put = alc268_acer_master_sw_put, |
| 11759 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11760 | }, |
| 11761 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11762 | { } |
| 11763 | }; |
| 11764 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11765 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11766 | /* output mixer control */ |
| 11767 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11768 | { |
| 11769 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11770 | .name = "Master Playback Switch", |
| 11771 | .info = snd_hda_mixer_amp_switch_info, |
| 11772 | .get = snd_hda_mixer_amp_switch_get, |
| 11773 | .put = alc268_acer_master_sw_put, |
| 11774 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11775 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11776 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11777 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11778 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11779 | { } |
| 11780 | }; |
| 11781 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11782 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11783 | /* output mixer control */ |
| 11784 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11785 | { |
| 11786 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11787 | .name = "Master Playback Switch", |
| 11788 | .info = snd_hda_mixer_amp_switch_info, |
| 11789 | .get = snd_hda_mixer_amp_switch_get, |
| 11790 | .put = alc268_acer_master_sw_put, |
| 11791 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11792 | }, |
| 11793 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11794 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11795 | { } |
| 11796 | }; |
| 11797 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11798 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11799 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11800 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11801 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11802 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11803 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11804 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11805 | { } |
| 11806 | }; |
| 11807 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11808 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11809 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11810 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11811 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11814 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11815 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11816 | { } |
| 11817 | }; |
| 11818 | |
| 11819 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11820 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11821 | #define alc268_toshiba_setup alc262_hippo_setup |
| 11822 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11823 | |
| 11824 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11825 | unsigned int res) |
| 11826 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11827 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11828 | return; |
| 11829 | alc268_acer_automute(codec, 1); |
| 11830 | } |
| 11831 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11832 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11833 | { |
| 11834 | alc268_acer_automute(codec, 1); |
| 11835 | } |
| 11836 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11837 | /* toggle speaker-output according to the hp-jack state */ |
| 11838 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11839 | { |
| 11840 | unsigned int present; |
| 11841 | unsigned char bits; |
| 11842 | |
| 11843 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11844 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11845 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11846 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11847 | AMP_IN_MUTE(0), bits); |
| 11848 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11849 | AMP_IN_MUTE(0), bits); |
| 11850 | } |
| 11851 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11852 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11853 | unsigned int res) |
| 11854 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11855 | switch (res >> 26) { |
| 11856 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11857 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11858 | break; |
| 11859 | case ALC880_MIC_EVENT: |
| 11860 | alc_mic_automute(codec); |
| 11861 | break; |
| 11862 | } |
| 11863 | } |
| 11864 | |
| 11865 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 11866 | { |
| 11867 | struct alc_spec *spec = codec->spec; |
| 11868 | spec->ext_mic.pin = 0x18; |
| 11869 | spec->ext_mic.mux_idx = 0; |
| 11870 | spec->int_mic.pin = 0x12; |
| 11871 | spec->int_mic.mux_idx = 6; |
| 11872 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11873 | } |
| 11874 | |
| 11875 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11876 | { |
| 11877 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11878 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11879 | } |
| 11880 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11881 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11882 | /* output mixer control */ |
| 11883 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11884 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11885 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11886 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11887 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11888 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11889 | { } |
| 11890 | }; |
| 11891 | |
| 11892 | static struct hda_verb alc268_dell_verbs[] = { |
| 11893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11894 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11895 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11896 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11897 | { } |
| 11898 | }; |
| 11899 | |
| 11900 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11901 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11902 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11903 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11904 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11905 | spec->autocfg.hp_pins[0] = 0x15; |
| 11906 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11907 | spec->ext_mic.pin = 0x18; |
| 11908 | spec->ext_mic.mux_idx = 0; |
| 11909 | spec->int_mic.pin = 0x19; |
| 11910 | spec->int_mic.mux_idx = 1; |
| 11911 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11912 | } |
| 11913 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11914 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11915 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11916 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11917 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11918 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11919 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11920 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11921 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11922 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11923 | { } |
| 11924 | }; |
| 11925 | |
| 11926 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11927 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11928 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11929 | { } |
| 11930 | }; |
| 11931 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11932 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11933 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11934 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11935 | spec->autocfg.hp_pins[0] = 0x15; |
| 11936 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11937 | spec->ext_mic.pin = 0x18; |
| 11938 | spec->ext_mic.mux_idx = 0; |
| 11939 | spec->int_mic.pin = 0x19; |
| 11940 | spec->int_mic.mux_idx = 1; |
| 11941 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11942 | } |
| 11943 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11944 | /* |
| 11945 | * generic initialization of ADC, input mixers and output mixers |
| 11946 | */ |
| 11947 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11948 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11949 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11950 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11951 | |
| 11952 | /* |
| 11953 | * Set up output mixers (0x0c - 0x0e) |
| 11954 | */ |
| 11955 | /* set vol=0 to output mixers */ |
| 11956 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11957 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11958 | |
| 11959 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11960 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11961 | |
| 11962 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11963 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11964 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11965 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11966 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11967 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11968 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11969 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11970 | |
| 11971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11973 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11974 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11975 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11976 | |
| 11977 | /* set PCBEEP vol = 0, mute connections */ |
| 11978 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11979 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11980 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11981 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11982 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11983 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11984 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11985 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11986 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11987 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11988 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11989 | { } |
| 11990 | }; |
| 11991 | |
| 11992 | /* |
| 11993 | * generic initialization of ADC, input mixers and output mixers |
| 11994 | */ |
| 11995 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11996 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11997 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11998 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11999 | |
| 12000 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12001 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12002 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12003 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12004 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12005 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12006 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12007 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12008 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12009 | |
| 12010 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12011 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12012 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12013 | /* set PCBEEP vol = 0, mute connections */ |
| 12014 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12015 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12016 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12017 | |
| 12018 | { } |
| 12019 | }; |
| 12020 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12021 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12022 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12023 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12024 | { } /* end */ |
| 12025 | }; |
| 12026 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12027 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12028 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12029 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12030 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12031 | { } /* end */ |
| 12032 | }; |
| 12033 | |
| 12034 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12035 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12036 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12037 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12038 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12039 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12040 | { } /* end */ |
| 12041 | }; |
| 12042 | |
| 12043 | static struct hda_input_mux alc268_capture_source = { |
| 12044 | .num_items = 4, |
| 12045 | .items = { |
| 12046 | { "Mic", 0x0 }, |
| 12047 | { "Front Mic", 0x1 }, |
| 12048 | { "Line", 0x2 }, |
| 12049 | { "CD", 0x3 }, |
| 12050 | }, |
| 12051 | }; |
| 12052 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12053 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12054 | .num_items = 3, |
| 12055 | .items = { |
| 12056 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12057 | { "Internal Mic", 0x1 }, |
| 12058 | { "Line", 0x2 }, |
| 12059 | }, |
| 12060 | }; |
| 12061 | |
| 12062 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12063 | .num_items = 3, |
| 12064 | .items = { |
| 12065 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12066 | { "Internal Mic", 0x6 }, |
| 12067 | { "Line", 0x2 }, |
| 12068 | }, |
| 12069 | }; |
| 12070 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12071 | #ifdef CONFIG_SND_DEBUG |
| 12072 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12073 | /* Volume widgets */ |
| 12074 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12075 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12076 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12077 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12078 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12079 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12080 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12081 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12082 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12083 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12084 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12085 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12086 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12087 | /* The below appears problematic on some hardwares */ |
| 12088 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12089 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12090 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12091 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12092 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12093 | |
| 12094 | /* Modes for retasking pin widgets */ |
| 12095 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12096 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12097 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12098 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12099 | |
| 12100 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12101 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12102 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12103 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12104 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12105 | |
| 12106 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12107 | * The ALC268 does not have an SPDIF input. |
| 12108 | */ |
| 12109 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12110 | |
| 12111 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12112 | * this output to turn on an external amplifier. |
| 12113 | */ |
| 12114 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12115 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12116 | |
| 12117 | { } /* end */ |
| 12118 | }; |
| 12119 | #endif |
| 12120 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12121 | /* create input playback/capture controls for the given pin */ |
| 12122 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12123 | const char *ctlname, int idx) |
| 12124 | { |
| 12125 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12126 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12127 | int err; |
| 12128 | |
| 12129 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12130 | switch (nid) { |
| 12131 | case 0x14: |
| 12132 | case 0x16: |
| 12133 | dac = 0x02; |
| 12134 | break; |
| 12135 | case 0x15: |
| 12136 | dac = 0x03; |
| 12137 | break; |
| 12138 | default: |
| 12139 | return 0; |
| 12140 | } |
| 12141 | if (spec->multiout.dac_nids[0] != dac && |
| 12142 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12143 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12144 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12145 | HDA_OUTPUT)); |
| 12146 | if (err < 0) |
| 12147 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12148 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12149 | } |
| 12150 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12151 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12152 | if (nid != 0x16) |
| 12153 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12154 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12155 | else /* mono */ |
| 12156 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12157 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12158 | if (err < 0) |
| 12159 | return err; |
| 12160 | return 0; |
| 12161 | } |
| 12162 | |
| 12163 | /* add playback controls from the parsed DAC table */ |
| 12164 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12165 | const struct auto_pin_cfg *cfg) |
| 12166 | { |
| 12167 | hda_nid_t nid; |
| 12168 | int err; |
| 12169 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12170 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12171 | |
| 12172 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12173 | if (nid) { |
| 12174 | const char *name; |
| 12175 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12176 | name = "Speaker"; |
| 12177 | else |
| 12178 | name = "Front"; |
| 12179 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12180 | if (err < 0) |
| 12181 | return err; |
| 12182 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12183 | |
| 12184 | nid = cfg->speaker_pins[0]; |
| 12185 | if (nid == 0x1d) { |
| 12186 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12187 | "Speaker Playback Volume", |
| 12188 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12189 | if (err < 0) |
| 12190 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12191 | } else { |
| 12192 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12193 | if (err < 0) |
| 12194 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12195 | } |
| 12196 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12197 | if (nid) { |
| 12198 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12199 | if (err < 0) |
| 12200 | return err; |
| 12201 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12202 | |
| 12203 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12204 | if (nid == 0x16) { |
| 12205 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12206 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12207 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12208 | if (err < 0) |
| 12209 | return err; |
| 12210 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12211 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12212 | } |
| 12213 | |
| 12214 | /* create playback/capture controls for input pins */ |
| 12215 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12216 | const struct auto_pin_cfg *cfg) |
| 12217 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12218 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12219 | int i, idx1, dmic_nid; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12220 | |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12221 | dmic_nid = 0x12; |
| 12222 | while (dmic_nid <= 0x13) { |
| 12223 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12224 | switch (cfg->input_pins[i]) { |
| 12225 | case 0x18: |
| 12226 | idx1 = 0; /* Mic 1 */ |
| 12227 | break; |
| 12228 | case 0x19: |
| 12229 | idx1 = 1; /* Mic 2 */ |
| 12230 | break; |
| 12231 | case 0x1a: |
| 12232 | idx1 = 2; /* Line In */ |
| 12233 | break; |
| 12234 | case 0x1c: |
| 12235 | idx1 = 3; /* CD */ |
| 12236 | break; |
| 12237 | case 0x12: |
| 12238 | case 0x13: |
| 12239 | if (cfg->input_pins[i] != dmic_nid) |
| 12240 | continue; |
| 12241 | idx1 = 6; /* digital mics */ |
| 12242 | break; |
| 12243 | default: |
| 12244 | continue; |
| 12245 | } |
| 12246 | imux->items[imux->num_items].label = |
| 12247 | auto_pin_cfg_labels[i]; |
| 12248 | imux->items[imux->num_items].index = idx1; |
| 12249 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12250 | } |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12251 | imux++; |
| 12252 | dmic_nid++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12253 | } |
| 12254 | return 0; |
| 12255 | } |
| 12256 | |
| 12257 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12258 | { |
| 12259 | struct alc_spec *spec = codec->spec; |
| 12260 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12261 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12262 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12263 | unsigned int dac_vol1, dac_vol2; |
| 12264 | |
| 12265 | if (speaker_nid) { |
| 12266 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12267 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12268 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12269 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12270 | AMP_IN_UNMUTE(1)); |
| 12271 | snd_hda_codec_write(codec, 0x10, 0, |
| 12272 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12273 | AMP_IN_UNMUTE(1)); |
| 12274 | } else { |
| 12275 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12276 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12277 | snd_hda_codec_write(codec, 0x10, 0, |
| 12278 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12279 | } |
| 12280 | |
| 12281 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12282 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12283 | dac_vol2 = AMP_OUT_ZERO; |
| 12284 | else if (line_nid == 0x15) |
| 12285 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12286 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12287 | dac_vol2 = AMP_OUT_ZERO; |
| 12288 | else if (hp_nid == 0x15) |
| 12289 | dac_vol1 = AMP_OUT_ZERO; |
| 12290 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12291 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12292 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12293 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12294 | |
| 12295 | snd_hda_codec_write(codec, 0x02, 0, |
| 12296 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12297 | snd_hda_codec_write(codec, 0x03, 0, |
| 12298 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12299 | } |
| 12300 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12301 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12302 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12303 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12304 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12305 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12306 | |
| 12307 | /* |
| 12308 | * BIOS auto configuration |
| 12309 | */ |
| 12310 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12311 | { |
| 12312 | struct alc_spec *spec = codec->spec; |
| 12313 | int err; |
| 12314 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12315 | |
| 12316 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12317 | alc268_ignore); |
| 12318 | if (err < 0) |
| 12319 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12320 | if (!spec->autocfg.line_outs) { |
| 12321 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12322 | spec->multiout.max_channels = 2; |
| 12323 | spec->no_analog = 1; |
| 12324 | goto dig_only; |
| 12325 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12326 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12327 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12328 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12329 | if (err < 0) |
| 12330 | return err; |
| 12331 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12332 | if (err < 0) |
| 12333 | return err; |
| 12334 | |
| 12335 | spec->multiout.max_channels = 2; |
| 12336 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12337 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12338 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12339 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12340 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12341 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12342 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12343 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12344 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12345 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12346 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12347 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12348 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12349 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12350 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12351 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12352 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12353 | err = alc_auto_add_mic_boost(codec); |
| 12354 | if (err < 0) |
| 12355 | return err; |
| 12356 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12357 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12358 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12359 | return 1; |
| 12360 | } |
| 12361 | |
| 12362 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12363 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12364 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12365 | |
| 12366 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12367 | static void alc268_auto_init(struct hda_codec *codec) |
| 12368 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12369 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12370 | alc268_auto_init_multi_out(codec); |
| 12371 | alc268_auto_init_hp_out(codec); |
| 12372 | alc268_auto_init_mono_speaker_out(codec); |
| 12373 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12374 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12375 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12376 | } |
| 12377 | |
| 12378 | /* |
| 12379 | * configuration and preset |
| 12380 | */ |
| 12381 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12382 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12383 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12384 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12385 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12386 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12387 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12388 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12389 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12390 | #ifdef CONFIG_SND_DEBUG |
| 12391 | [ALC268_TEST] = "test", |
| 12392 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12393 | [ALC268_AUTO] = "auto", |
| 12394 | }; |
| 12395 | |
| 12396 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12397 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12398 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12399 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12400 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12401 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12402 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12403 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12404 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12405 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12406 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12407 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12408 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12409 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12410 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12411 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12412 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12413 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12414 | {} |
| 12415 | }; |
| 12416 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12417 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12418 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12419 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12420 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12421 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12422 | ALC268_TOSHIBA), |
| 12423 | {} |
| 12424 | }; |
| 12425 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12426 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12427 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12428 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12429 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12430 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12431 | alc267_quanta_il1_verbs }, |
| 12432 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12433 | .dac_nids = alc268_dac_nids, |
| 12434 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12435 | .adc_nids = alc268_adc_nids_alt, |
| 12436 | .hp_nid = 0x03, |
| 12437 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12438 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12439 | .unsol_event = alc_sku_unsol_event, |
| 12440 | .setup = alc267_quanta_il1_setup, |
| 12441 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12442 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12443 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12444 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12445 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12446 | .init_verbs = { alc268_base_init_verbs }, |
| 12447 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12448 | .dac_nids = alc268_dac_nids, |
| 12449 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12450 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12451 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12452 | .hp_nid = 0x03, |
| 12453 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12454 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12455 | .channel_mode = alc268_modes, |
| 12456 | .input_mux = &alc268_capture_source, |
| 12457 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12458 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12459 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12460 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12461 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12462 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12463 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12464 | .dac_nids = alc268_dac_nids, |
| 12465 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12466 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12467 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12468 | .hp_nid = 0x03, |
| 12469 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12470 | .channel_mode = alc268_modes, |
| 12471 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12472 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12473 | .setup = alc268_toshiba_setup, |
| 12474 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12475 | }, |
| 12476 | [ALC268_ACER] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12477 | .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12478 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12479 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12480 | alc268_acer_verbs }, |
| 12481 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12482 | .dac_nids = alc268_dac_nids, |
| 12483 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12484 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12485 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12486 | .hp_nid = 0x02, |
| 12487 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12488 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12489 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12490 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12491 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12492 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12493 | [ALC268_ACER_DMIC] = { |
| 12494 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12495 | alc268_beep_mixer }, |
| 12496 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12497 | alc268_acer_verbs }, |
| 12498 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12499 | .dac_nids = alc268_dac_nids, |
| 12500 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12501 | .adc_nids = alc268_adc_nids_alt, |
| 12502 | .capsrc_nids = alc268_capsrc_nids, |
| 12503 | .hp_nid = 0x02, |
| 12504 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12505 | .channel_mode = alc268_modes, |
| 12506 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12507 | .unsol_event = alc268_acer_unsol_event, |
| 12508 | .init_hook = alc268_acer_init_hook, |
| 12509 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12510 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12511 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12512 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12513 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12514 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12515 | alc268_acer_aspire_one_verbs }, |
| 12516 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12517 | .dac_nids = alc268_dac_nids, |
| 12518 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12519 | .adc_nids = alc268_adc_nids_alt, |
| 12520 | .capsrc_nids = alc268_capsrc_nids, |
| 12521 | .hp_nid = 0x03, |
| 12522 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12523 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12524 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12525 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12526 | .init_hook = alc268_acer_lc_init_hook, |
| 12527 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12528 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12529 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 12530 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12531 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12532 | alc268_dell_verbs }, |
| 12533 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12534 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12535 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12536 | .adc_nids = alc268_adc_nids_alt, |
| 12537 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12538 | .hp_nid = 0x02, |
| 12539 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12540 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12541 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12542 | .setup = alc268_dell_setup, |
| 12543 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12544 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12545 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12546 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12547 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12548 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12549 | alc268_toshiba_verbs }, |
| 12550 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12551 | .dac_nids = alc268_dac_nids, |
| 12552 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12553 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12554 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12555 | .hp_nid = 0x03, |
| 12556 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12557 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12558 | .channel_mode = alc268_modes, |
| 12559 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12560 | .setup = alc268_toshiba_setup, |
| 12561 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12562 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12563 | #ifdef CONFIG_SND_DEBUG |
| 12564 | [ALC268_TEST] = { |
| 12565 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12566 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12567 | alc268_volume_init_verbs }, |
| 12568 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12569 | .dac_nids = alc268_dac_nids, |
| 12570 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12571 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12572 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12573 | .hp_nid = 0x03, |
| 12574 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12575 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12576 | .channel_mode = alc268_modes, |
| 12577 | .input_mux = &alc268_capture_source, |
| 12578 | }, |
| 12579 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12580 | }; |
| 12581 | |
| 12582 | static int patch_alc268(struct hda_codec *codec) |
| 12583 | { |
| 12584 | struct alc_spec *spec; |
| 12585 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12586 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12587 | |
| 12588 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12589 | if (spec == NULL) |
| 12590 | return -ENOMEM; |
| 12591 | |
| 12592 | codec->spec = spec; |
| 12593 | |
| 12594 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12595 | alc268_models, |
| 12596 | alc268_cfg_tbl); |
| 12597 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12598 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 12599 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 12600 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 12601 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12602 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12603 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12604 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12605 | board_config = ALC268_AUTO; |
| 12606 | } |
| 12607 | |
| 12608 | if (board_config == ALC268_AUTO) { |
| 12609 | /* automatic parse from the BIOS config */ |
| 12610 | err = alc268_parse_auto_config(codec); |
| 12611 | if (err < 0) { |
| 12612 | alc_free(codec); |
| 12613 | return err; |
| 12614 | } else if (!err) { |
| 12615 | printk(KERN_INFO |
| 12616 | "hda_codec: Cannot set up configuration " |
| 12617 | "from BIOS. Using base mode...\n"); |
| 12618 | board_config = ALC268_3ST; |
| 12619 | } |
| 12620 | } |
| 12621 | |
| 12622 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12623 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12624 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12625 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12626 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12627 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12628 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12629 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12630 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12631 | has_beep = 0; |
| 12632 | for (i = 0; i < spec->num_mixers; i++) { |
| 12633 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12634 | has_beep = 1; |
| 12635 | break; |
| 12636 | } |
| 12637 | } |
| 12638 | |
| 12639 | if (has_beep) { |
| 12640 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12641 | if (err < 0) { |
| 12642 | alc_free(codec); |
| 12643 | return err; |
| 12644 | } |
| 12645 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12646 | /* override the amp caps for beep generator */ |
| 12647 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12648 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12649 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12650 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12651 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12652 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12653 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12654 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12655 | /* check whether NID 0x07 is valid */ |
| 12656 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12657 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12658 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12659 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12660 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12661 | if (spec->auto_mic || |
| 12662 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12663 | spec->adc_nids = alc268_adc_nids_alt; |
| 12664 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12665 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 12666 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 12667 | else |
| 12668 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12669 | } else { |
| 12670 | spec->adc_nids = alc268_adc_nids; |
| 12671 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12672 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12673 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12674 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12675 | /* set default input source */ |
| 12676 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12677 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12678 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12679 | i < spec->num_mux_defs ? |
| 12680 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12681 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12682 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12683 | |
| 12684 | spec->vmaster_nid = 0x02; |
| 12685 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12686 | codec->patch_ops = alc_patch_ops; |
| 12687 | if (board_config == ALC268_AUTO) |
| 12688 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12689 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12690 | codec->proc_widget_hook = print_realtek_coef; |
| 12691 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12692 | return 0; |
| 12693 | } |
| 12694 | |
| 12695 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12696 | * ALC269 channel source setting (2 channel) |
| 12697 | */ |
| 12698 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12699 | |
| 12700 | #define alc269_dac_nids alc260_dac_nids |
| 12701 | |
| 12702 | static hda_nid_t alc269_adc_nids[1] = { |
| 12703 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12704 | 0x08, |
| 12705 | }; |
| 12706 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12707 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12708 | 0x23, |
| 12709 | }; |
| 12710 | |
| 12711 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12712 | * not a mux! |
| 12713 | */ |
| 12714 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12715 | #define alc269_modes alc260_modes |
| 12716 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12717 | |
| 12718 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12719 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12720 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12721 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12722 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12723 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12724 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12725 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12726 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12727 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12728 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12729 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12730 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12731 | { } /* end */ |
| 12732 | }; |
| 12733 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12734 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12735 | /* output mixer control */ |
| 12736 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12737 | { |
| 12738 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12739 | .name = "Master Playback Switch", |
| 12740 | .info = snd_hda_mixer_amp_switch_info, |
| 12741 | .get = snd_hda_mixer_amp_switch_get, |
| 12742 | .put = alc268_acer_master_sw_put, |
| 12743 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12744 | }, |
| 12745 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12746 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12747 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12748 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12749 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12750 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12751 | { } |
| 12752 | }; |
| 12753 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12754 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12755 | /* output mixer control */ |
| 12756 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12757 | { |
| 12758 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12759 | .name = "Master Playback Switch", |
| 12760 | .info = snd_hda_mixer_amp_switch_info, |
| 12761 | .get = snd_hda_mixer_amp_switch_get, |
| 12762 | .put = alc268_acer_master_sw_put, |
| 12763 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12764 | }, |
| 12765 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12767 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12768 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12769 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12770 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12771 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12772 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12773 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12774 | { } |
| 12775 | }; |
| 12776 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12777 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12778 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12779 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12780 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12781 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12782 | { } /* end */ |
| 12783 | }; |
| 12784 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12785 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12786 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12787 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12788 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12789 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12790 | { } /* end */ |
| 12791 | }; |
| 12792 | |
| 12793 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12794 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12795 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12796 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12797 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12798 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12799 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12800 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12801 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12802 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12803 | { } |
| 12804 | }; |
| 12805 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12806 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12807 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12808 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12809 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12810 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12811 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12812 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12813 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12814 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12815 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12816 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12817 | { } |
| 12818 | }; |
| 12819 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12820 | /* toggle speaker-output according to the hp-jack state */ |
| 12821 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12822 | { |
| 12823 | unsigned int present; |
| 12824 | unsigned char bits; |
| 12825 | |
| 12826 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12827 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12828 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12829 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12830 | AMP_IN_MUTE(0), bits); |
| 12831 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12832 | AMP_IN_MUTE(0), bits); |
| 12833 | |
| 12834 | snd_hda_codec_write(codec, 0x20, 0, |
| 12835 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12836 | snd_hda_codec_write(codec, 0x20, 0, |
| 12837 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12838 | |
| 12839 | snd_hda_codec_write(codec, 0x20, 0, |
| 12840 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12841 | snd_hda_codec_write(codec, 0x20, 0, |
| 12842 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12843 | } |
| 12844 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12845 | /* toggle speaker-output according to the hp-jacks state */ |
| 12846 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12847 | { |
| 12848 | unsigned int present; |
| 12849 | unsigned char bits; |
| 12850 | |
| 12851 | /* Check laptop headphone socket */ |
| 12852 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12853 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12854 | |
| 12855 | /* Check port replicator headphone socket */ |
| 12856 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12857 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12858 | |
| 12859 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12860 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12861 | AMP_IN_MUTE(0), bits); |
| 12862 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12863 | AMP_IN_MUTE(0), bits); |
| 12864 | |
| 12865 | snd_hda_codec_write(codec, 0x20, 0, |
| 12866 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12867 | snd_hda_codec_write(codec, 0x20, 0, |
| 12868 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12869 | |
| 12870 | snd_hda_codec_write(codec, 0x20, 0, |
| 12871 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12872 | snd_hda_codec_write(codec, 0x20, 0, |
| 12873 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12874 | } |
| 12875 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12876 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12877 | { |
| 12878 | unsigned int present_laptop; |
| 12879 | unsigned int present_dock; |
| 12880 | |
| 12881 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12882 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12883 | |
| 12884 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12885 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12886 | |
| 12887 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12888 | if (present_dock) |
| 12889 | snd_hda_codec_write(codec, 0x23, 0, |
| 12890 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12891 | if (present_laptop) |
| 12892 | snd_hda_codec_write(codec, 0x23, 0, |
| 12893 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12894 | if (!present_dock && !present_laptop) |
| 12895 | snd_hda_codec_write(codec, 0x23, 0, |
| 12896 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12897 | } |
| 12898 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12899 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12900 | unsigned int res) |
| 12901 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12902 | switch (res >> 26) { |
| 12903 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12904 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12905 | break; |
| 12906 | case ALC880_MIC_EVENT: |
| 12907 | alc_mic_automute(codec); |
| 12908 | break; |
| 12909 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12910 | } |
| 12911 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12912 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12913 | unsigned int res) |
| 12914 | { |
| 12915 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12916 | alc269_lifebook_speaker_automute(codec); |
| 12917 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12918 | alc269_lifebook_mic_autoswitch(codec); |
| 12919 | } |
| 12920 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12921 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 12922 | { |
| 12923 | struct alc_spec *spec = codec->spec; |
| 12924 | spec->ext_mic.pin = 0x18; |
| 12925 | spec->ext_mic.mux_idx = 0; |
| 12926 | spec->int_mic.pin = 0x19; |
| 12927 | spec->int_mic.mux_idx = 1; |
| 12928 | spec->auto_mic = 1; |
| 12929 | } |
| 12930 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12931 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12932 | { |
| 12933 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12934 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12935 | } |
| 12936 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12937 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12938 | { |
| 12939 | alc269_lifebook_speaker_automute(codec); |
| 12940 | alc269_lifebook_mic_autoswitch(codec); |
| 12941 | } |
| 12942 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12943 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12944 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12945 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12946 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12948 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12949 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12950 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12951 | {} |
| 12952 | }; |
| 12953 | |
| 12954 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12955 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12956 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12957 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12958 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12959 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12960 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12961 | {} |
| 12962 | }; |
| 12963 | |
| 12964 | /* toggle speaker-output according to the hp-jack state */ |
| 12965 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12966 | { |
| 12967 | unsigned int present; |
| 12968 | unsigned char bits; |
| 12969 | |
| 12970 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12971 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12972 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12973 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12974 | AMP_IN_MUTE(0), bits); |
| 12975 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12976 | AMP_IN_MUTE(0), bits); |
| 12977 | } |
| 12978 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12979 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12980 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12981 | unsigned int res) |
| 12982 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12983 | switch (res >> 26) { |
| 12984 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12985 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12986 | break; |
| 12987 | case ALC880_MIC_EVENT: |
| 12988 | alc_mic_automute(codec); |
| 12989 | break; |
| 12990 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12991 | } |
| 12992 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12993 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
| 12994 | { |
| 12995 | struct alc_spec *spec = codec->spec; |
| 12996 | spec->ext_mic.pin = 0x18; |
| 12997 | spec->ext_mic.mux_idx = 0; |
| 12998 | spec->int_mic.pin = 0x12; |
| 12999 | spec->int_mic.mux_idx = 5; |
| 13000 | spec->auto_mic = 1; |
| 13001 | } |
| 13002 | |
| 13003 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
| 13004 | { |
| 13005 | struct alc_spec *spec = codec->spec; |
| 13006 | spec->ext_mic.pin = 0x18; |
| 13007 | spec->ext_mic.mux_idx = 0; |
| 13008 | spec->int_mic.pin = 0x19; |
| 13009 | spec->int_mic.mux_idx = 1; |
| 13010 | spec->auto_mic = 1; |
| 13011 | } |
| 13012 | |
| 13013 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13014 | { |
| 13015 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13016 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13017 | } |
| 13018 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13019 | /* |
| 13020 | * generic initialization of ADC, input mixers and output mixers |
| 13021 | */ |
| 13022 | static struct hda_verb alc269_init_verbs[] = { |
| 13023 | /* |
| 13024 | * Unmute ADC0 and set the default input to mic-in |
| 13025 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13026 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13027 | |
| 13028 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13029 | * analog-loopback mixer widget |
| 13030 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13031 | * front panel mic (mic 2) |
| 13032 | */ |
| 13033 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13035 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13036 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13039 | |
| 13040 | /* |
| 13041 | * Set up output mixers (0x0c - 0x0e) |
| 13042 | */ |
| 13043 | /* set vol=0 to output mixers */ |
| 13044 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13045 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13046 | |
| 13047 | /* set up input amps for analog loopback */ |
| 13048 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13049 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13051 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13052 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13053 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13054 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13055 | |
| 13056 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13058 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13059 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13060 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13061 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13062 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13063 | |
| 13064 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13065 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13066 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13067 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13068 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13069 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13070 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13071 | |
| 13072 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13073 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13074 | |
| 13075 | /* FIXME: use matrix-type input source selection */ |
| 13076 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13077 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13078 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13079 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13080 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13082 | |
| 13083 | /* set EAPD */ |
| 13084 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13085 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13086 | { } |
| 13087 | }; |
| 13088 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame^] | 13089 | #define alc269_auto_create_multi_out_ctls \ |
| 13090 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13091 | #define alc269_auto_create_analog_input_ctls \ |
| 13092 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13093 | |
| 13094 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13095 | #define alc269_loopbacks alc880_loopbacks |
| 13096 | #endif |
| 13097 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13098 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13099 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13100 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13101 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13102 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13103 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13104 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13105 | .substreams = 1, |
| 13106 | .channels_min = 2, |
| 13107 | .channels_max = 8, |
| 13108 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13109 | /* NID is set in alc_build_pcms */ |
| 13110 | .ops = { |
| 13111 | .open = alc880_playback_pcm_open, |
| 13112 | .prepare = alc880_playback_pcm_prepare, |
| 13113 | .cleanup = alc880_playback_pcm_cleanup |
| 13114 | }, |
| 13115 | }; |
| 13116 | |
| 13117 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13118 | .substreams = 1, |
| 13119 | .channels_min = 2, |
| 13120 | .channels_max = 2, |
| 13121 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13122 | /* NID is set in alc_build_pcms */ |
| 13123 | }; |
| 13124 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13125 | /* |
| 13126 | * BIOS auto configuration |
| 13127 | */ |
| 13128 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13129 | { |
| 13130 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13131 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13132 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13133 | |
| 13134 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13135 | alc269_ignore); |
| 13136 | if (err < 0) |
| 13137 | return err; |
| 13138 | |
| 13139 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13140 | if (err < 0) |
| 13141 | return err; |
| 13142 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13143 | if (err < 0) |
| 13144 | return err; |
| 13145 | |
| 13146 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13147 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13148 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13149 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13150 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13151 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13152 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13153 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13154 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13155 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13156 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13157 | /* set default input source */ |
| 13158 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13159 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13160 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13161 | |
| 13162 | err = alc_auto_add_mic_boost(codec); |
| 13163 | if (err < 0) |
| 13164 | return err; |
| 13165 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13166 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13167 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13168 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13169 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13170 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13171 | return 1; |
| 13172 | } |
| 13173 | |
| 13174 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13175 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13176 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13177 | |
| 13178 | |
| 13179 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13180 | static void alc269_auto_init(struct hda_codec *codec) |
| 13181 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13182 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13183 | alc269_auto_init_multi_out(codec); |
| 13184 | alc269_auto_init_hp_out(codec); |
| 13185 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13186 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13187 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13188 | } |
| 13189 | |
| 13190 | /* |
| 13191 | * configuration and preset |
| 13192 | */ |
| 13193 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13194 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13195 | [ALC269_QUANTA_FL1] = "quanta", |
| 13196 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13197 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13198 | [ALC269_FUJITSU] = "fujitsu", |
| 13199 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13200 | }; |
| 13201 | |
| 13202 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13203 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13204 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13205 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13206 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13207 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13208 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13209 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13210 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13211 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13212 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13213 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13214 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13215 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13216 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13217 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13218 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13219 | {} |
| 13220 | }; |
| 13221 | |
| 13222 | static struct alc_config_preset alc269_presets[] = { |
| 13223 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13224 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13225 | .init_verbs = { alc269_init_verbs }, |
| 13226 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13227 | .dac_nids = alc269_dac_nids, |
| 13228 | .hp_nid = 0x03, |
| 13229 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13230 | .channel_mode = alc269_modes, |
| 13231 | .input_mux = &alc269_capture_source, |
| 13232 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13233 | [ALC269_QUANTA_FL1] = { |
| 13234 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13235 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13236 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13237 | .dac_nids = alc269_dac_nids, |
| 13238 | .hp_nid = 0x03, |
| 13239 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13240 | .channel_mode = alc269_modes, |
| 13241 | .input_mux = &alc269_capture_source, |
| 13242 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13243 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13244 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13245 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13246 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13247 | .mixers = { alc269_eeepc_mixer }, |
| 13248 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13249 | .init_verbs = { alc269_init_verbs, |
| 13250 | alc269_eeepc_amic_init_verbs }, |
| 13251 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13252 | .dac_nids = alc269_dac_nids, |
| 13253 | .hp_nid = 0x03, |
| 13254 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13255 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13256 | .unsol_event = alc269_eeepc_unsol_event, |
| 13257 | .setup = alc269_eeepc_amic_setup, |
| 13258 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13259 | }, |
| 13260 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13261 | .mixers = { alc269_eeepc_mixer }, |
| 13262 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13263 | .init_verbs = { alc269_init_verbs, |
| 13264 | alc269_eeepc_dmic_init_verbs }, |
| 13265 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13266 | .dac_nids = alc269_dac_nids, |
| 13267 | .hp_nid = 0x03, |
| 13268 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13269 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13270 | .unsol_event = alc269_eeepc_unsol_event, |
| 13271 | .setup = alc269_eeepc_dmic_setup, |
| 13272 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13273 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13274 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13275 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13276 | .cap_mixer = alc269_epc_capture_mixer, |
| 13277 | .init_verbs = { alc269_init_verbs, |
| 13278 | alc269_eeepc_dmic_init_verbs }, |
| 13279 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13280 | .dac_nids = alc269_dac_nids, |
| 13281 | .hp_nid = 0x03, |
| 13282 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13283 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13284 | .unsol_event = alc269_eeepc_unsol_event, |
| 13285 | .setup = alc269_eeepc_dmic_setup, |
| 13286 | .init_hook = alc269_eeepc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13287 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13288 | [ALC269_LIFEBOOK] = { |
| 13289 | .mixers = { alc269_lifebook_mixer }, |
| 13290 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13291 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13292 | .dac_nids = alc269_dac_nids, |
| 13293 | .hp_nid = 0x03, |
| 13294 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13295 | .channel_mode = alc269_modes, |
| 13296 | .input_mux = &alc269_capture_source, |
| 13297 | .unsol_event = alc269_lifebook_unsol_event, |
| 13298 | .init_hook = alc269_lifebook_init_hook, |
| 13299 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13300 | }; |
| 13301 | |
| 13302 | static int patch_alc269(struct hda_codec *codec) |
| 13303 | { |
| 13304 | struct alc_spec *spec; |
| 13305 | int board_config; |
| 13306 | int err; |
| 13307 | |
| 13308 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13309 | if (spec == NULL) |
| 13310 | return -ENOMEM; |
| 13311 | |
| 13312 | codec->spec = spec; |
| 13313 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13314 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13315 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13316 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13317 | alc269_models, |
| 13318 | alc269_cfg_tbl); |
| 13319 | |
| 13320 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13321 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13322 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13323 | board_config = ALC269_AUTO; |
| 13324 | } |
| 13325 | |
| 13326 | if (board_config == ALC269_AUTO) { |
| 13327 | /* automatic parse from the BIOS config */ |
| 13328 | err = alc269_parse_auto_config(codec); |
| 13329 | if (err < 0) { |
| 13330 | alc_free(codec); |
| 13331 | return err; |
| 13332 | } else if (!err) { |
| 13333 | printk(KERN_INFO |
| 13334 | "hda_codec: Cannot set up configuration " |
| 13335 | "from BIOS. Using base mode...\n"); |
| 13336 | board_config = ALC269_BASIC; |
| 13337 | } |
| 13338 | } |
| 13339 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13340 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13341 | if (err < 0) { |
| 13342 | alc_free(codec); |
| 13343 | return err; |
| 13344 | } |
| 13345 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13346 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13347 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13348 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13349 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13350 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13351 | * fix the sample rate of analog I/O to 44.1kHz |
| 13352 | */ |
| 13353 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13354 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13355 | } else { |
| 13356 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13357 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13358 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13359 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13360 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13361 | |
| 13362 | spec->adc_nids = alc269_adc_nids; |
| 13363 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13364 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13365 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13366 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13367 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13368 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13369 | spec->vmaster_nid = 0x02; |
| 13370 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13371 | codec->patch_ops = alc_patch_ops; |
| 13372 | if (board_config == ALC269_AUTO) |
| 13373 | spec->init_hook = alc269_auto_init; |
| 13374 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13375 | if (!spec->loopback.amplist) |
| 13376 | spec->loopback.amplist = alc269_loopbacks; |
| 13377 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13378 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13379 | |
| 13380 | return 0; |
| 13381 | } |
| 13382 | |
| 13383 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13384 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13385 | */ |
| 13386 | |
| 13387 | /* |
| 13388 | * set the path ways for 2 channel output |
| 13389 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13390 | */ |
| 13391 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13392 | /* set pin widget 1Ah (line in) for input */ |
| 13393 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13394 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13395 | * the vref |
| 13396 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13397 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13398 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13399 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13400 | #if 0 |
| 13401 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13402 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13403 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13404 | { } /* end */ |
| 13405 | }; |
| 13406 | /* |
| 13407 | * 6ch mode |
| 13408 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13409 | */ |
| 13410 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13411 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13412 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13413 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13414 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13415 | |
| 13416 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13417 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13418 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13419 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13420 | #if 0 |
| 13421 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13422 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13423 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13424 | { } /* end */ |
| 13425 | }; |
| 13426 | |
| 13427 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13428 | { 2, alc861_threestack_ch2_init }, |
| 13429 | { 6, alc861_threestack_ch6_init }, |
| 13430 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13431 | /* Set mic1 as input and unmute the mixer */ |
| 13432 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13433 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13434 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13435 | { } /* end */ |
| 13436 | }; |
| 13437 | /* Set mic1 as output and mute mixer */ |
| 13438 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13439 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13440 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13441 | { } /* end */ |
| 13442 | }; |
| 13443 | |
| 13444 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13445 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13446 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13447 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13448 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13449 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13450 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13451 | /* set pin widget 1Ah (line in) for input */ |
| 13452 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13453 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13454 | * the vref |
| 13455 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13456 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13457 | |
| 13458 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13459 | #if 0 |
| 13460 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13461 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13462 | #endif |
| 13463 | { } /* end */ |
| 13464 | }; |
| 13465 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13466 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13467 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13468 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13469 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13470 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13471 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13472 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13473 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13474 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13475 | |
| 13476 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13477 | #if 0 |
| 13478 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13479 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13480 | #endif |
| 13481 | { } /* end */ |
| 13482 | }; |
| 13483 | |
| 13484 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13485 | { 2, alc861_asus_ch2_init }, |
| 13486 | { 6, alc861_asus_ch6_init }, |
| 13487 | }; |
| 13488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13489 | /* patch-ALC861 */ |
| 13490 | |
| 13491 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13492 | /* output mixer control */ |
| 13493 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13494 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13495 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13496 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13497 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13498 | |
| 13499 | /*Input mixer control */ |
| 13500 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13501 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13502 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13503 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13505 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13508 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13509 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13511 | { } /* end */ |
| 13512 | }; |
| 13513 | |
| 13514 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13515 | /* output mixer control */ |
| 13516 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13517 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13518 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13519 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13520 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13521 | |
| 13522 | /* Input mixer control */ |
| 13523 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13524 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13525 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13526 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13527 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13528 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13531 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13532 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13533 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13534 | { |
| 13535 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13536 | .name = "Channel Mode", |
| 13537 | .info = alc_ch_mode_info, |
| 13538 | .get = alc_ch_mode_get, |
| 13539 | .put = alc_ch_mode_put, |
| 13540 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13541 | }, |
| 13542 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13543 | }; |
| 13544 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13545 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13546 | /* output mixer control */ |
| 13547 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13548 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13549 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13550 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13551 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13552 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13553 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13554 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13555 | /* output mixer control */ |
| 13556 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13557 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13558 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13559 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13560 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13561 | |
| 13562 | /* Input mixer control */ |
| 13563 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13564 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13565 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13566 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13567 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13568 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13569 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13570 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13571 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13572 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13573 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13574 | { |
| 13575 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13576 | .name = "Channel Mode", |
| 13577 | .info = alc_ch_mode_info, |
| 13578 | .get = alc_ch_mode_get, |
| 13579 | .put = alc_ch_mode_put, |
| 13580 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13581 | }, |
| 13582 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13583 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13584 | |
| 13585 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13586 | /* output mixer control */ |
| 13587 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13588 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13589 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13590 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13591 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13592 | |
| 13593 | /* Input mixer control */ |
| 13594 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13595 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13596 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13597 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13598 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13599 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13600 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13601 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13602 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13603 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13604 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13605 | { |
| 13606 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13607 | .name = "Channel Mode", |
| 13608 | .info = alc_ch_mode_info, |
| 13609 | .get = alc_ch_mode_get, |
| 13610 | .put = alc_ch_mode_put, |
| 13611 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13612 | }, |
| 13613 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13614 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13615 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13616 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13617 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13618 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13619 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13620 | { } |
| 13621 | }; |
| 13622 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13623 | /* |
| 13624 | * generic initialization of ADC, input mixers and output mixers |
| 13625 | */ |
| 13626 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13627 | /* |
| 13628 | * Unmute ADC0 and set the default input to mic-in |
| 13629 | */ |
| 13630 | /* port-A for surround (rear panel) */ |
| 13631 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13632 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13633 | /* port-B for mic-in (rear panel) with vref */ |
| 13634 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13635 | /* port-C for line-in (rear panel) */ |
| 13636 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13637 | /* port-D for Front */ |
| 13638 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13639 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13640 | /* port-E for HP out (front panel) */ |
| 13641 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13642 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13643 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13644 | /* port-F for mic-in (front panel) with vref */ |
| 13645 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13646 | /* port-G for CLFE (rear panel) */ |
| 13647 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13648 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13649 | /* port-H for side (rear panel) */ |
| 13650 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13651 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13652 | /* CD-in */ |
| 13653 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13654 | /* route front mic to ADC1*/ |
| 13655 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13656 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13657 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13658 | /* Unmute DAC0~3 & spdif out*/ |
| 13659 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13660 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13661 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13662 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13663 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13664 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13665 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13666 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13667 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13668 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13669 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13670 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13671 | /* Unmute Stereo Mixer 15 */ |
| 13672 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13673 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13674 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13675 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13676 | |
| 13677 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13678 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13679 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13680 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13681 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13682 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13683 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13684 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13685 | /* hp used DAC 3 (Front) */ |
| 13686 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13688 | |
| 13689 | { } |
| 13690 | }; |
| 13691 | |
| 13692 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13693 | /* |
| 13694 | * Unmute ADC0 and set the default input to mic-in |
| 13695 | */ |
| 13696 | /* port-A for surround (rear panel) */ |
| 13697 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13698 | /* port-B for mic-in (rear panel) with vref */ |
| 13699 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13700 | /* port-C for line-in (rear panel) */ |
| 13701 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13702 | /* port-D for Front */ |
| 13703 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13704 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13705 | /* port-E for HP out (front panel) */ |
| 13706 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13707 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13708 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13709 | /* port-F for mic-in (front panel) with vref */ |
| 13710 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13711 | /* port-G for CLFE (rear panel) */ |
| 13712 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13713 | /* port-H for side (rear panel) */ |
| 13714 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13715 | /* CD-in */ |
| 13716 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13717 | /* route front mic to ADC1*/ |
| 13718 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13719 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13720 | /* Unmute DAC0~3 & spdif out*/ |
| 13721 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13722 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13723 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13724 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13725 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13726 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13727 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13728 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13729 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13730 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13731 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13733 | /* Unmute Stereo Mixer 15 */ |
| 13734 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13735 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13736 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13738 | |
| 13739 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13740 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13741 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13742 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13743 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13744 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13745 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13746 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13747 | /* hp used DAC 3 (Front) */ |
| 13748 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13749 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13750 | { } |
| 13751 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13752 | |
| 13753 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13754 | /* |
| 13755 | * Unmute ADC0 and set the default input to mic-in |
| 13756 | */ |
| 13757 | /* port-A for surround (rear panel) */ |
| 13758 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13759 | /* port-B for mic-in (rear panel) with vref */ |
| 13760 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13761 | /* port-C for line-in (rear panel) */ |
| 13762 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13763 | /* port-D for Front */ |
| 13764 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13765 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13766 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13767 | /* this has to be set to VREF80 */ |
| 13768 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13769 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13770 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13771 | /* port-F for mic-in (front panel) with vref */ |
| 13772 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13773 | /* port-G for CLFE (rear panel) */ |
| 13774 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13775 | /* port-H for side (rear panel) */ |
| 13776 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13777 | /* CD-in */ |
| 13778 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13779 | /* route front mic to ADC1*/ |
| 13780 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13781 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13782 | /* Unmute DAC0~3 & spdif out*/ |
| 13783 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13784 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13785 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13786 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13788 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13789 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13790 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13791 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13792 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13793 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13794 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13795 | /* Unmute Stereo Mixer 15 */ |
| 13796 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13797 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13798 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13800 | |
| 13801 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13802 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13803 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13804 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13805 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13806 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13807 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13808 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13809 | /* hp used DAC 3 (Front) */ |
| 13810 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13811 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13812 | { } |
| 13813 | }; |
| 13814 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13815 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13816 | /* |
| 13817 | * Unmute ADC0 and set the default input to mic-in |
| 13818 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13819 | /* port-A for surround (rear panel) |
| 13820 | * according to codec#0 this is the HP jack |
| 13821 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13822 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13823 | /* route front PCM to HP */ |
| 13824 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13825 | /* port-B for mic-in (rear panel) with vref */ |
| 13826 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13827 | /* port-C for line-in (rear panel) */ |
| 13828 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13829 | /* port-D for Front */ |
| 13830 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13831 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13832 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13833 | /* this has to be set to VREF80 */ |
| 13834 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13835 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13836 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13837 | /* port-F for mic-in (front panel) with vref */ |
| 13838 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13839 | /* port-G for CLFE (rear panel) */ |
| 13840 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13841 | /* port-H for side (rear panel) */ |
| 13842 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13843 | /* CD-in */ |
| 13844 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13845 | /* route front mic to ADC1*/ |
| 13846 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13847 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13848 | /* Unmute DAC0~3 & spdif out*/ |
| 13849 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13850 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13851 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13852 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13854 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13855 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13856 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13857 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13858 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13859 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13860 | /* Unmute Stereo Mixer 15 */ |
| 13861 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13862 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13863 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13865 | |
| 13866 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13867 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13868 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13869 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13870 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13871 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13872 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13873 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13874 | /* hp used DAC 3 (Front) */ |
| 13875 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13877 | { } |
| 13878 | }; |
| 13879 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13880 | /* additional init verbs for ASUS laptops */ |
| 13881 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13882 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13883 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13884 | { } |
| 13885 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13886 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13887 | /* |
| 13888 | * generic initialization of ADC, input mixers and output mixers |
| 13889 | */ |
| 13890 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13891 | /* |
| 13892 | * Unmute ADC0 and set the default input to mic-in |
| 13893 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13894 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13895 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13896 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13897 | /* Unmute DAC0~3 & spdif out*/ |
| 13898 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13899 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13900 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13901 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13904 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13905 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13906 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13907 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13908 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13909 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13910 | /* Unmute Stereo Mixer 15 */ |
| 13911 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13913 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13914 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13915 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13916 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13917 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13918 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13919 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13920 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13921 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13922 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13923 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13924 | |
| 13925 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13926 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13927 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13928 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13929 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13930 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13931 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13932 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13933 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13934 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13935 | |
| 13936 | { } |
| 13937 | }; |
| 13938 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13939 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13940 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13941 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13942 | { } |
| 13943 | }; |
| 13944 | |
| 13945 | /* toggle speaker-output according to the hp-jack state */ |
| 13946 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13947 | { |
| 13948 | unsigned int present; |
| 13949 | |
| 13950 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13951 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13952 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13953 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13954 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13955 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13956 | } |
| 13957 | |
| 13958 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13959 | unsigned int res) |
| 13960 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13961 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13962 | alc861_toshiba_automute(codec); |
| 13963 | } |
| 13964 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13965 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13966 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13967 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13968 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13969 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13970 | |
| 13971 | |
| 13972 | #define ALC861_DIGOUT_NID 0x07 |
| 13973 | |
| 13974 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13975 | { 8, NULL } |
| 13976 | }; |
| 13977 | |
| 13978 | static hda_nid_t alc861_dac_nids[4] = { |
| 13979 | /* front, surround, clfe, side */ |
| 13980 | 0x03, 0x06, 0x05, 0x04 |
| 13981 | }; |
| 13982 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13983 | static hda_nid_t alc660_dac_nids[3] = { |
| 13984 | /* front, clfe, surround */ |
| 13985 | 0x03, 0x05, 0x06 |
| 13986 | }; |
| 13987 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13988 | static hda_nid_t alc861_adc_nids[1] = { |
| 13989 | /* ADC0-2 */ |
| 13990 | 0x08, |
| 13991 | }; |
| 13992 | |
| 13993 | static struct hda_input_mux alc861_capture_source = { |
| 13994 | .num_items = 5, |
| 13995 | .items = { |
| 13996 | { "Mic", 0x0 }, |
| 13997 | { "Front Mic", 0x3 }, |
| 13998 | { "Line", 0x1 }, |
| 13999 | { "CD", 0x4 }, |
| 14000 | { "Mixer", 0x5 }, |
| 14001 | }, |
| 14002 | }; |
| 14003 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14004 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14005 | { |
| 14006 | struct alc_spec *spec = codec->spec; |
| 14007 | hda_nid_t mix, srcs[5]; |
| 14008 | int i, j, num; |
| 14009 | |
| 14010 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14011 | return 0; |
| 14012 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14013 | if (num < 0) |
| 14014 | return 0; |
| 14015 | for (i = 0; i < num; i++) { |
| 14016 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14017 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14018 | if (type != AC_WID_AUD_OUT) |
| 14019 | continue; |
| 14020 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14021 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14022 | break; |
| 14023 | if (j >= spec->multiout.num_dacs) |
| 14024 | return srcs[i]; |
| 14025 | } |
| 14026 | return 0; |
| 14027 | } |
| 14028 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14029 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14030 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14031 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14032 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14033 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14034 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14035 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14036 | |
| 14037 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14038 | for (i = 0; i < cfg->line_outs; i++) { |
| 14039 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14040 | dac = alc861_look_for_dac(codec, nid); |
| 14041 | if (!dac) |
| 14042 | continue; |
| 14043 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14044 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14045 | return 0; |
| 14046 | } |
| 14047 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14048 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14049 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14050 | { |
| 14051 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14052 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14053 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14054 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14055 | } |
| 14056 | |
| 14057 | /* add playback controls from the parsed DAC table */ |
| 14058 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14059 | const struct auto_pin_cfg *cfg) |
| 14060 | { |
| 14061 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14062 | static const char *chname[4] = { |
| 14063 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14064 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14065 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14066 | int i, err; |
| 14067 | |
| 14068 | if (cfg->line_outs == 1) { |
| 14069 | const char *pfx = NULL; |
| 14070 | if (!cfg->hp_outs) |
| 14071 | pfx = "Master"; |
| 14072 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14073 | pfx = "Speaker"; |
| 14074 | if (pfx) { |
| 14075 | nid = spec->multiout.dac_nids[0]; |
| 14076 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14077 | } |
| 14078 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14079 | |
| 14080 | for (i = 0; i < cfg->line_outs; i++) { |
| 14081 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14082 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14083 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14084 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14085 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14086 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14087 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14088 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14089 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14090 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14091 | return err; |
| 14092 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14093 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
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 | } |
| 14097 | } |
| 14098 | return 0; |
| 14099 | } |
| 14100 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14101 | 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] | 14102 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14103 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14104 | int err; |
| 14105 | hda_nid_t nid; |
| 14106 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14107 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14108 | return 0; |
| 14109 | |
| 14110 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14111 | nid = alc861_look_for_dac(codec, pin); |
| 14112 | if (nid) { |
| 14113 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14114 | if (err < 0) |
| 14115 | return err; |
| 14116 | spec->multiout.hp_nid = nid; |
| 14117 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14118 | } |
| 14119 | return 0; |
| 14120 | } |
| 14121 | |
| 14122 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14123 | static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14124 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14125 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14126 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14127 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14128 | int i, err, idx, idx1; |
| 14129 | |
| 14130 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14131 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14132 | case 0x0c: |
| 14133 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14134 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14135 | break; |
| 14136 | case 0x0f: |
| 14137 | idx1 = 2; |
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 0x0d: |
| 14141 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14142 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14143 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14144 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14145 | idx1 = 3; |
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; |
| 14148 | case 0x11: |
| 14149 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14150 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14151 | break; |
| 14152 | default: |
| 14153 | continue; |
| 14154 | } |
| 14155 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14156 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14157 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14158 | if (err < 0) |
| 14159 | return err; |
| 14160 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14161 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14162 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14163 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14164 | } |
| 14165 | return 0; |
| 14166 | } |
| 14167 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14168 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14169 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14170 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14171 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14172 | hda_nid_t mix, srcs[5]; |
| 14173 | int i, num; |
| 14174 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14175 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14176 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14177 | 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] | 14178 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14179 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14180 | return; |
| 14181 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14182 | if (num < 0) |
| 14183 | return; |
| 14184 | for (i = 0; i < num; i++) { |
| 14185 | unsigned int mute; |
| 14186 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14187 | mute = AMP_IN_UNMUTE(i); |
| 14188 | else |
| 14189 | mute = AMP_IN_MUTE(i); |
| 14190 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14191 | mute); |
| 14192 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14193 | } |
| 14194 | |
| 14195 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14196 | { |
| 14197 | struct alc_spec *spec = codec->spec; |
| 14198 | int i; |
| 14199 | |
| 14200 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14201 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14202 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14203 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14204 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14205 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14206 | } |
| 14207 | } |
| 14208 | |
| 14209 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14210 | { |
| 14211 | struct alc_spec *spec = codec->spec; |
| 14212 | hda_nid_t pin; |
| 14213 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14214 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14215 | if (pin) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14216 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14217 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14218 | pin = spec->autocfg.speaker_pins[0]; |
| 14219 | if (pin) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14220 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 14221 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14222 | } |
| 14223 | |
| 14224 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14225 | { |
| 14226 | struct alc_spec *spec = codec->spec; |
| 14227 | int i; |
| 14228 | |
| 14229 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14230 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14231 | if (nid >= 0x0c && nid <= 0x11) |
| 14232 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14233 | } |
| 14234 | } |
| 14235 | |
| 14236 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14237 | /* return 1 if successful, 0 if the proper config is not found, |
| 14238 | * or a negative error code |
| 14239 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14240 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14241 | { |
| 14242 | struct alc_spec *spec = codec->spec; |
| 14243 | int err; |
| 14244 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14245 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14246 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14247 | alc861_ignore); |
| 14248 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14249 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14250 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14251 | return 0; /* can't find valid BIOS pin config */ |
| 14252 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14253 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14254 | if (err < 0) |
| 14255 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14256 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14257 | if (err < 0) |
| 14258 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14259 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14260 | if (err < 0) |
| 14261 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14262 | err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14263 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14264 | return err; |
| 14265 | |
| 14266 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14267 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14268 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14269 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14270 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14271 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14272 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14273 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14274 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14275 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14276 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14277 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14278 | |
| 14279 | spec->adc_nids = alc861_adc_nids; |
| 14280 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14281 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14282 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14283 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14284 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14285 | return 1; |
| 14286 | } |
| 14287 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14288 | /* additional initialization for auto-configuration model */ |
| 14289 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14290 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14291 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14292 | alc861_auto_init_multi_out(codec); |
| 14293 | alc861_auto_init_hp_out(codec); |
| 14294 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14295 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14296 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14297 | } |
| 14298 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14299 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14300 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14301 | { 0x15, HDA_INPUT, 0 }, |
| 14302 | { 0x15, HDA_INPUT, 1 }, |
| 14303 | { 0x15, HDA_INPUT, 2 }, |
| 14304 | { 0x15, HDA_INPUT, 3 }, |
| 14305 | { } /* end */ |
| 14306 | }; |
| 14307 | #endif |
| 14308 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14309 | |
| 14310 | /* |
| 14311 | * configuration and preset |
| 14312 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14313 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14314 | [ALC861_3ST] = "3stack", |
| 14315 | [ALC660_3ST] = "3stack-660", |
| 14316 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14317 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14318 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14319 | [ALC861_TOSHIBA] = "toshiba", |
| 14320 | [ALC861_ASUS] = "asus", |
| 14321 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14322 | [ALC861_AUTO] = "auto", |
| 14323 | }; |
| 14324 | |
| 14325 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14326 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14327 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14328 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14329 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14330 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14331 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14332 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14333 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14334 | * Any other models that need this preset? |
| 14335 | */ |
| 14336 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14337 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14338 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14339 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14340 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14341 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14342 | /* FIXME: the below seems conflict */ |
| 14343 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14344 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14345 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14346 | {} |
| 14347 | }; |
| 14348 | |
| 14349 | static struct alc_config_preset alc861_presets[] = { |
| 14350 | [ALC861_3ST] = { |
| 14351 | .mixers = { alc861_3ST_mixer }, |
| 14352 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14353 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14354 | .dac_nids = alc861_dac_nids, |
| 14355 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14356 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14357 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14358 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14359 | .adc_nids = alc861_adc_nids, |
| 14360 | .input_mux = &alc861_capture_source, |
| 14361 | }, |
| 14362 | [ALC861_3ST_DIG] = { |
| 14363 | .mixers = { alc861_base_mixer }, |
| 14364 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14365 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14366 | .dac_nids = alc861_dac_nids, |
| 14367 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14368 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14369 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14370 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14371 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14372 | .adc_nids = alc861_adc_nids, |
| 14373 | .input_mux = &alc861_capture_source, |
| 14374 | }, |
| 14375 | [ALC861_6ST_DIG] = { |
| 14376 | .mixers = { alc861_base_mixer }, |
| 14377 | .init_verbs = { alc861_base_init_verbs }, |
| 14378 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14379 | .dac_nids = alc861_dac_nids, |
| 14380 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14381 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14382 | .channel_mode = alc861_8ch_modes, |
| 14383 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14384 | .adc_nids = alc861_adc_nids, |
| 14385 | .input_mux = &alc861_capture_source, |
| 14386 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14387 | [ALC660_3ST] = { |
| 14388 | .mixers = { alc861_3ST_mixer }, |
| 14389 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14390 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14391 | .dac_nids = alc660_dac_nids, |
| 14392 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14393 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14394 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14395 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14396 | .adc_nids = alc861_adc_nids, |
| 14397 | .input_mux = &alc861_capture_source, |
| 14398 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14399 | [ALC861_UNIWILL_M31] = { |
| 14400 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14401 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14402 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14403 | .dac_nids = alc861_dac_nids, |
| 14404 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14405 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14406 | .channel_mode = alc861_uniwill_m31_modes, |
| 14407 | .need_dac_fix = 1, |
| 14408 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14409 | .adc_nids = alc861_adc_nids, |
| 14410 | .input_mux = &alc861_capture_source, |
| 14411 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14412 | [ALC861_TOSHIBA] = { |
| 14413 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14414 | .init_verbs = { alc861_base_init_verbs, |
| 14415 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14416 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14417 | .dac_nids = alc861_dac_nids, |
| 14418 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14419 | .channel_mode = alc883_3ST_2ch_modes, |
| 14420 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14421 | .adc_nids = alc861_adc_nids, |
| 14422 | .input_mux = &alc861_capture_source, |
| 14423 | .unsol_event = alc861_toshiba_unsol_event, |
| 14424 | .init_hook = alc861_toshiba_automute, |
| 14425 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14426 | [ALC861_ASUS] = { |
| 14427 | .mixers = { alc861_asus_mixer }, |
| 14428 | .init_verbs = { alc861_asus_init_verbs }, |
| 14429 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14430 | .dac_nids = alc861_dac_nids, |
| 14431 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14432 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14433 | .channel_mode = alc861_asus_modes, |
| 14434 | .need_dac_fix = 1, |
| 14435 | .hp_nid = 0x06, |
| 14436 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14437 | .adc_nids = alc861_adc_nids, |
| 14438 | .input_mux = &alc861_capture_source, |
| 14439 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14440 | [ALC861_ASUS_LAPTOP] = { |
| 14441 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14442 | .init_verbs = { alc861_asus_init_verbs, |
| 14443 | alc861_asus_laptop_init_verbs }, |
| 14444 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14445 | .dac_nids = alc861_dac_nids, |
| 14446 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14447 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14448 | .channel_mode = alc883_3ST_2ch_modes, |
| 14449 | .need_dac_fix = 1, |
| 14450 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14451 | .adc_nids = alc861_adc_nids, |
| 14452 | .input_mux = &alc861_capture_source, |
| 14453 | }, |
| 14454 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14455 | |
| 14456 | |
| 14457 | static int patch_alc861(struct hda_codec *codec) |
| 14458 | { |
| 14459 | struct alc_spec *spec; |
| 14460 | int board_config; |
| 14461 | int err; |
| 14462 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14463 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14464 | if (spec == NULL) |
| 14465 | return -ENOMEM; |
| 14466 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14467 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14468 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14469 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14470 | alc861_models, |
| 14471 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14472 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14473 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14474 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14475 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14476 | board_config = ALC861_AUTO; |
| 14477 | } |
| 14478 | |
| 14479 | if (board_config == ALC861_AUTO) { |
| 14480 | /* automatic parse from the BIOS config */ |
| 14481 | err = alc861_parse_auto_config(codec); |
| 14482 | if (err < 0) { |
| 14483 | alc_free(codec); |
| 14484 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14485 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14486 | printk(KERN_INFO |
| 14487 | "hda_codec: Cannot set up configuration " |
| 14488 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14489 | board_config = ALC861_3ST_DIG; |
| 14490 | } |
| 14491 | } |
| 14492 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14493 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14494 | if (err < 0) { |
| 14495 | alc_free(codec); |
| 14496 | return err; |
| 14497 | } |
| 14498 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14499 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14500 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14501 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14502 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14503 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14504 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14505 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14506 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14507 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14508 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14509 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14510 | spec->vmaster_nid = 0x03; |
| 14511 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14512 | codec->patch_ops = alc_patch_ops; |
| 14513 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14514 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14515 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14516 | if (!spec->loopback.amplist) |
| 14517 | spec->loopback.amplist = alc861_loopbacks; |
| 14518 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14519 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14520 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14521 | return 0; |
| 14522 | } |
| 14523 | |
| 14524 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14525 | * ALC861-VD support |
| 14526 | * |
| 14527 | * Based on ALC882 |
| 14528 | * |
| 14529 | * In addition, an independent DAC |
| 14530 | */ |
| 14531 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14532 | |
| 14533 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14534 | /* front, surr, clfe, side surr */ |
| 14535 | 0x02, 0x03, 0x04, 0x05 |
| 14536 | }; |
| 14537 | |
| 14538 | /* dac_nids for ALC660vd are in a different order - according to |
| 14539 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14540 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14541 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14542 | * - and it is the same as in 861vd. |
| 14543 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14544 | */ |
| 14545 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14546 | /* front, rear, clfe, rear_surr */ |
| 14547 | 0x02, 0x04, 0x03 |
| 14548 | }; |
| 14549 | |
| 14550 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14551 | /* ADC0 */ |
| 14552 | 0x09, |
| 14553 | }; |
| 14554 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14555 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14556 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14557 | /* input MUX */ |
| 14558 | /* FIXME: should be a matrix-type input source selection */ |
| 14559 | static struct hda_input_mux alc861vd_capture_source = { |
| 14560 | .num_items = 4, |
| 14561 | .items = { |
| 14562 | { "Mic", 0x0 }, |
| 14563 | { "Front Mic", 0x1 }, |
| 14564 | { "Line", 0x2 }, |
| 14565 | { "CD", 0x4 }, |
| 14566 | }, |
| 14567 | }; |
| 14568 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14569 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14570 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14571 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14572 | { "Ext Mic", 0x0 }, |
| 14573 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14574 | }, |
| 14575 | }; |
| 14576 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14577 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14578 | .num_items = 2, |
| 14579 | .items = { |
| 14580 | { "Front Mic", 0x0 }, |
| 14581 | { "ATAPI Mic", 0x1 }, |
| 14582 | }, |
| 14583 | }; |
| 14584 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14585 | /* |
| 14586 | * 2ch mode |
| 14587 | */ |
| 14588 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14589 | { 2, NULL } |
| 14590 | }; |
| 14591 | |
| 14592 | /* |
| 14593 | * 6ch mode |
| 14594 | */ |
| 14595 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14596 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14597 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14598 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14599 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14600 | { } /* end */ |
| 14601 | }; |
| 14602 | |
| 14603 | /* |
| 14604 | * 8ch mode |
| 14605 | */ |
| 14606 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14607 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14608 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14609 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14610 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14611 | { } /* end */ |
| 14612 | }; |
| 14613 | |
| 14614 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14615 | { 6, alc861vd_6stack_ch6_init }, |
| 14616 | { 8, alc861vd_6stack_ch8_init }, |
| 14617 | }; |
| 14618 | |
| 14619 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14620 | { |
| 14621 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14622 | .name = "Channel Mode", |
| 14623 | .info = alc_ch_mode_info, |
| 14624 | .get = alc_ch_mode_get, |
| 14625 | .put = alc_ch_mode_put, |
| 14626 | }, |
| 14627 | { } /* end */ |
| 14628 | }; |
| 14629 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14630 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14631 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14632 | */ |
| 14633 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14635 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14636 | |
| 14637 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14638 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14639 | |
| 14640 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14641 | HDA_OUTPUT), |
| 14642 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14643 | HDA_OUTPUT), |
| 14644 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14645 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14646 | |
| 14647 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14648 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14649 | |
| 14650 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14651 | |
| 14652 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14653 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14654 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14655 | |
| 14656 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14657 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14658 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14659 | |
| 14660 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14661 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14662 | |
| 14663 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14664 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14665 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14666 | { } /* end */ |
| 14667 | }; |
| 14668 | |
| 14669 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14670 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14671 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14672 | |
| 14673 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14674 | |
| 14675 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14676 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14677 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14678 | |
| 14679 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14680 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14681 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14682 | |
| 14683 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14684 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14685 | |
| 14686 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14687 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14688 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14689 | { } /* end */ |
| 14690 | }; |
| 14691 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14692 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14693 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14694 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14695 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14696 | |
| 14697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14698 | |
| 14699 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14700 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14701 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14702 | |
| 14703 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14704 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14705 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14706 | |
| 14707 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14708 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14709 | |
| 14710 | { } /* end */ |
| 14711 | }; |
| 14712 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14713 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14714 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14715 | */ |
| 14716 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14717 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14718 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14719 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14720 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14721 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14722 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14723 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14724 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14725 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14726 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14727 | { } /* end */ |
| 14728 | }; |
| 14729 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14730 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14731 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14732 | */ |
| 14733 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14734 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14735 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14736 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14737 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14738 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14739 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14740 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14741 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14742 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14743 | { } /* end */ |
| 14744 | }; |
| 14745 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14746 | /* |
| 14747 | * generic initialization of ADC, input mixers and output mixers |
| 14748 | */ |
| 14749 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14750 | /* |
| 14751 | * Unmute ADC0 and set the default input to mic-in |
| 14752 | */ |
| 14753 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14754 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14755 | |
| 14756 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14757 | * the analog-loopback mixer widget |
| 14758 | */ |
| 14759 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14762 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14763 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14765 | |
| 14766 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14767 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14768 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14771 | |
| 14772 | /* |
| 14773 | * Set up output mixers (0x02 - 0x05) |
| 14774 | */ |
| 14775 | /* set vol=0 to output mixers */ |
| 14776 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14777 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14778 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14779 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14780 | |
| 14781 | /* set up input amps for analog loopback */ |
| 14782 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14788 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14789 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14791 | |
| 14792 | { } |
| 14793 | }; |
| 14794 | |
| 14795 | /* |
| 14796 | * 3-stack pin configuration: |
| 14797 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14798 | */ |
| 14799 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14800 | /* |
| 14801 | * Set pin mode and muting |
| 14802 | */ |
| 14803 | /* set front pin widgets 0x14 for output */ |
| 14804 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14805 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14806 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14807 | |
| 14808 | /* Mic (rear) pin: input vref at 80% */ |
| 14809 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14810 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14811 | /* Front Mic pin: input vref at 80% */ |
| 14812 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14813 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14814 | /* Line In pin: input */ |
| 14815 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14816 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14817 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14818 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14819 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14820 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14821 | /* CD pin widget for input */ |
| 14822 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14823 | |
| 14824 | { } |
| 14825 | }; |
| 14826 | |
| 14827 | /* |
| 14828 | * 6-stack pin configuration: |
| 14829 | */ |
| 14830 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14831 | /* |
| 14832 | * Set pin mode and muting |
| 14833 | */ |
| 14834 | /* set front pin widgets 0x14 for output */ |
| 14835 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14836 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14837 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14838 | |
| 14839 | /* Rear Pin: output 1 (0x0d) */ |
| 14840 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14841 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14842 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14843 | /* CLFE Pin: output 2 (0x0e) */ |
| 14844 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14845 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14846 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14847 | /* Side Pin: output 3 (0x0f) */ |
| 14848 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14849 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14850 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14851 | |
| 14852 | /* Mic (rear) pin: input vref at 80% */ |
| 14853 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14854 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14855 | /* Front Mic pin: input vref at 80% */ |
| 14856 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14857 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14858 | /* Line In pin: input */ |
| 14859 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14860 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14861 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14862 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14863 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14864 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14865 | /* CD pin widget for input */ |
| 14866 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14867 | |
| 14868 | { } |
| 14869 | }; |
| 14870 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14871 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14872 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14873 | { } |
| 14874 | }; |
| 14875 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14876 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14877 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14878 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14879 | { } |
| 14880 | }; |
| 14881 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14882 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14883 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14886 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14887 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14888 | {} |
| 14889 | }; |
| 14890 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14891 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14892 | { |
| 14893 | unsigned int present; |
| 14894 | unsigned char bits; |
| 14895 | |
| 14896 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14897 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14898 | bits = present ? HDA_AMP_MUTE : 0; |
| 14899 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14900 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14901 | } |
| 14902 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14903 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14904 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14905 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14906 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14907 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14908 | } |
| 14909 | |
| 14910 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 14911 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14912 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14913 | alc861vd_lenovo_mic_automute(codec); |
| 14914 | } |
| 14915 | |
| 14916 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14917 | unsigned int res) |
| 14918 | { |
| 14919 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14920 | case ALC880_MIC_EVENT: |
| 14921 | alc861vd_lenovo_mic_automute(codec); |
| 14922 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14923 | default: |
| 14924 | alc_automute_amp_unsol_event(codec, res); |
| 14925 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14926 | } |
| 14927 | } |
| 14928 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14929 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14930 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14931 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14932 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14933 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14934 | |
| 14935 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14936 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14937 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14938 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14939 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14940 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14941 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14942 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14943 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14944 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14945 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14946 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14947 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14948 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14949 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14950 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14951 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14952 | |
| 14953 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14954 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14955 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14956 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14957 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14958 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14959 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14960 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14961 | |
| 14962 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14963 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14964 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14965 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14966 | |
| 14967 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14968 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14969 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14970 | |
| 14971 | { } /* end */ |
| 14972 | }; |
| 14973 | |
| 14974 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14975 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14976 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14977 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14978 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14979 | spec->autocfg.hp_pins[0] = 0x15; |
| 14980 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14981 | } |
| 14982 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14983 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14984 | #define alc861vd_loopbacks alc880_loopbacks |
| 14985 | #endif |
| 14986 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14987 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14988 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14989 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14990 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14991 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14992 | |
| 14993 | /* |
| 14994 | * configuration and preset |
| 14995 | */ |
| 14996 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14997 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14998 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14999 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15000 | [ALC861VD_3ST] = "3stack", |
| 15001 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15002 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15003 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15004 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15005 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15006 | [ALC861VD_AUTO] = "auto", |
| 15007 | }; |
| 15008 | |
| 15009 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15010 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15011 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15012 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15013 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15014 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15015 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15016 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15017 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15018 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15019 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15020 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15021 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15022 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15023 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15024 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15025 | {} |
| 15026 | }; |
| 15027 | |
| 15028 | static struct alc_config_preset alc861vd_presets[] = { |
| 15029 | [ALC660VD_3ST] = { |
| 15030 | .mixers = { alc861vd_3st_mixer }, |
| 15031 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15032 | alc861vd_3stack_init_verbs }, |
| 15033 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15034 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15035 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15036 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15037 | .input_mux = &alc861vd_capture_source, |
| 15038 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15039 | [ALC660VD_3ST_DIG] = { |
| 15040 | .mixers = { alc861vd_3st_mixer }, |
| 15041 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15042 | alc861vd_3stack_init_verbs }, |
| 15043 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15044 | .dac_nids = alc660vd_dac_nids, |
| 15045 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15046 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15047 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15048 | .input_mux = &alc861vd_capture_source, |
| 15049 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15050 | [ALC861VD_3ST] = { |
| 15051 | .mixers = { alc861vd_3st_mixer }, |
| 15052 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15053 | alc861vd_3stack_init_verbs }, |
| 15054 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15055 | .dac_nids = alc861vd_dac_nids, |
| 15056 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15057 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15058 | .input_mux = &alc861vd_capture_source, |
| 15059 | }, |
| 15060 | [ALC861VD_3ST_DIG] = { |
| 15061 | .mixers = { alc861vd_3st_mixer }, |
| 15062 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15063 | alc861vd_3stack_init_verbs }, |
| 15064 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15065 | .dac_nids = alc861vd_dac_nids, |
| 15066 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15067 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15068 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15069 | .input_mux = &alc861vd_capture_source, |
| 15070 | }, |
| 15071 | [ALC861VD_6ST_DIG] = { |
| 15072 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15073 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15074 | alc861vd_6stack_init_verbs }, |
| 15075 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15076 | .dac_nids = alc861vd_dac_nids, |
| 15077 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15078 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15079 | .channel_mode = alc861vd_6stack_modes, |
| 15080 | .input_mux = &alc861vd_capture_source, |
| 15081 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15082 | [ALC861VD_LENOVO] = { |
| 15083 | .mixers = { alc861vd_lenovo_mixer }, |
| 15084 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15085 | alc861vd_3stack_init_verbs, |
| 15086 | alc861vd_eapd_verbs, |
| 15087 | alc861vd_lenovo_unsol_verbs }, |
| 15088 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15089 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15090 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15091 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15092 | .input_mux = &alc861vd_capture_source, |
| 15093 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15094 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15095 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15096 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15097 | [ALC861VD_DALLAS] = { |
| 15098 | .mixers = { alc861vd_dallas_mixer }, |
| 15099 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15100 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15101 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15102 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15103 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15104 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15105 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15106 | .setup = alc861vd_dallas_setup, |
| 15107 | .init_hook = alc_automute_amp, |
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, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15119 | .setup = alc861vd_dallas_setup, |
| 15120 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15121 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15122 | [ALC660VD_ASUS_V1S] = { |
| 15123 | .mixers = { alc861vd_lenovo_mixer }, |
| 15124 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15125 | alc861vd_3stack_init_verbs, |
| 15126 | alc861vd_eapd_verbs, |
| 15127 | alc861vd_lenovo_unsol_verbs }, |
| 15128 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15129 | .dac_nids = alc660vd_dac_nids, |
| 15130 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15131 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15132 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15133 | .input_mux = &alc861vd_capture_source, |
| 15134 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15135 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15136 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15137 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15138 | }; |
| 15139 | |
| 15140 | /* |
| 15141 | * BIOS auto configuration |
| 15142 | */ |
| 15143 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15144 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15145 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15146 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15147 | } |
| 15148 | |
| 15149 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15150 | { |
| 15151 | struct alc_spec *spec = codec->spec; |
| 15152 | int i; |
| 15153 | |
| 15154 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15155 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15156 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15157 | if (nid) |
| 15158 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15159 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15160 | } |
| 15161 | } |
| 15162 | |
| 15163 | |
| 15164 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15165 | { |
| 15166 | struct alc_spec *spec = codec->spec; |
| 15167 | hda_nid_t pin; |
| 15168 | |
| 15169 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15170 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15171 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15172 | pin = spec->autocfg.speaker_pins[0]; |
| 15173 | if (pin) |
| 15174 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15175 | } |
| 15176 | |
| 15177 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15178 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15179 | |
| 15180 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15181 | { |
| 15182 | struct alc_spec *spec = codec->spec; |
| 15183 | int i; |
| 15184 | |
| 15185 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15186 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15187 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15188 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15189 | if (nid != ALC861VD_PIN_CD_NID && |
| 15190 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15191 | snd_hda_codec_write(codec, nid, 0, |
| 15192 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15193 | AMP_OUT_MUTE); |
| 15194 | } |
| 15195 | } |
| 15196 | } |
| 15197 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15198 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15199 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15200 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15201 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15202 | |
| 15203 | /* add playback controls from the parsed DAC table */ |
| 15204 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15205 | * different NIDs for mute/unmute switch and volume control */ |
| 15206 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15207 | const struct auto_pin_cfg *cfg) |
| 15208 | { |
| 15209 | char name[32]; |
| 15210 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15211 | hda_nid_t nid_v, nid_s; |
| 15212 | int i, err; |
| 15213 | |
| 15214 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15215 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15216 | continue; |
| 15217 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15218 | alc880_dac_to_idx( |
| 15219 | spec->multiout.dac_nids[i])); |
| 15220 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15221 | alc880_dac_to_idx( |
| 15222 | spec->multiout.dac_nids[i])); |
| 15223 | |
| 15224 | if (i == 2) { |
| 15225 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15226 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15227 | "Center Playback Volume", |
| 15228 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15229 | HDA_OUTPUT)); |
| 15230 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15231 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15232 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15233 | "LFE Playback Volume", |
| 15234 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15235 | HDA_OUTPUT)); |
| 15236 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15237 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15238 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15239 | "Center Playback Switch", |
| 15240 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15241 | HDA_INPUT)); |
| 15242 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15243 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15244 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15245 | "LFE Playback Switch", |
| 15246 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15247 | HDA_INPUT)); |
| 15248 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15249 | return err; |
| 15250 | } else { |
| 15251 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15252 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15253 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15254 | HDA_OUTPUT)); |
| 15255 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15256 | return err; |
| 15257 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15258 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15259 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15260 | HDA_INPUT)); |
| 15261 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15262 | return err; |
| 15263 | } |
| 15264 | } |
| 15265 | return 0; |
| 15266 | } |
| 15267 | |
| 15268 | /* add playback controls for speaker and HP outputs */ |
| 15269 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15270 | * different NIDs for mute/unmute switch and volume control */ |
| 15271 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15272 | hda_nid_t pin, const char *pfx) |
| 15273 | { |
| 15274 | hda_nid_t nid_v, nid_s; |
| 15275 | int err; |
| 15276 | char name[32]; |
| 15277 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15278 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15279 | return 0; |
| 15280 | |
| 15281 | if (alc880_is_fixed_pin(pin)) { |
| 15282 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15283 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15284 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15285 | spec->multiout.hp_nid = nid_v; |
| 15286 | else |
| 15287 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15288 | /* control HP volume/switch on the output mixer amp */ |
| 15289 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15290 | alc880_fixed_pin_idx(pin)); |
| 15291 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15292 | alc880_fixed_pin_idx(pin)); |
| 15293 | |
| 15294 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15295 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15296 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15297 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15298 | return err; |
| 15299 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15300 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15301 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15302 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15303 | return err; |
| 15304 | } else if (alc880_is_multi_pin(pin)) { |
| 15305 | /* set manual connection */ |
| 15306 | /* we have only a switch on HP-out PIN */ |
| 15307 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15308 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15309 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15310 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15311 | return err; |
| 15312 | } |
| 15313 | return 0; |
| 15314 | } |
| 15315 | |
| 15316 | /* parse the BIOS configuration and set up the alc_spec |
| 15317 | * return 1 if successful, 0 if the proper config is not found, |
| 15318 | * or a negative error code |
| 15319 | * Based on ALC880 version - had to change it to override |
| 15320 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15321 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15322 | { |
| 15323 | struct alc_spec *spec = codec->spec; |
| 15324 | int err; |
| 15325 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15326 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15327 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15328 | alc861vd_ignore); |
| 15329 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15330 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15331 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15332 | return 0; /* can't find valid BIOS pin config */ |
| 15333 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15334 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15335 | if (err < 0) |
| 15336 | return err; |
| 15337 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15338 | if (err < 0) |
| 15339 | return err; |
| 15340 | err = alc861vd_auto_create_extra_out(spec, |
| 15341 | spec->autocfg.speaker_pins[0], |
| 15342 | "Speaker"); |
| 15343 | if (err < 0) |
| 15344 | return err; |
| 15345 | err = alc861vd_auto_create_extra_out(spec, |
| 15346 | spec->autocfg.hp_pins[0], |
| 15347 | "Headphone"); |
| 15348 | if (err < 0) |
| 15349 | return err; |
| 15350 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15351 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15352 | return err; |
| 15353 | |
| 15354 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15355 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15356 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15357 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15358 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15359 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15360 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15361 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15362 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15363 | |
| 15364 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15365 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15366 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15367 | err = alc_auto_add_mic_boost(codec); |
| 15368 | if (err < 0) |
| 15369 | return err; |
| 15370 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15371 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15372 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15373 | return 1; |
| 15374 | } |
| 15375 | |
| 15376 | /* additional initialization for auto-configuration model */ |
| 15377 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15378 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15379 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15380 | alc861vd_auto_init_multi_out(codec); |
| 15381 | alc861vd_auto_init_hp_out(codec); |
| 15382 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15383 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15384 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15385 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15386 | } |
| 15387 | |
| 15388 | static int patch_alc861vd(struct hda_codec *codec) |
| 15389 | { |
| 15390 | struct alc_spec *spec; |
| 15391 | int err, board_config; |
| 15392 | |
| 15393 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15394 | if (spec == NULL) |
| 15395 | return -ENOMEM; |
| 15396 | |
| 15397 | codec->spec = spec; |
| 15398 | |
| 15399 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15400 | alc861vd_models, |
| 15401 | alc861vd_cfg_tbl); |
| 15402 | |
| 15403 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15404 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15405 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15406 | board_config = ALC861VD_AUTO; |
| 15407 | } |
| 15408 | |
| 15409 | if (board_config == ALC861VD_AUTO) { |
| 15410 | /* automatic parse from the BIOS config */ |
| 15411 | err = alc861vd_parse_auto_config(codec); |
| 15412 | if (err < 0) { |
| 15413 | alc_free(codec); |
| 15414 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15415 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15416 | printk(KERN_INFO |
| 15417 | "hda_codec: Cannot set up configuration " |
| 15418 | "from BIOS. Using base mode...\n"); |
| 15419 | board_config = ALC861VD_3ST; |
| 15420 | } |
| 15421 | } |
| 15422 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15423 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15424 | if (err < 0) { |
| 15425 | alc_free(codec); |
| 15426 | return err; |
| 15427 | } |
| 15428 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15429 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15430 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15431 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15432 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15433 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15434 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15435 | } |
| 15436 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15437 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15438 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15439 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15440 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15441 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15442 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15443 | if (!spec->adc_nids) { |
| 15444 | spec->adc_nids = alc861vd_adc_nids; |
| 15445 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15446 | } |
| 15447 | if (!spec->capsrc_nids) |
| 15448 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15449 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15450 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15451 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15452 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15453 | spec->vmaster_nid = 0x02; |
| 15454 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15455 | codec->patch_ops = alc_patch_ops; |
| 15456 | |
| 15457 | if (board_config == ALC861VD_AUTO) |
| 15458 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15459 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15460 | if (!spec->loopback.amplist) |
| 15461 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15462 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15463 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15464 | |
| 15465 | return 0; |
| 15466 | } |
| 15467 | |
| 15468 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15469 | * ALC662 support |
| 15470 | * |
| 15471 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15472 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15473 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15474 | * 6-channel independent captures. |
| 15475 | * |
| 15476 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15477 | * driver yet). |
| 15478 | */ |
| 15479 | #define ALC662_DIGOUT_NID 0x06 |
| 15480 | #define ALC662_DIGIN_NID 0x0a |
| 15481 | |
| 15482 | static hda_nid_t alc662_dac_nids[4] = { |
| 15483 | /* front, rear, clfe, rear_surr */ |
| 15484 | 0x02, 0x03, 0x04 |
| 15485 | }; |
| 15486 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15487 | static hda_nid_t alc272_dac_nids[2] = { |
| 15488 | 0x02, 0x03 |
| 15489 | }; |
| 15490 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15491 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15492 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15493 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15494 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15495 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15496 | static hda_nid_t alc272_adc_nids[1] = { |
| 15497 | /* ADC1-2 */ |
| 15498 | 0x08, |
| 15499 | }; |
| 15500 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15501 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15502 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15503 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15504 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15505 | /* input MUX */ |
| 15506 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15507 | static struct hda_input_mux alc662_capture_source = { |
| 15508 | .num_items = 4, |
| 15509 | .items = { |
| 15510 | { "Mic", 0x0 }, |
| 15511 | { "Front Mic", 0x1 }, |
| 15512 | { "Line", 0x2 }, |
| 15513 | { "CD", 0x4 }, |
| 15514 | }, |
| 15515 | }; |
| 15516 | |
| 15517 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15518 | .num_items = 2, |
| 15519 | .items = { |
| 15520 | { "Mic", 0x1 }, |
| 15521 | { "Line", 0x2 }, |
| 15522 | }, |
| 15523 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15524 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15525 | static struct hda_input_mux alc663_capture_source = { |
| 15526 | .num_items = 3, |
| 15527 | .items = { |
| 15528 | { "Mic", 0x0 }, |
| 15529 | { "Front Mic", 0x1 }, |
| 15530 | { "Line", 0x2 }, |
| 15531 | }, |
| 15532 | }; |
| 15533 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15534 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15535 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15536 | .num_items = 16, |
| 15537 | .items = { |
| 15538 | { "Autoselect Mic", 0x0 }, |
| 15539 | { "Internal Mic", 0x1 }, |
| 15540 | { "In-0x02", 0x2 }, |
| 15541 | { "In-0x03", 0x3 }, |
| 15542 | { "In-0x04", 0x4 }, |
| 15543 | { "In-0x05", 0x5 }, |
| 15544 | { "In-0x06", 0x6 }, |
| 15545 | { "In-0x07", 0x7 }, |
| 15546 | { "In-0x08", 0x8 }, |
| 15547 | { "In-0x09", 0x9 }, |
| 15548 | { "In-0x0a", 0x0a }, |
| 15549 | { "In-0x0b", 0x0b }, |
| 15550 | { "In-0x0c", 0x0c }, |
| 15551 | { "In-0x0d", 0x0d }, |
| 15552 | { "In-0x0e", 0x0e }, |
| 15553 | { "In-0x0f", 0x0f }, |
| 15554 | }, |
| 15555 | }; |
| 15556 | #endif |
| 15557 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15558 | /* |
| 15559 | * 2ch mode |
| 15560 | */ |
| 15561 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15562 | { 2, NULL } |
| 15563 | }; |
| 15564 | |
| 15565 | /* |
| 15566 | * 2ch mode |
| 15567 | */ |
| 15568 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15569 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15570 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15571 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15572 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15573 | { } /* end */ |
| 15574 | }; |
| 15575 | |
| 15576 | /* |
| 15577 | * 6ch mode |
| 15578 | */ |
| 15579 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15580 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15581 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15582 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15583 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15584 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15585 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15586 | { } /* end */ |
| 15587 | }; |
| 15588 | |
| 15589 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15590 | { 2, alc662_3ST_ch2_init }, |
| 15591 | { 6, alc662_3ST_ch6_init }, |
| 15592 | }; |
| 15593 | |
| 15594 | /* |
| 15595 | * 2ch mode |
| 15596 | */ |
| 15597 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15598 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15599 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15600 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15601 | { } /* end */ |
| 15602 | }; |
| 15603 | |
| 15604 | /* |
| 15605 | * 6ch mode |
| 15606 | */ |
| 15607 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15608 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15609 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15610 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15611 | { } /* end */ |
| 15612 | }; |
| 15613 | |
| 15614 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15615 | { 2, alc662_sixstack_ch6_init }, |
| 15616 | { 6, alc662_sixstack_ch8_init }, |
| 15617 | }; |
| 15618 | |
| 15619 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15620 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15621 | */ |
| 15622 | |
| 15623 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15624 | /* output mixer control */ |
| 15625 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15626 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15627 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15628 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15629 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15630 | 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] | 15631 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15632 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15634 | |
| 15635 | /*Input mixer control */ |
| 15636 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15637 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15638 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15639 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15641 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15644 | { } /* end */ |
| 15645 | }; |
| 15646 | |
| 15647 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15649 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15650 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15651 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15652 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15653 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15654 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15655 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15656 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15657 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15658 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15659 | { } /* end */ |
| 15660 | }; |
| 15661 | |
| 15662 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15663 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15664 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15665 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15666 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15667 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15668 | 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] | 15669 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15670 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15671 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15672 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15673 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15674 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15675 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15676 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15677 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15678 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15679 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15680 | { } /* end */ |
| 15681 | }; |
| 15682 | |
| 15683 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15685 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15686 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15687 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15693 | { } /* end */ |
| 15694 | }; |
| 15695 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15696 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15697 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15698 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15699 | |
| 15700 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15701 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15702 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15703 | |
| 15704 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15705 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15706 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15707 | { } /* end */ |
| 15708 | }; |
| 15709 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15710 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15711 | ALC262_HIPPO_MASTER_SWITCH, |
| 15712 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15713 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15714 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15715 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15716 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15717 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15718 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15719 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15721 | { } /* end */ |
| 15722 | }; |
| 15723 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15724 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15725 | .ops = &snd_hda_bind_vol, |
| 15726 | .values = { |
| 15727 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15728 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15729 | 0 |
| 15730 | }, |
| 15731 | }; |
| 15732 | |
| 15733 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15734 | .ops = &snd_hda_bind_sw, |
| 15735 | .values = { |
| 15736 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15737 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15738 | 0 |
| 15739 | }, |
| 15740 | }; |
| 15741 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15742 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15743 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15744 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15745 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15746 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15747 | { } /* end */ |
| 15748 | }; |
| 15749 | |
| 15750 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15751 | .ops = &snd_hda_bind_sw, |
| 15752 | .values = { |
| 15753 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15754 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15755 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15756 | 0 |
| 15757 | }, |
| 15758 | }; |
| 15759 | |
| 15760 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15761 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15762 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15763 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15764 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15765 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15766 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15767 | |
| 15768 | { } /* end */ |
| 15769 | }; |
| 15770 | |
| 15771 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15772 | .ops = &snd_hda_bind_sw, |
| 15773 | .values = { |
| 15774 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15775 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15776 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15777 | 0 |
| 15778 | }, |
| 15779 | }; |
| 15780 | |
| 15781 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15782 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15783 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15784 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15785 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15786 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15787 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15788 | { } /* end */ |
| 15789 | }; |
| 15790 | |
| 15791 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15792 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15793 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15794 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15795 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15797 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15798 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15799 | { } /* end */ |
| 15800 | }; |
| 15801 | |
| 15802 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15803 | .ops = &snd_hda_bind_vol, |
| 15804 | .values = { |
| 15805 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15806 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15807 | 0 |
| 15808 | }, |
| 15809 | }; |
| 15810 | |
| 15811 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15812 | .ops = &snd_hda_bind_sw, |
| 15813 | .values = { |
| 15814 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15815 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15816 | 0 |
| 15817 | }, |
| 15818 | }; |
| 15819 | |
| 15820 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15821 | HDA_BIND_VOL("Master Playback Volume", |
| 15822 | &alc663_asus_two_bind_master_vol), |
| 15823 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15824 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15825 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15826 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15828 | { } /* end */ |
| 15829 | }; |
| 15830 | |
| 15831 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15832 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15833 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15834 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15835 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15836 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15837 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15838 | { } /* end */ |
| 15839 | }; |
| 15840 | |
| 15841 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15842 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15843 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15844 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15845 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15846 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15847 | |
| 15848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15849 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15850 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15851 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15852 | { } /* end */ |
| 15853 | }; |
| 15854 | |
| 15855 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15856 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15857 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15858 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15859 | |
| 15860 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15861 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15862 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15863 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15864 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15865 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15866 | { } /* end */ |
| 15867 | }; |
| 15868 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15869 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15870 | { |
| 15871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15872 | .name = "Channel Mode", |
| 15873 | .info = alc_ch_mode_info, |
| 15874 | .get = alc_ch_mode_get, |
| 15875 | .put = alc_ch_mode_put, |
| 15876 | }, |
| 15877 | { } /* end */ |
| 15878 | }; |
| 15879 | |
| 15880 | static struct hda_verb alc662_init_verbs[] = { |
| 15881 | /* ADC: mute amp left and right */ |
| 15882 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15883 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15884 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15885 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15886 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15887 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15888 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15889 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15890 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15891 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15893 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15894 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15896 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15897 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15898 | |
| 15899 | /* Front Pin: output 0 (0x0c) */ |
| 15900 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15901 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15902 | |
| 15903 | /* Rear Pin: output 1 (0x0d) */ |
| 15904 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15906 | |
| 15907 | /* CLFE Pin: output 2 (0x0e) */ |
| 15908 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15909 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15910 | |
| 15911 | /* Mic (rear) pin: input vref at 80% */ |
| 15912 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15913 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15914 | /* Front Mic pin: input vref at 80% */ |
| 15915 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15916 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15917 | /* Line In pin: input */ |
| 15918 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15919 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15920 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15921 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15922 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15923 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15924 | /* CD pin widget for input */ |
| 15925 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15926 | |
| 15927 | /* FIXME: use matrix-type input source selection */ |
| 15928 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15929 | /* Input mixer */ |
| 15930 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15931 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15932 | |
| 15933 | /* always trun on EAPD */ |
| 15934 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15935 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15936 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15937 | { } |
| 15938 | }; |
| 15939 | |
| 15940 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15941 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15942 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15943 | {} |
| 15944 | }; |
| 15945 | |
| 15946 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15947 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15948 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15949 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15950 | }; |
| 15951 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15952 | /* Set Unsolicited Event*/ |
| 15953 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15954 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15955 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15956 | {} |
| 15957 | }; |
| 15958 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15959 | /* |
| 15960 | * generic initialization of ADC, input mixers and output mixers |
| 15961 | */ |
| 15962 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15963 | /* |
| 15964 | * Unmute ADC and set the default input to mic-in |
| 15965 | */ |
| 15966 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15967 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15968 | |
| 15969 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15970 | * mixer widget |
| 15971 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15972 | * panel mic (mic 2) |
| 15973 | */ |
| 15974 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15976 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15977 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15978 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15979 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15980 | |
| 15981 | /* |
| 15982 | * Set up output mixers (0x0c - 0x0f) |
| 15983 | */ |
| 15984 | /* set vol=0 to output mixers */ |
| 15985 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15986 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15987 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15988 | |
| 15989 | /* set up input amps for analog loopback */ |
| 15990 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15992 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15993 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15994 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15995 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15996 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15997 | |
| 15998 | |
| 15999 | /* FIXME: use matrix-type input source selection */ |
| 16000 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16001 | /* Input mixer */ |
| 16002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16003 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16004 | { } |
| 16005 | }; |
| 16006 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16007 | /* additional verbs for ALC663 */ |
| 16008 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16009 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16010 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16011 | { } |
| 16012 | }; |
| 16013 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16014 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16015 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16016 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16017 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16018 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16019 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16020 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16021 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16022 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16023 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16024 | {} |
| 16025 | }; |
| 16026 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16027 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16028 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16029 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16030 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16031 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16032 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16033 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16034 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16035 | {} |
| 16036 | }; |
| 16037 | |
| 16038 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16039 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16040 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16041 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16042 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16044 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16045 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16046 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16047 | {} |
| 16048 | }; |
| 16049 | |
| 16050 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16051 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16052 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16053 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16054 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16055 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16056 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16057 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16058 | {} |
| 16059 | }; |
| 16060 | |
| 16061 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16062 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16063 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16064 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16065 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16066 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16068 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16071 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16072 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16073 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16074 | {} |
| 16075 | }; |
| 16076 | |
| 16077 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16078 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16079 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16080 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16081 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16082 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16083 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16084 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16087 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16088 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16089 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16090 | {} |
| 16091 | }; |
| 16092 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16093 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16094 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16095 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16096 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16097 | |
| 16098 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16099 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16100 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16101 | |
| 16102 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16103 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16104 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16105 | {} |
| 16106 | }; |
| 16107 | |
| 16108 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16109 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16110 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16111 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16112 | |
| 16113 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16114 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16115 | {} |
| 16116 | }; |
| 16117 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16118 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16119 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16120 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16121 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16122 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16123 | {} |
| 16124 | }; |
| 16125 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16126 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16127 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16128 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16129 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16130 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16131 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16132 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16133 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16134 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16135 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16136 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16137 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16138 | {} |
| 16139 | }; |
| 16140 | |
| 16141 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16142 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16143 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16144 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16145 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16146 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16147 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16148 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16149 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16151 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16152 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16153 | {} |
| 16154 | }; |
| 16155 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16156 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16157 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16158 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16159 | { } /* end */ |
| 16160 | }; |
| 16161 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16162 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16163 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16164 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16165 | { } /* end */ |
| 16166 | }; |
| 16167 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16168 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16169 | { |
| 16170 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16171 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16172 | |
| 16173 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16174 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16175 | bits = present ? HDA_AMP_MUTE : 0; |
| 16176 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16177 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16178 | } |
| 16179 | |
| 16180 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16181 | { |
| 16182 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16183 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16184 | |
| 16185 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16186 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16187 | bits = present ? HDA_AMP_MUTE : 0; |
| 16188 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16189 | HDA_AMP_MUTE, bits); |
| 16190 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16191 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16192 | } |
| 16193 | |
| 16194 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16195 | unsigned int res) |
| 16196 | { |
| 16197 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16198 | alc662_lenovo_101e_all_automute(codec); |
| 16199 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16200 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16201 | } |
| 16202 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16203 | /* unsolicited event for HP jack sensing */ |
| 16204 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16205 | unsigned int res) |
| 16206 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16207 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16208 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16209 | else |
| 16210 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16211 | } |
| 16212 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16213 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16214 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16215 | struct alc_spec *spec = codec->spec; |
| 16216 | |
| 16217 | alc262_hippo1_setup(codec); |
| 16218 | spec->ext_mic.pin = 0x18; |
| 16219 | spec->ext_mic.mux_idx = 0; |
| 16220 | spec->int_mic.pin = 0x19; |
| 16221 | spec->int_mic.mux_idx = 1; |
| 16222 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16223 | } |
| 16224 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16225 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16226 | { |
| 16227 | alc262_hippo_automute(codec); |
| 16228 | alc_mic_automute(codec); |
| 16229 | } |
| 16230 | |
| 16231 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16232 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16233 | struct alc_spec *spec = codec->spec; |
| 16234 | |
| 16235 | spec->autocfg.hp_pins[0] = 0x14; |
| 16236 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16237 | } |
| 16238 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16239 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 16240 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16241 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16242 | { |
| 16243 | unsigned int present; |
| 16244 | unsigned char bits; |
| 16245 | |
| 16246 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16247 | AC_VERB_GET_PIN_SENSE, 0) |
| 16248 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16249 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16250 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16251 | AMP_IN_MUTE(0), bits); |
| 16252 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16253 | AMP_IN_MUTE(0), bits); |
| 16254 | } |
| 16255 | |
| 16256 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16257 | { |
| 16258 | unsigned int present; |
| 16259 | unsigned char bits; |
| 16260 | |
| 16261 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16262 | AC_VERB_GET_PIN_SENSE, 0) |
| 16263 | & AC_PINSENSE_PRESENCE; |
| 16264 | bits = present ? HDA_AMP_MUTE : 0; |
| 16265 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16266 | AMP_IN_MUTE(0), bits); |
| 16267 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16268 | AMP_IN_MUTE(0), bits); |
| 16269 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16270 | AMP_IN_MUTE(0), bits); |
| 16271 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16272 | AMP_IN_MUTE(0), bits); |
| 16273 | } |
| 16274 | |
| 16275 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16276 | { |
| 16277 | unsigned int present; |
| 16278 | unsigned char bits; |
| 16279 | |
| 16280 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16281 | AC_VERB_GET_PIN_SENSE, 0) |
| 16282 | & AC_PINSENSE_PRESENCE; |
| 16283 | bits = present ? HDA_AMP_MUTE : 0; |
| 16284 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16285 | AMP_IN_MUTE(0), bits); |
| 16286 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16287 | AMP_IN_MUTE(0), bits); |
| 16288 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16289 | AMP_IN_MUTE(0), bits); |
| 16290 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16291 | AMP_IN_MUTE(0), bits); |
| 16292 | } |
| 16293 | |
| 16294 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16295 | { |
| 16296 | unsigned int present; |
| 16297 | unsigned char bits; |
| 16298 | |
| 16299 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16300 | AC_VERB_GET_PIN_SENSE, 0) |
| 16301 | & AC_PINSENSE_PRESENCE; |
| 16302 | bits = present ? 0 : PIN_OUT; |
| 16303 | snd_hda_codec_write(codec, 0x14, 0, |
| 16304 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16305 | } |
| 16306 | |
| 16307 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16308 | { |
| 16309 | unsigned int present1, present2; |
| 16310 | |
| 16311 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16312 | AC_VERB_GET_PIN_SENSE, 0) |
| 16313 | & AC_PINSENSE_PRESENCE; |
| 16314 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16315 | AC_VERB_GET_PIN_SENSE, 0) |
| 16316 | & AC_PINSENSE_PRESENCE; |
| 16317 | |
| 16318 | if (present1 || present2) { |
| 16319 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16320 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16321 | } else { |
| 16322 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16323 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16324 | } |
| 16325 | } |
| 16326 | |
| 16327 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16328 | { |
| 16329 | unsigned int present1, present2; |
| 16330 | |
| 16331 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16332 | AC_VERB_GET_PIN_SENSE, 0) |
| 16333 | & AC_PINSENSE_PRESENCE; |
| 16334 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16335 | AC_VERB_GET_PIN_SENSE, 0) |
| 16336 | & AC_PINSENSE_PRESENCE; |
| 16337 | |
| 16338 | if (present1 || present2) { |
| 16339 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16340 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16341 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16342 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16343 | } else { |
| 16344 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16345 | AMP_IN_MUTE(0), 0); |
| 16346 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16347 | AMP_IN_MUTE(0), 0); |
| 16348 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16349 | } |
| 16350 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16351 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16352 | unsigned int res) |
| 16353 | { |
| 16354 | switch (res >> 26) { |
| 16355 | case ALC880_HP_EVENT: |
| 16356 | alc663_m51va_speaker_automute(codec); |
| 16357 | break; |
| 16358 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16359 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16360 | break; |
| 16361 | } |
| 16362 | } |
| 16363 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16364 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 16365 | { |
| 16366 | struct alc_spec *spec = codec->spec; |
| 16367 | spec->ext_mic.pin = 0x18; |
| 16368 | spec->ext_mic.mux_idx = 0; |
| 16369 | spec->int_mic.pin = 0x12; |
| 16370 | spec->int_mic.mux_idx = 1; |
| 16371 | spec->auto_mic = 1; |
| 16372 | } |
| 16373 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16374 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16375 | { |
| 16376 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16377 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16378 | } |
| 16379 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16380 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16381 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
| 16382 | #define alc663_mode1_setup alc663_m51va_setup |
| 16383 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16384 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16385 | /* ***************** Mode2 ******************************/ |
| 16386 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16387 | unsigned int res) |
| 16388 | { |
| 16389 | switch (res >> 26) { |
| 16390 | case ALC880_HP_EVENT: |
| 16391 | alc662_f5z_speaker_automute(codec); |
| 16392 | break; |
| 16393 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16394 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16395 | break; |
| 16396 | } |
| 16397 | } |
| 16398 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16399 | #define alc662_mode2_setup alc663_m51va_setup |
| 16400 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16401 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16402 | { |
| 16403 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16404 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16405 | } |
| 16406 | /* ***************** Mode3 ******************************/ |
| 16407 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16408 | unsigned int res) |
| 16409 | { |
| 16410 | switch (res >> 26) { |
| 16411 | case ALC880_HP_EVENT: |
| 16412 | alc663_two_hp_m1_speaker_automute(codec); |
| 16413 | break; |
| 16414 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16415 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16416 | break; |
| 16417 | } |
| 16418 | } |
| 16419 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16420 | #define alc663_mode3_setup alc663_m51va_setup |
| 16421 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16422 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16423 | { |
| 16424 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16425 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16426 | } |
| 16427 | /* ***************** Mode4 ******************************/ |
| 16428 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16429 | unsigned int res) |
| 16430 | { |
| 16431 | switch (res >> 26) { |
| 16432 | case ALC880_HP_EVENT: |
| 16433 | alc663_21jd_two_speaker_automute(codec); |
| 16434 | break; |
| 16435 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16436 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16437 | break; |
| 16438 | } |
| 16439 | } |
| 16440 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16441 | #define alc663_mode4_setup alc663_m51va_setup |
| 16442 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16443 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16444 | { |
| 16445 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16446 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16447 | } |
| 16448 | /* ***************** Mode5 ******************************/ |
| 16449 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16450 | unsigned int res) |
| 16451 | { |
| 16452 | switch (res >> 26) { |
| 16453 | case ALC880_HP_EVENT: |
| 16454 | alc663_15jd_two_speaker_automute(codec); |
| 16455 | break; |
| 16456 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16457 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16458 | break; |
| 16459 | } |
| 16460 | } |
| 16461 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16462 | #define alc663_mode5_setup alc663_m51va_setup |
| 16463 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16464 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16465 | { |
| 16466 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16467 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16468 | } |
| 16469 | /* ***************** Mode6 ******************************/ |
| 16470 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16471 | unsigned int res) |
| 16472 | { |
| 16473 | switch (res >> 26) { |
| 16474 | case ALC880_HP_EVENT: |
| 16475 | alc663_two_hp_m2_speaker_automute(codec); |
| 16476 | break; |
| 16477 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16478 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16479 | break; |
| 16480 | } |
| 16481 | } |
| 16482 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16483 | #define alc663_mode6_setup alc663_m51va_setup |
| 16484 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16485 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16486 | { |
| 16487 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16488 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16489 | } |
| 16490 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16491 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16492 | { |
| 16493 | unsigned int present; |
| 16494 | unsigned char bits; |
| 16495 | |
| 16496 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16497 | AC_VERB_GET_PIN_SENSE, 0) |
| 16498 | & AC_PINSENSE_PRESENCE; |
| 16499 | bits = present ? HDA_AMP_MUTE : 0; |
| 16500 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16501 | HDA_AMP_MUTE, bits); |
| 16502 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16503 | HDA_AMP_MUTE, bits); |
| 16504 | } |
| 16505 | |
| 16506 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16507 | { |
| 16508 | unsigned int present; |
| 16509 | unsigned char bits; |
| 16510 | |
| 16511 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16512 | AC_VERB_GET_PIN_SENSE, 0) |
| 16513 | & AC_PINSENSE_PRESENCE; |
| 16514 | bits = present ? HDA_AMP_MUTE : 0; |
| 16515 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16516 | HDA_AMP_MUTE, bits); |
| 16517 | } |
| 16518 | |
| 16519 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16520 | unsigned int res) |
| 16521 | { |
| 16522 | switch (res >> 26) { |
| 16523 | case ALC880_HP_EVENT: |
| 16524 | alc663_g71v_hp_automute(codec); |
| 16525 | break; |
| 16526 | case ALC880_FRONT_EVENT: |
| 16527 | alc663_g71v_front_automute(codec); |
| 16528 | break; |
| 16529 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16530 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16531 | break; |
| 16532 | } |
| 16533 | } |
| 16534 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16535 | #define alc663_g71v_setup alc663_m51va_setup |
| 16536 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16537 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16538 | { |
| 16539 | alc663_g71v_front_automute(codec); |
| 16540 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16541 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16542 | } |
| 16543 | |
| 16544 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16545 | unsigned int res) |
| 16546 | { |
| 16547 | switch (res >> 26) { |
| 16548 | case ALC880_HP_EVENT: |
| 16549 | alc663_m51va_speaker_automute(codec); |
| 16550 | break; |
| 16551 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16552 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16553 | break; |
| 16554 | } |
| 16555 | } |
| 16556 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16557 | #define alc663_g50v_setup alc663_m51va_setup |
| 16558 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16559 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16560 | { |
| 16561 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16562 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16563 | } |
| 16564 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16565 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16566 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16567 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16568 | |
| 16569 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16570 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16571 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16572 | |
| 16573 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16574 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16575 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16576 | { } /* end */ |
| 16577 | }; |
| 16578 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16579 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16580 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16581 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16582 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16583 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16584 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16585 | |
| 16586 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16587 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16588 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16589 | |
| 16590 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16591 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16592 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16593 | { } /* end */ |
| 16594 | }; |
| 16595 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16596 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16597 | #define alc662_loopbacks alc880_loopbacks |
| 16598 | #endif |
| 16599 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16600 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16601 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16602 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16603 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16604 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16605 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16606 | |
| 16607 | /* |
| 16608 | * configuration and preset |
| 16609 | */ |
| 16610 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16611 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16612 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16613 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16614 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16615 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16616 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16617 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16618 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16619 | [ALC663_ASUS_M51VA] = "m51va", |
| 16620 | [ALC663_ASUS_G71V] = "g71v", |
| 16621 | [ALC663_ASUS_H13] = "h13", |
| 16622 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16623 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16624 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16625 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16626 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16627 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16628 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16629 | [ALC272_DELL] = "dell", |
| 16630 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16631 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16632 | [ALC662_AUTO] = "auto", |
| 16633 | }; |
| 16634 | |
| 16635 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16636 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16637 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16638 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16639 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16640 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16641 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16642 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16643 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16644 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16645 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16646 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16647 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16648 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16649 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16650 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16651 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16652 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16653 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16654 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16655 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16656 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16657 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16658 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16659 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16660 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16661 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16662 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16663 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16664 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16665 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16666 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16667 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16668 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16669 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16670 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16671 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16672 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16673 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16674 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16675 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16676 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16677 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16678 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16679 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16680 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16681 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16682 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16683 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16684 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16685 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16686 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16687 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16688 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16689 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16690 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16691 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16692 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16693 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16694 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16695 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16696 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16697 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16698 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16699 | {} |
| 16700 | }; |
| 16701 | |
| 16702 | static struct alc_config_preset alc662_presets[] = { |
| 16703 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16704 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16705 | .init_verbs = { alc662_init_verbs }, |
| 16706 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16707 | .dac_nids = alc662_dac_nids, |
| 16708 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16709 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16710 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16711 | .channel_mode = alc662_3ST_2ch_modes, |
| 16712 | .input_mux = &alc662_capture_source, |
| 16713 | }, |
| 16714 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16715 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16716 | .init_verbs = { alc662_init_verbs }, |
| 16717 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16718 | .dac_nids = alc662_dac_nids, |
| 16719 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16720 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16721 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16722 | .channel_mode = alc662_3ST_6ch_modes, |
| 16723 | .need_dac_fix = 1, |
| 16724 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16725 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16726 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16727 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16728 | .init_verbs = { alc662_init_verbs }, |
| 16729 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16730 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16731 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16732 | .channel_mode = alc662_3ST_6ch_modes, |
| 16733 | .need_dac_fix = 1, |
| 16734 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16735 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16736 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16737 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16738 | .init_verbs = { alc662_init_verbs }, |
| 16739 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16740 | .dac_nids = alc662_dac_nids, |
| 16741 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16742 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16743 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16744 | .channel_mode = alc662_5stack_modes, |
| 16745 | .input_mux = &alc662_capture_source, |
| 16746 | }, |
| 16747 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16748 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16749 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16750 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16751 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16752 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16753 | .channel_mode = alc662_3ST_2ch_modes, |
| 16754 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16755 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16756 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16757 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16758 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16759 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16760 | .init_verbs = { alc662_init_verbs, |
| 16761 | alc662_eeepc_sue_init_verbs }, |
| 16762 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16763 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16764 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16765 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16766 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16767 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16768 | .init_hook = alc662_eeepc_inithook, |
| 16769 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16770 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16771 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16772 | alc662_chmode_mixer }, |
| 16773 | .init_verbs = { alc662_init_verbs, |
| 16774 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16775 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16776 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16777 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16778 | .channel_mode = alc662_3ST_6ch_modes, |
| 16779 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16780 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16781 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16782 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16783 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16784 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16785 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16786 | .init_verbs = { alc662_init_verbs, |
| 16787 | alc662_ecs_init_verbs }, |
| 16788 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16789 | .dac_nids = alc662_dac_nids, |
| 16790 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16791 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16792 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16793 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16794 | .init_hook = alc662_eeepc_inithook, |
| 16795 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16796 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16797 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16798 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16799 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16800 | .dac_nids = alc662_dac_nids, |
| 16801 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16802 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16803 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16804 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16805 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16806 | .init_hook = alc663_m51va_inithook, |
| 16807 | }, |
| 16808 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16809 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16810 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16811 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16812 | .dac_nids = alc662_dac_nids, |
| 16813 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16814 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16815 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16816 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16817 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16818 | .init_hook = alc663_g71v_inithook, |
| 16819 | }, |
| 16820 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16821 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16822 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16823 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16824 | .dac_nids = alc662_dac_nids, |
| 16825 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16826 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16827 | .unsol_event = alc663_m51va_unsol_event, |
| 16828 | .init_hook = alc663_m51va_inithook, |
| 16829 | }, |
| 16830 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16831 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16832 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16833 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16834 | .dac_nids = alc662_dac_nids, |
| 16835 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16836 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16837 | .channel_mode = alc662_3ST_6ch_modes, |
| 16838 | .input_mux = &alc663_capture_source, |
| 16839 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16840 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16841 | .init_hook = alc663_g50v_inithook, |
| 16842 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16843 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16844 | .mixers = { alc663_m51va_mixer }, |
| 16845 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16846 | .init_verbs = { alc662_init_verbs, |
| 16847 | alc663_21jd_amic_init_verbs }, |
| 16848 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16849 | .hp_nid = 0x03, |
| 16850 | .dac_nids = alc662_dac_nids, |
| 16851 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16852 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16853 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16854 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16855 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16856 | .init_hook = alc663_mode1_inithook, |
| 16857 | }, |
| 16858 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16859 | .mixers = { alc662_1bjd_mixer }, |
| 16860 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16861 | .init_verbs = { alc662_init_verbs, |
| 16862 | alc662_1bjd_amic_init_verbs }, |
| 16863 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16864 | .dac_nids = alc662_dac_nids, |
| 16865 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16866 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16867 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16868 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16869 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16870 | .init_hook = alc662_mode2_inithook, |
| 16871 | }, |
| 16872 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16873 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16874 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16875 | .init_verbs = { alc662_init_verbs, |
| 16876 | alc663_two_hp_amic_m1_init_verbs }, |
| 16877 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16878 | .hp_nid = 0x03, |
| 16879 | .dac_nids = alc662_dac_nids, |
| 16880 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16881 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16882 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16883 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16884 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16885 | .init_hook = alc663_mode3_inithook, |
| 16886 | }, |
| 16887 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16888 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16889 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16890 | .init_verbs = { alc662_init_verbs, |
| 16891 | alc663_21jd_amic_init_verbs}, |
| 16892 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16893 | .hp_nid = 0x03, |
| 16894 | .dac_nids = alc662_dac_nids, |
| 16895 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16896 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16897 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16898 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16899 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16900 | .init_hook = alc663_mode4_inithook, |
| 16901 | }, |
| 16902 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16903 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16904 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16905 | .init_verbs = { alc662_init_verbs, |
| 16906 | alc663_15jd_amic_init_verbs }, |
| 16907 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16908 | .hp_nid = 0x03, |
| 16909 | .dac_nids = alc662_dac_nids, |
| 16910 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16911 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16912 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16913 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16914 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16915 | .init_hook = alc663_mode5_inithook, |
| 16916 | }, |
| 16917 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16918 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16919 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16920 | .init_verbs = { alc662_init_verbs, |
| 16921 | alc663_two_hp_amic_m2_init_verbs }, |
| 16922 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16923 | .hp_nid = 0x03, |
| 16924 | .dac_nids = alc662_dac_nids, |
| 16925 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16926 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16927 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16928 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16929 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16930 | .init_hook = alc663_mode6_inithook, |
| 16931 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16932 | [ALC272_DELL] = { |
| 16933 | .mixers = { alc663_m51va_mixer }, |
| 16934 | .cap_mixer = alc272_auto_capture_mixer, |
| 16935 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16936 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16937 | .dac_nids = alc662_dac_nids, |
| 16938 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16939 | .adc_nids = alc272_adc_nids, |
| 16940 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16941 | .capsrc_nids = alc272_capsrc_nids, |
| 16942 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16943 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16944 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16945 | .init_hook = alc663_m51va_inithook, |
| 16946 | }, |
| 16947 | [ALC272_DELL_ZM1] = { |
| 16948 | .mixers = { alc663_m51va_mixer }, |
| 16949 | .cap_mixer = alc662_auto_capture_mixer, |
| 16950 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16951 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16952 | .dac_nids = alc662_dac_nids, |
| 16953 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16954 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16955 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16956 | .capsrc_nids = alc662_capsrc_nids, |
| 16957 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16958 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16959 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16960 | .init_hook = alc663_m51va_inithook, |
| 16961 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16962 | [ALC272_SAMSUNG_NC10] = { |
| 16963 | .mixers = { alc272_nc10_mixer }, |
| 16964 | .init_verbs = { alc662_init_verbs, |
| 16965 | alc663_21jd_amic_init_verbs }, |
| 16966 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16967 | .dac_nids = alc272_dac_nids, |
| 16968 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16969 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16970 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16971 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16972 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16973 | .init_hook = alc663_mode4_inithook, |
| 16974 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16975 | }; |
| 16976 | |
| 16977 | |
| 16978 | /* |
| 16979 | * BIOS auto configuration |
| 16980 | */ |
| 16981 | |
| 16982 | /* add playback controls from the parsed DAC table */ |
| 16983 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16984 | const struct auto_pin_cfg *cfg) |
| 16985 | { |
| 16986 | char name[32]; |
| 16987 | static const char *chname[4] = { |
| 16988 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16989 | }; |
| 16990 | hda_nid_t nid; |
| 16991 | int i, err; |
| 16992 | |
| 16993 | for (i = 0; i < cfg->line_outs; i++) { |
| 16994 | if (!spec->multiout.dac_nids[i]) |
| 16995 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16996 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16997 | if (i == 2) { |
| 16998 | /* Center/LFE */ |
| 16999 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17000 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17001 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17002 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17003 | if (err < 0) |
| 17004 | return err; |
| 17005 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17006 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17007 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17008 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17009 | if (err < 0) |
| 17010 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17011 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17012 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17013 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17014 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17015 | if (err < 0) |
| 17016 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17017 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17018 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17019 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17020 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17021 | if (err < 0) |
| 17022 | return err; |
| 17023 | } else { |
| 17024 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17025 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17026 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17027 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17028 | if (err < 0) |
| 17029 | return err; |
| 17030 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17031 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17032 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17033 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17034 | if (err < 0) |
| 17035 | return err; |
| 17036 | } |
| 17037 | } |
| 17038 | return 0; |
| 17039 | } |
| 17040 | |
| 17041 | /* add playback controls for speaker and HP outputs */ |
| 17042 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17043 | const char *pfx) |
| 17044 | { |
| 17045 | hda_nid_t nid; |
| 17046 | int err; |
| 17047 | char name[32]; |
| 17048 | |
| 17049 | if (!pin) |
| 17050 | return 0; |
| 17051 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17052 | if (pin == 0x17) { |
| 17053 | /* ALC663 has a mono output pin on 0x17 */ |
| 17054 | sprintf(name, "%s Playback Switch", pfx); |
| 17055 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17056 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17057 | return err; |
| 17058 | } |
| 17059 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17060 | if (alc880_is_fixed_pin(pin)) { |
| 17061 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17062 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17063 | /* specify the DAC as the extra output */ |
| 17064 | if (!spec->multiout.hp_nid) |
| 17065 | spec->multiout.hp_nid = nid; |
| 17066 | else |
| 17067 | spec->multiout.extra_out_nid[0] = nid; |
| 17068 | /* control HP volume/switch on the output mixer amp */ |
| 17069 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17070 | sprintf(name, "%s Playback Volume", pfx); |
| 17071 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17072 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17073 | if (err < 0) |
| 17074 | return err; |
| 17075 | sprintf(name, "%s Playback Switch", pfx); |
| 17076 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17077 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17078 | if (err < 0) |
| 17079 | return err; |
| 17080 | } else if (alc880_is_multi_pin(pin)) { |
| 17081 | /* set manual connection */ |
| 17082 | /* we have only a switch on HP-out PIN */ |
| 17083 | sprintf(name, "%s Playback Switch", pfx); |
| 17084 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17085 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17086 | if (err < 0) |
| 17087 | return err; |
| 17088 | } |
| 17089 | return 0; |
| 17090 | } |
| 17091 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17092 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17093 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17094 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17095 | return (pincap & AC_PINCAP_IN) != 0; |
| 17096 | } |
| 17097 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17098 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17099 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17100 | const struct auto_pin_cfg *cfg) |
| 17101 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17102 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17103 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17104 | int i, err, idx; |
| 17105 | |
| 17106 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17107 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 17108 | idx = get_connection_index(codec, 0x0b, |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17109 | cfg->input_pins[i]); |
| 17110 | if (idx >= 0) { |
| 17111 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17112 | auto_pin_cfg_labels[i], |
| 17113 | idx, 0x0b); |
| 17114 | if (err < 0) |
| 17115 | return err; |
| 17116 | } |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 17117 | idx = get_connection_index(codec, 0x22, |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17118 | cfg->input_pins[i]); |
| 17119 | if (idx >= 0) { |
| 17120 | imux->items[imux->num_items].label = |
| 17121 | auto_pin_cfg_labels[i]; |
| 17122 | imux->items[imux->num_items].index = idx; |
| 17123 | imux->num_items++; |
| 17124 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17125 | } |
| 17126 | } |
| 17127 | return 0; |
| 17128 | } |
| 17129 | |
| 17130 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17131 | hda_nid_t nid, int pin_type, |
| 17132 | int dac_idx) |
| 17133 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17134 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17135 | /* need the manual connection? */ |
| 17136 | if (alc880_is_multi_pin(nid)) { |
| 17137 | struct alc_spec *spec = codec->spec; |
| 17138 | int idx = alc880_multi_pin_idx(nid); |
| 17139 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17140 | AC_VERB_SET_CONNECT_SEL, |
| 17141 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17142 | } |
| 17143 | } |
| 17144 | |
| 17145 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17146 | { |
| 17147 | struct alc_spec *spec = codec->spec; |
| 17148 | int i; |
| 17149 | |
| 17150 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17151 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17152 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17153 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17154 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17155 | i); |
| 17156 | } |
| 17157 | } |
| 17158 | |
| 17159 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17160 | { |
| 17161 | struct alc_spec *spec = codec->spec; |
| 17162 | hda_nid_t pin; |
| 17163 | |
| 17164 | pin = spec->autocfg.hp_pins[0]; |
| 17165 | if (pin) /* connect to front */ |
| 17166 | /* use dac 0 */ |
| 17167 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17168 | pin = spec->autocfg.speaker_pins[0]; |
| 17169 | if (pin) |
| 17170 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17171 | } |
| 17172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17173 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17174 | |
| 17175 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17176 | { |
| 17177 | struct alc_spec *spec = codec->spec; |
| 17178 | int i; |
| 17179 | |
| 17180 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17181 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17182 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17183 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17184 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17185 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17186 | snd_hda_codec_write(codec, nid, 0, |
| 17187 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17188 | AMP_OUT_MUTE); |
| 17189 | } |
| 17190 | } |
| 17191 | } |
| 17192 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17193 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17194 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17195 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17196 | { |
| 17197 | struct alc_spec *spec = codec->spec; |
| 17198 | int err; |
| 17199 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17200 | |
| 17201 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17202 | alc662_ignore); |
| 17203 | if (err < 0) |
| 17204 | return err; |
| 17205 | if (!spec->autocfg.line_outs) |
| 17206 | return 0; /* can't find valid BIOS pin config */ |
| 17207 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17208 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17209 | if (err < 0) |
| 17210 | return err; |
| 17211 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17212 | if (err < 0) |
| 17213 | return err; |
| 17214 | err = alc662_auto_create_extra_out(spec, |
| 17215 | spec->autocfg.speaker_pins[0], |
| 17216 | "Speaker"); |
| 17217 | if (err < 0) |
| 17218 | return err; |
| 17219 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17220 | "Headphone"); |
| 17221 | if (err < 0) |
| 17222 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17223 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17224 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17225 | return err; |
| 17226 | |
| 17227 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17228 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17229 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17230 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17231 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17232 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17233 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17234 | |
| 17235 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17236 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17237 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17238 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17239 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17240 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17241 | |
| 17242 | err = alc_auto_add_mic_boost(codec); |
| 17243 | if (err < 0) |
| 17244 | return err; |
| 17245 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17246 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17247 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17248 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17249 | } |
| 17250 | |
| 17251 | /* additional initialization for auto-configuration model */ |
| 17252 | static void alc662_auto_init(struct hda_codec *codec) |
| 17253 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17254 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17255 | alc662_auto_init_multi_out(codec); |
| 17256 | alc662_auto_init_hp_out(codec); |
| 17257 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17258 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17259 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17260 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17261 | } |
| 17262 | |
| 17263 | static int patch_alc662(struct hda_codec *codec) |
| 17264 | { |
| 17265 | struct alc_spec *spec; |
| 17266 | int err, board_config; |
| 17267 | |
| 17268 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17269 | if (!spec) |
| 17270 | return -ENOMEM; |
| 17271 | |
| 17272 | codec->spec = spec; |
| 17273 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17274 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17275 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17276 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17277 | alc662_models, |
| 17278 | alc662_cfg_tbl); |
| 17279 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17280 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17281 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17282 | board_config = ALC662_AUTO; |
| 17283 | } |
| 17284 | |
| 17285 | if (board_config == ALC662_AUTO) { |
| 17286 | /* automatic parse from the BIOS config */ |
| 17287 | err = alc662_parse_auto_config(codec); |
| 17288 | if (err < 0) { |
| 17289 | alc_free(codec); |
| 17290 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17291 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17292 | printk(KERN_INFO |
| 17293 | "hda_codec: Cannot set up configuration " |
| 17294 | "from BIOS. Using base mode...\n"); |
| 17295 | board_config = ALC662_3ST_2ch_DIG; |
| 17296 | } |
| 17297 | } |
| 17298 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17299 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17300 | if (err < 0) { |
| 17301 | alc_free(codec); |
| 17302 | return err; |
| 17303 | } |
| 17304 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17305 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17306 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17307 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17308 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17309 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17310 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17311 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17312 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17313 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17314 | if (!spec->adc_nids) { |
| 17315 | spec->adc_nids = alc662_adc_nids; |
| 17316 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17317 | } |
| 17318 | if (!spec->capsrc_nids) |
| 17319 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17320 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17321 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17322 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17323 | if (codec->vendor_id == 0x10ec0662) |
| 17324 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17325 | else |
| 17326 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17327 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17328 | spec->vmaster_nid = 0x02; |
| 17329 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17330 | codec->patch_ops = alc_patch_ops; |
| 17331 | if (board_config == ALC662_AUTO) |
| 17332 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17333 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17334 | if (!spec->loopback.amplist) |
| 17335 | spec->loopback.amplist = alc662_loopbacks; |
| 17336 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17337 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17338 | |
| 17339 | return 0; |
| 17340 | } |
| 17341 | |
| 17342 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17343 | * patch entries |
| 17344 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17345 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17346 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17347 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17348 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17349 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17350 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17351 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17352 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17353 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17354 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17355 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17356 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17357 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17358 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17359 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17360 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17361 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17362 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17363 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17364 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17365 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17366 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17367 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17368 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17369 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17370 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17371 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17372 | .patch = patch_alc882 }, |
| 17373 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17374 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17375 | {} /* terminator */ |
| 17376 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17377 | |
| 17378 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17379 | |
| 17380 | MODULE_LICENSE("GPL"); |
| 17381 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17382 | |
| 17383 | static struct hda_codec_preset_list realtek_list = { |
| 17384 | .preset = snd_hda_preset_realtek, |
| 17385 | .owner = THIS_MODULE, |
| 17386 | }; |
| 17387 | |
| 17388 | static int __init patch_realtek_init(void) |
| 17389 | { |
| 17390 | return snd_hda_add_codec_preset(&realtek_list); |
| 17391 | } |
| 17392 | |
| 17393 | static void __exit patch_realtek_exit(void) |
| 17394 | { |
| 17395 | snd_hda_delete_codec_preset(&realtek_list); |
| 17396 | } |
| 17397 | |
| 17398 | module_init(patch_realtek_init) |
| 17399 | module_exit(patch_realtek_exit) |