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 | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 244 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 245 | ALC882_AUTO, |
| 246 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 247 | }; |
| 248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 249 | /* for GPIO Poll */ |
| 250 | #define GPIO_MASK 0x03 |
| 251 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 252 | /* extra amp-initialization sequence types */ |
| 253 | enum { |
| 254 | ALC_INIT_NONE, |
| 255 | ALC_INIT_DEFAULT, |
| 256 | ALC_INIT_GPIO1, |
| 257 | ALC_INIT_GPIO2, |
| 258 | ALC_INIT_GPIO3, |
| 259 | }; |
| 260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | struct alc_spec { |
| 262 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 263 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 265 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 266 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 268 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 269 | * don't forget NULL |
| 270 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 271 | */ |
| 272 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 274 | char stream_name_analog[16]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | struct hda_pcm_stream *stream_analog_playback; |
| 276 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 277 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 278 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 280 | char stream_name_digital[16]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | struct hda_pcm_stream *stream_digital_playback; |
| 282 | struct hda_pcm_stream *stream_digital_capture; |
| 283 | |
| 284 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 285 | struct hda_multi_out multiout; /* playback set-up |
| 286 | * max_channels, dacs must be set |
| 287 | * dig_out_nid and hp_nid are optional |
| 288 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 289 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 290 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 291 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
| 293 | /* capture */ |
| 294 | unsigned int num_adc_nids; |
| 295 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 296 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 297 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | |
| 299 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 300 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | const struct hda_input_mux *input_mux; |
| 302 | unsigned int cur_mux[3]; |
| 303 | |
| 304 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 305 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 307 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 308 | int const_channel_count; |
| 309 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | |
| 311 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 312 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 313 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 314 | /* dynamic controls, init_verbs and input_mux */ |
| 315 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 316 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 317 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 318 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 319 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 320 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 321 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 322 | /* hooks */ |
| 323 | void (*init_hook)(struct hda_codec *codec); |
| 324 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 325 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 326 | /* for pin sensing */ |
| 327 | unsigned int sense_updated: 1; |
| 328 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 329 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 330 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 331 | /* other flags */ |
| 332 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 333 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 334 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 335 | /* for virtual master */ |
| 336 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 337 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 338 | struct hda_loopback_check loopback; |
| 339 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 340 | |
| 341 | /* for PLL fix */ |
| 342 | hda_nid_t pll_nid; |
| 343 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 344 | }; |
| 345 | |
| 346 | /* |
| 347 | * configuration template - to be copied to the spec instance |
| 348 | */ |
| 349 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 350 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 351 | * with spec |
| 352 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 353 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 354 | const struct hda_verb *init_verbs[5]; |
| 355 | unsigned int num_dacs; |
| 356 | hda_nid_t *dac_nids; |
| 357 | hda_nid_t dig_out_nid; /* optional */ |
| 358 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 359 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 360 | unsigned int num_adc_nids; |
| 361 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 362 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 363 | hda_nid_t dig_in_nid; |
| 364 | unsigned int num_channel_mode; |
| 365 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 366 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 367 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 368 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 369 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 370 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 371 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 373 | struct hda_amp_list *loopbacks; |
| 374 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | }; |
| 376 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | |
| 378 | /* |
| 379 | * input MUX handling |
| 380 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 381 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 382 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | { |
| 384 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 385 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 386 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 387 | if (mux_idx >= spec->num_mux_defs) |
| 388 | mux_idx = 0; |
| 389 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 392 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 393 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | { |
| 395 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 396 | struct alc_spec *spec = codec->spec; |
| 397 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 398 | |
| 399 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 400 | return 0; |
| 401 | } |
| 402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 403 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 404 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | { |
| 406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 407 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 408 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 410 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 411 | hda_nid_t nid = spec->capsrc_nids ? |
| 412 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 413 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 415 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 416 | imux = &spec->input_mux[mux_idx]; |
| 417 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 418 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 419 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 420 | /* Matrix-mixer style (e.g. ALC882) */ |
| 421 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 422 | unsigned int i, idx; |
| 423 | |
| 424 | idx = ucontrol->value.enumerated.item[0]; |
| 425 | if (idx >= imux->num_items) |
| 426 | idx = imux->num_items - 1; |
| 427 | if (*cur_val == idx) |
| 428 | return 0; |
| 429 | for (i = 0; i < imux->num_items; i++) { |
| 430 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 431 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 432 | imux->items[i].index, |
| 433 | HDA_AMP_MUTE, v); |
| 434 | } |
| 435 | *cur_val = idx; |
| 436 | return 1; |
| 437 | } else { |
| 438 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 439 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 440 | &spec->cur_mux[adc_idx]); |
| 441 | } |
| 442 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 443 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | /* |
| 445 | * channel mode setting |
| 446 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | { |
| 450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 451 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 452 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 453 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 456 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 457 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | { |
| 459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 460 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 461 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 462 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 463 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 467 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | { |
| 469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 470 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 471 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 472 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 473 | &spec->ext_channel_count); |
| 474 | if (err >= 0 && !spec->const_channel_count) { |
| 475 | spec->multiout.max_channels = spec->ext_channel_count; |
| 476 | if (spec->need_dac_fix) |
| 477 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 478 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 479 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | } |
| 481 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 484 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | * being part of a format specifier. Maximum allowed length of a value is |
| 486 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 487 | * |
| 488 | * Note: some retasking pin complexes seem to ignore requests for input |
| 489 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 490 | * are requested. Therefore order this list so that this behaviour will not |
| 491 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 492 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 493 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 494 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 495 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 496 | "Mic 50pc bias", "Mic 80pc bias", |
| 497 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | }; |
| 499 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 500 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 501 | }; |
| 502 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 503 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 504 | * addition, "input" pins may or may not process the mic bias option |
| 505 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 506 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 507 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 509 | #define ALC_PIN_DIR_IN 0x00 |
| 510 | #define ALC_PIN_DIR_OUT 0x01 |
| 511 | #define ALC_PIN_DIR_INOUT 0x02 |
| 512 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 513 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 515 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 516 | * For each direction the minimum and maximum values are given. |
| 517 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 518 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 520 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 521 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 522 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 523 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 524 | }; |
| 525 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 526 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 527 | #define alc_pin_mode_n_items(_dir) \ |
| 528 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 529 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 531 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 532 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | unsigned int item_num = uinfo->value.enumerated.item; |
| 534 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 535 | |
| 536 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 539 | |
| 540 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 541 | item_num = alc_pin_mode_min(dir); |
| 542 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 543 | return 0; |
| 544 | } |
| 545 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 547 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 548 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 549 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 550 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 551 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 553 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 554 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 555 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 556 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 557 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | /* Find enumerated value for current pinctl setting */ |
| 559 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | return 0; |
| 564 | } |
| 565 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 566 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 567 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 568 | { |
| 569 | signed int change; |
| 570 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 571 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 572 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 573 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 575 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 576 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 578 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | val = alc_pin_mode_min(dir); |
| 580 | |
| 581 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 582 | if (change) { |
| 583 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 584 | snd_hda_codec_write_cache(codec, nid, 0, |
| 585 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 586 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 588 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 589 | * for the requested pin mode. Enum values of 2 or less are |
| 590 | * input modes. |
| 591 | * |
| 592 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 593 | * reduces noise slightly (particularly on input) so we'll |
| 594 | * do it. However, having both input and output buffers |
| 595 | * enabled simultaneously doesn't seem to be problematic if |
| 596 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 597 | */ |
| 598 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 599 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 600 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 601 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 602 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 603 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 604 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 605 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 606 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 607 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 608 | } |
| 609 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 610 | return change; |
| 611 | } |
| 612 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 613 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 614 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 615 | .info = alc_pin_mode_info, \ |
| 616 | .get = alc_pin_mode_get, \ |
| 617 | .put = alc_pin_mode_put, \ |
| 618 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 619 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 620 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 621 | * together using a mask with more than one bit set. This control is |
| 622 | * currently used only by the ALC260 test model. At this stage they are not |
| 623 | * needed for any "production" models. |
| 624 | */ |
| 625 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 626 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 627 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 628 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 629 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 630 | { |
| 631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 632 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 633 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 634 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 635 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 636 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 637 | |
| 638 | *valp = (val & mask) != 0; |
| 639 | return 0; |
| 640 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 641 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 642 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 643 | { |
| 644 | signed int change; |
| 645 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 646 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 647 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 648 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 650 | AC_VERB_GET_GPIO_DATA, |
| 651 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 652 | |
| 653 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 654 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 655 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 656 | gpio_data &= ~mask; |
| 657 | else |
| 658 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 659 | snd_hda_codec_write_cache(codec, nid, 0, |
| 660 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 661 | |
| 662 | return change; |
| 663 | } |
| 664 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 665 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 666 | .info = alc_gpio_data_info, \ |
| 667 | .get = alc_gpio_data_get, \ |
| 668 | .put = alc_gpio_data_put, \ |
| 669 | .private_value = nid | (mask<<16) } |
| 670 | #endif /* CONFIG_SND_DEBUG */ |
| 671 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 672 | /* A switch control to allow the enabling of the digital IO pins on the |
| 673 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 674 | * to provide something in the test model allowing digital outputs to be |
| 675 | * identified if present. If models are found which can utilise these |
| 676 | * outputs a more complete mixer control can be devised for those models if |
| 677 | * necessary. |
| 678 | */ |
| 679 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 680 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 681 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 682 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 683 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 684 | { |
| 685 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 686 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 687 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 688 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 689 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 690 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 691 | |
| 692 | *valp = (val & mask) != 0; |
| 693 | return 0; |
| 694 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 695 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 696 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 697 | { |
| 698 | signed int change; |
| 699 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 700 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 701 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 702 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 704 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 706 | |
| 707 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 708 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 709 | if (val==0) |
| 710 | ctrl_data &= ~mask; |
| 711 | else |
| 712 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 713 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 714 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 715 | |
| 716 | return change; |
| 717 | } |
| 718 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 719 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 720 | .info = alc_spdif_ctrl_info, \ |
| 721 | .get = alc_spdif_ctrl_get, \ |
| 722 | .put = alc_spdif_ctrl_put, \ |
| 723 | .private_value = nid | (mask<<16) } |
| 724 | #endif /* CONFIG_SND_DEBUG */ |
| 725 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 726 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 727 | * Again, this is only used in the ALC26x test models to help identify when |
| 728 | * the EAPD line must be asserted for features to work. |
| 729 | */ |
| 730 | #ifdef CONFIG_SND_DEBUG |
| 731 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 732 | |
| 733 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 734 | struct snd_ctl_elem_value *ucontrol) |
| 735 | { |
| 736 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 737 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 738 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 739 | long *valp = ucontrol->value.integer.value; |
| 740 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 741 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 742 | |
| 743 | *valp = (val & mask) != 0; |
| 744 | return 0; |
| 745 | } |
| 746 | |
| 747 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 748 | struct snd_ctl_elem_value *ucontrol) |
| 749 | { |
| 750 | int change; |
| 751 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 752 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 753 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 754 | long val = *ucontrol->value.integer.value; |
| 755 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 756 | AC_VERB_GET_EAPD_BTLENABLE, |
| 757 | 0x00); |
| 758 | |
| 759 | /* Set/unset the masked control bit(s) as needed */ |
| 760 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 761 | if (!val) |
| 762 | ctrl_data &= ~mask; |
| 763 | else |
| 764 | ctrl_data |= mask; |
| 765 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 766 | ctrl_data); |
| 767 | |
| 768 | return change; |
| 769 | } |
| 770 | |
| 771 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 772 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 773 | .info = alc_eapd_ctrl_info, \ |
| 774 | .get = alc_eapd_ctrl_get, \ |
| 775 | .put = alc_eapd_ctrl_put, \ |
| 776 | .private_value = nid | (mask<<16) } |
| 777 | #endif /* CONFIG_SND_DEBUG */ |
| 778 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 779 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 780 | * set up the input pin config (depending on the given auto-pin type) |
| 781 | */ |
| 782 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 783 | int auto_pin_type) |
| 784 | { |
| 785 | unsigned int val = PIN_IN; |
| 786 | |
| 787 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 788 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 789 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 790 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 791 | if (pincap & AC_PINCAP_VREF_80) |
| 792 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 793 | else if (pincap & AC_PINCAP_VREF_50) |
| 794 | val = PIN_VREF50; |
| 795 | else if (pincap & AC_PINCAP_VREF_100) |
| 796 | val = PIN_VREF100; |
| 797 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 798 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 799 | } |
| 800 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 801 | } |
| 802 | |
| 803 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 804 | */ |
| 805 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 806 | { |
| 807 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 808 | return; |
| 809 | spec->mixers[spec->num_mixers++] = mix; |
| 810 | } |
| 811 | |
| 812 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 813 | { |
| 814 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 815 | return; |
| 816 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 817 | } |
| 818 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 819 | #ifdef CONFIG_PROC_FS |
| 820 | /* |
| 821 | * hook for proc |
| 822 | */ |
| 823 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 824 | struct hda_codec *codec, hda_nid_t nid) |
| 825 | { |
| 826 | int coeff; |
| 827 | |
| 828 | if (nid != 0x20) |
| 829 | return; |
| 830 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 831 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 832 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 833 | AC_VERB_GET_COEF_INDEX, 0); |
| 834 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 835 | } |
| 836 | #else |
| 837 | #define print_realtek_coef NULL |
| 838 | #endif |
| 839 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 840 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 841 | * set up from the preset table |
| 842 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 843 | static void setup_preset(struct alc_spec *spec, |
| 844 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 845 | { |
| 846 | int i; |
| 847 | |
| 848 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 849 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 850 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 851 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 852 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 853 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 854 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 855 | spec->channel_mode = preset->channel_mode; |
| 856 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 857 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 858 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 860 | if (preset->const_channel_count) |
| 861 | spec->multiout.max_channels = preset->const_channel_count; |
| 862 | else |
| 863 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 864 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 865 | |
| 866 | spec->multiout.num_dacs = preset->num_dacs; |
| 867 | spec->multiout.dac_nids = preset->dac_nids; |
| 868 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 869 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 870 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 871 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 872 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 873 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 874 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 875 | spec->input_mux = preset->input_mux; |
| 876 | |
| 877 | spec->num_adc_nids = preset->num_adc_nids; |
| 878 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 879 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 880 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 881 | |
| 882 | spec->unsol_event = preset->unsol_event; |
| 883 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 884 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 885 | spec->loopback.amplist = preset->loopbacks; |
| 886 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 887 | } |
| 888 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 889 | /* Enable GPIO mask and set output */ |
| 890 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 891 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 892 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 893 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 894 | { } |
| 895 | }; |
| 896 | |
| 897 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 898 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 899 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 900 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 901 | { } |
| 902 | }; |
| 903 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 904 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 905 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 906 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 907 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 908 | { } |
| 909 | }; |
| 910 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 911 | /* |
| 912 | * Fix hardware PLL issue |
| 913 | * On some codecs, the analog PLL gating control must be off while |
| 914 | * the default value is 1. |
| 915 | */ |
| 916 | static void alc_fix_pll(struct hda_codec *codec) |
| 917 | { |
| 918 | struct alc_spec *spec = codec->spec; |
| 919 | unsigned int val; |
| 920 | |
| 921 | if (!spec->pll_nid) |
| 922 | return; |
| 923 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 924 | spec->pll_coef_idx); |
| 925 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 926 | AC_VERB_GET_PROC_COEF, 0); |
| 927 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 928 | spec->pll_coef_idx); |
| 929 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 930 | val & ~(1 << spec->pll_coef_bit)); |
| 931 | } |
| 932 | |
| 933 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 934 | unsigned int coef_idx, unsigned int coef_bit) |
| 935 | { |
| 936 | struct alc_spec *spec = codec->spec; |
| 937 | spec->pll_nid = nid; |
| 938 | spec->pll_coef_idx = coef_idx; |
| 939 | spec->pll_coef_bit = coef_bit; |
| 940 | alc_fix_pll(codec); |
| 941 | } |
| 942 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 943 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 944 | { |
| 945 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 946 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 947 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 948 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 949 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 950 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 951 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 952 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 953 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 954 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 955 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 956 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 957 | nid = spec->autocfg.speaker_pins[i]; |
| 958 | if (!nid) |
| 959 | break; |
| 960 | snd_hda_codec_write(codec, nid, 0, |
| 961 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 962 | spec->jack_present ? 0 : PIN_OUT); |
| 963 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 964 | } |
| 965 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 966 | #if 0 /* it's broken in some cases -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 967 | static void alc_mic_automute(struct hda_codec *codec) |
| 968 | { |
| 969 | struct alc_spec *spec = codec->spec; |
| 970 | unsigned int present; |
| 971 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 972 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 973 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 974 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 975 | |
| 976 | capsrc_idx_mic = mic_nid - 0x18; |
| 977 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 978 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 979 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 980 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 981 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 982 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 983 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 984 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 985 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 986 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 987 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 988 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 989 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 990 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | /* unsolicited event for HP jack sensing */ |
| 992 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 993 | { |
| 994 | if (codec->vendor_id == 0x10ec0880) |
| 995 | res >>= 28; |
| 996 | else |
| 997 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 998 | switch (res) { |
| 999 | case ALC880_HP_EVENT: |
| 1000 | alc_automute_pin(codec); |
| 1001 | break; |
| 1002 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1003 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1004 | break; |
| 1005 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | static void alc_inithook(struct hda_codec *codec) |
| 1009 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1010 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1011 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1012 | } |
| 1013 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1014 | /* additional initialization for ALC888 variants */ |
| 1015 | static void alc888_coef_init(struct hda_codec *codec) |
| 1016 | { |
| 1017 | unsigned int tmp; |
| 1018 | |
| 1019 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1020 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1021 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
Takashi Iwai | 37db623 | 2009-03-05 09:40:16 +0100 | [diff] [blame] | 1022 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1023 | /* alc888S-VC */ |
| 1024 | snd_hda_codec_read(codec, 0x20, 0, |
| 1025 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1026 | else |
| 1027 | /* alc888-VB */ |
| 1028 | snd_hda_codec_read(codec, 0x20, 0, |
| 1029 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1030 | } |
| 1031 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1032 | static void alc889_coef_init(struct hda_codec *codec) |
| 1033 | { |
| 1034 | unsigned int tmp; |
| 1035 | |
| 1036 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1037 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1038 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1039 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1040 | } |
| 1041 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1042 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1043 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1044 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1045 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1046 | switch (type) { |
| 1047 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1048 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1049 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1050 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1051 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1052 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1053 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1054 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1055 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1056 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1057 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1058 | case 0x10ec0260: |
| 1059 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1060 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1061 | snd_hda_codec_write(codec, 0x10, 0, |
| 1062 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1063 | break; |
| 1064 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1065 | case 0x10ec0267: |
| 1066 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1067 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1068 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1069 | case 0x10ec0660: |
| 1070 | case 0x10ec0662: |
| 1071 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1072 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1073 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1074 | snd_hda_codec_write(codec, 0x14, 0, |
| 1075 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1076 | snd_hda_codec_write(codec, 0x15, 0, |
| 1077 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1078 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1079 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1080 | switch (codec->vendor_id) { |
| 1081 | case 0x10ec0260: |
| 1082 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1083 | AC_VERB_SET_COEF_INDEX, 7); |
| 1084 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1085 | AC_VERB_GET_PROC_COEF, 0); |
| 1086 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1087 | AC_VERB_SET_COEF_INDEX, 7); |
| 1088 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1089 | AC_VERB_SET_PROC_COEF, |
| 1090 | tmp | 0x2010); |
| 1091 | break; |
| 1092 | case 0x10ec0262: |
| 1093 | case 0x10ec0880: |
| 1094 | case 0x10ec0882: |
| 1095 | case 0x10ec0883: |
| 1096 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1097 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1098 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1099 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1100 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1101 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1103 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1104 | case 0x10ec0267: |
| 1105 | case 0x10ec0268: |
| 1106 | snd_hda_codec_write(codec, 0x20, 0, |
| 1107 | AC_VERB_SET_COEF_INDEX, 7); |
| 1108 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1109 | AC_VERB_GET_PROC_COEF, 0); |
| 1110 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1111 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | snd_hda_codec_write(codec, 0x20, 0, |
| 1113 | AC_VERB_SET_PROC_COEF, |
| 1114 | tmp | 0x3000); |
| 1115 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1116 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1117 | break; |
| 1118 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1119 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1120 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1121 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1122 | { |
| 1123 | struct alc_spec *spec = codec->spec; |
| 1124 | |
| 1125 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1127 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1128 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1129 | if (spec->autocfg.line_out_pins[0] && |
| 1130 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1131 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1132 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1133 | else |
| 1134 | return; |
| 1135 | } |
| 1136 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1137 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1138 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1139 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1140 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1141 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1142 | spec->unsol_event = alc_sku_unsol_event; |
| 1143 | } |
| 1144 | |
| 1145 | /* check subsystem ID and set up device-specific initialization; |
| 1146 | * return 1 if initialized, 0 if invalid SSID |
| 1147 | */ |
| 1148 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1149 | * 31 ~ 16 : Manufacture ID |
| 1150 | * 15 ~ 8 : SKU ID |
| 1151 | * 7 ~ 0 : Assembly ID |
| 1152 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1153 | */ |
| 1154 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1155 | hda_nid_t porta, hda_nid_t porte, |
| 1156 | hda_nid_t portd) |
| 1157 | { |
| 1158 | unsigned int ass, tmp, i; |
| 1159 | unsigned nid; |
| 1160 | struct alc_spec *spec = codec->spec; |
| 1161 | |
| 1162 | ass = codec->subsystem_id & 0xffff; |
| 1163 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1164 | goto do_sku; |
| 1165 | |
| 1166 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1167 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1168 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1169 | * 29~21 : reserve |
| 1170 | * 20 : PCBEEP input |
| 1171 | * 19~16 : Check sum (15:1) |
| 1172 | * 15~1 : Custom |
| 1173 | * 0 : override |
| 1174 | */ |
| 1175 | nid = 0x1d; |
| 1176 | if (codec->vendor_id == 0x10ec0260) |
| 1177 | nid = 0x17; |
| 1178 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1179 | snd_printd("realtek: No valid SSID, " |
| 1180 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1181 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1182 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1183 | return 0; |
| 1184 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1185 | return 0; |
| 1186 | |
| 1187 | /* check sum */ |
| 1188 | tmp = 0; |
| 1189 | for (i = 1; i < 16; i++) { |
| 1190 | if ((ass >> i) & 1) |
| 1191 | tmp++; |
| 1192 | } |
| 1193 | if (((ass >> 16) & 0xf) != tmp) |
| 1194 | return 0; |
| 1195 | do_sku: |
| 1196 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1197 | ass & 0xffff, codec->vendor_id); |
| 1198 | /* |
| 1199 | * 0 : override |
| 1200 | * 1 : Swap Jack |
| 1201 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1202 | * 3~5 : External Amplifier control |
| 1203 | * 7~6 : Reserved |
| 1204 | */ |
| 1205 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1206 | switch (tmp) { |
| 1207 | case 1: |
| 1208 | spec->init_amp = ALC_INIT_GPIO1; |
| 1209 | break; |
| 1210 | case 3: |
| 1211 | spec->init_amp = ALC_INIT_GPIO2; |
| 1212 | break; |
| 1213 | case 7: |
| 1214 | spec->init_amp = ALC_INIT_GPIO3; |
| 1215 | break; |
| 1216 | case 5: |
| 1217 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1218 | break; |
| 1219 | } |
| 1220 | |
| 1221 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1222 | * when the external headphone out jack is plugged" |
| 1223 | */ |
| 1224 | if (!(ass & 0x8000)) |
| 1225 | return 1; |
| 1226 | /* |
| 1227 | * 10~8 : Jack location |
| 1228 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1229 | * 14~13: Resvered |
| 1230 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1231 | * when the external headphone out jack is plugged" |
| 1232 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1233 | if (!spec->autocfg.hp_pins[0]) { |
| 1234 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1235 | if (tmp == 0) |
| 1236 | spec->autocfg.hp_pins[0] = porta; |
| 1237 | else if (tmp == 1) |
| 1238 | spec->autocfg.hp_pins[0] = porte; |
| 1239 | else if (tmp == 2) |
| 1240 | spec->autocfg.hp_pins[0] = portd; |
| 1241 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1242 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1243 | } |
| 1244 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1245 | alc_init_auto_hp(codec); |
| 1246 | return 1; |
| 1247 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1248 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1249 | static void alc_ssid_check(struct hda_codec *codec, |
| 1250 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1251 | { |
| 1252 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1253 | struct alc_spec *spec = codec->spec; |
| 1254 | snd_printd("realtek: " |
| 1255 | "Enable default setup for auto mode as fallback\n"); |
| 1256 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1257 | alc_init_auto_hp(codec); |
| 1258 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1259 | } |
| 1260 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1261 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1262 | * Fix-up pin default configurations |
| 1263 | */ |
| 1264 | |
| 1265 | struct alc_pincfg { |
| 1266 | hda_nid_t nid; |
| 1267 | u32 val; |
| 1268 | }; |
| 1269 | |
| 1270 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1271 | const struct snd_pci_quirk *quirk, |
| 1272 | const struct alc_pincfg **pinfix) |
| 1273 | { |
| 1274 | const struct alc_pincfg *cfg; |
| 1275 | |
| 1276 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1277 | if (!quirk) |
| 1278 | return; |
| 1279 | |
| 1280 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1281 | for (; cfg->nid; cfg++) |
| 1282 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1283 | } |
| 1284 | |
| 1285 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1286 | * ALC888 |
| 1287 | */ |
| 1288 | |
| 1289 | /* |
| 1290 | * 2ch mode |
| 1291 | */ |
| 1292 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1293 | /* Mic-in jack as mic in */ |
| 1294 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1295 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1296 | /* Line-in jack as Line in */ |
| 1297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1299 | /* Line-Out as Front */ |
| 1300 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1301 | { } /* end */ |
| 1302 | }; |
| 1303 | |
| 1304 | /* |
| 1305 | * 4ch mode |
| 1306 | */ |
| 1307 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1308 | /* Mic-in jack as mic in */ |
| 1309 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1310 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1311 | /* Line-in jack as Surround */ |
| 1312 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1313 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1314 | /* Line-Out as Front */ |
| 1315 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1316 | { } /* end */ |
| 1317 | }; |
| 1318 | |
| 1319 | /* |
| 1320 | * 6ch mode |
| 1321 | */ |
| 1322 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1323 | /* Mic-in jack as CLFE */ |
| 1324 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1325 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1326 | /* Line-in jack as Surround */ |
| 1327 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1328 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1329 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1330 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1331 | { } /* end */ |
| 1332 | }; |
| 1333 | |
| 1334 | /* |
| 1335 | * 8ch mode |
| 1336 | */ |
| 1337 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1338 | /* Mic-in jack as CLFE */ |
| 1339 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1340 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1341 | /* Line-in jack as Surround */ |
| 1342 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1343 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1344 | /* Line-Out as Side */ |
| 1345 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1346 | { } /* end */ |
| 1347 | }; |
| 1348 | |
| 1349 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1350 | { 2, alc888_4ST_ch2_intel_init }, |
| 1351 | { 4, alc888_4ST_ch4_intel_init }, |
| 1352 | { 6, alc888_4ST_ch6_intel_init }, |
| 1353 | { 8, alc888_4ST_ch8_intel_init }, |
| 1354 | }; |
| 1355 | |
| 1356 | /* |
| 1357 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1358 | */ |
| 1359 | |
| 1360 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1361 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1362 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1363 | /* Connect Internal HP to Front */ |
| 1364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1365 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1366 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1367 | /* Connect Bass HP to Front */ |
| 1368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1371 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1372 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1373 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1374 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1375 | /* Connect Mic jack to CLFE */ |
| 1376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1378 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1379 | /* Connect Line-in jack to Surround */ |
| 1380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1382 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1383 | /* Connect HP out jack to Front */ |
| 1384 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1385 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1386 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1387 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1388 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1389 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1390 | {} |
| 1391 | }; |
| 1392 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1393 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1394 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1395 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1396 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1397 | hda_nid_t nid; |
| 1398 | int i; |
| 1399 | |
| 1400 | spec->jack_present = 0; |
| 1401 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1402 | nid = spec->autocfg.hp_pins[i]; |
| 1403 | if (!nid) |
| 1404 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1405 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1406 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1407 | snd_hda_codec_read(codec, nid, 0, |
| 1408 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1409 | val = snd_hda_codec_read(codec, nid, 0, |
| 1410 | AC_VERB_GET_PIN_SENSE, 0); |
| 1411 | if (val & AC_PINSENSE_PRESENCE) { |
| 1412 | spec->jack_present = 1; |
| 1413 | break; |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1418 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1419 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1420 | nid = spec->autocfg.speaker_pins[i]; |
| 1421 | if (!nid) |
| 1422 | break; |
| 1423 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1424 | HDA_AMP_MUTE, mute); |
| 1425 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1426 | } |
| 1427 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1428 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1429 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1430 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1431 | if (codec->vendor_id == 0x10ec0880) |
| 1432 | res >>= 28; |
| 1433 | else |
| 1434 | res >>= 26; |
| 1435 | if (res == ALC880_HP_EVENT) |
| 1436 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1437 | } |
| 1438 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1439 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1440 | { |
| 1441 | struct alc_spec *spec = codec->spec; |
| 1442 | |
| 1443 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1444 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1445 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1446 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1447 | alc_automute_amp(codec); |
| 1448 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1449 | |
| 1450 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1451 | * ALC888 Acer Aspire 4930G model |
| 1452 | */ |
| 1453 | |
| 1454 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1455 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1456 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1457 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1459 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1460 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1461 | /* Connect Internal HP to front */ |
| 1462 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1464 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1465 | /* Connect HP out to front */ |
| 1466 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1467 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1468 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1469 | { } |
| 1470 | }; |
| 1471 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1472 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1473 | * ALC888 Acer Aspire 6530G model |
| 1474 | */ |
| 1475 | |
| 1476 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1477 | /* Bias voltage on for external mic port */ |
| 1478 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1479 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1480 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1481 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1483 | /* Enable unsolicited event for HP jack */ |
| 1484 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1485 | /* Enable speaker output */ |
| 1486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1488 | /* Enable headphone output */ |
| 1489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1491 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1492 | { } |
| 1493 | }; |
| 1494 | |
| 1495 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1496 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1497 | */ |
| 1498 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1499 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1500 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1501 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1502 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1504 | /* Enable unsolicited event for HP jack */ |
| 1505 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1506 | /* Connect Internal Front to Front */ |
| 1507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1509 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1510 | /* Connect Internal Rear to Rear */ |
| 1511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1513 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1514 | /* Connect Internal CLFE to CLFE */ |
| 1515 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1516 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1517 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1518 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1522 | /* Enable all DACs */ |
| 1523 | /* DAC DISABLE/MUTE 1? */ |
| 1524 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1525 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1526 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1527 | /* DAC DISABLE/MUTE 2? */ |
| 1528 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1529 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1530 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1531 | /* Enable amplifiers */ |
| 1532 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1533 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1534 | /* DMIC fix |
| 1535 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1536 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1537 | * makes the signal become a difference/sum signal instead of standard |
| 1538 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1539 | * codec replicate the sum signal to both channels, turning it into a |
| 1540 | * normal mono mic. |
| 1541 | */ |
| 1542 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1543 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1544 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1545 | { } |
| 1546 | }; |
| 1547 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1548 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1549 | /* Front mic only available on one ADC */ |
| 1550 | { |
| 1551 | .num_items = 4, |
| 1552 | .items = { |
| 1553 | { "Mic", 0x0 }, |
| 1554 | { "Line", 0x2 }, |
| 1555 | { "CD", 0x4 }, |
| 1556 | { "Front Mic", 0xb }, |
| 1557 | }, |
| 1558 | }, |
| 1559 | { |
| 1560 | .num_items = 3, |
| 1561 | .items = { |
| 1562 | { "Mic", 0x0 }, |
| 1563 | { "Line", 0x2 }, |
| 1564 | { "CD", 0x4 }, |
| 1565 | }, |
| 1566 | } |
| 1567 | }; |
| 1568 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1569 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1570 | /* Interal mic only available on one ADC */ |
| 1571 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1572 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1573 | .items = { |
| 1574 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1575 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1576 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1577 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1578 | { "Int Mic", 0xb }, |
| 1579 | }, |
| 1580 | }, |
| 1581 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1582 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1583 | .items = { |
| 1584 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1585 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1586 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1587 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1588 | }, |
| 1589 | } |
| 1590 | }; |
| 1591 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1592 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1593 | /* Digital mic only available on first "ADC" */ |
| 1594 | { |
| 1595 | .num_items = 5, |
| 1596 | .items = { |
| 1597 | { "Mic", 0x0 }, |
| 1598 | { "Line", 0x2 }, |
| 1599 | { "CD", 0x4 }, |
| 1600 | { "Front Mic", 0xb }, |
| 1601 | { "Input Mix", 0xa }, |
| 1602 | }, |
| 1603 | }, |
| 1604 | { |
| 1605 | .num_items = 4, |
| 1606 | .items = { |
| 1607 | { "Mic", 0x0 }, |
| 1608 | { "Line", 0x2 }, |
| 1609 | { "CD", 0x4 }, |
| 1610 | { "Input Mix", 0xa }, |
| 1611 | }, |
| 1612 | }, |
| 1613 | { |
| 1614 | .num_items = 4, |
| 1615 | .items = { |
| 1616 | { "Mic", 0x0 }, |
| 1617 | { "Line", 0x2 }, |
| 1618 | { "CD", 0x4 }, |
| 1619 | { "Input Mix", 0xa }, |
| 1620 | }, |
| 1621 | } |
| 1622 | }; |
| 1623 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1624 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1625 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1626 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1627 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1628 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1629 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1630 | HDA_OUTPUT), |
| 1631 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1632 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1633 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1634 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1635 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1638 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1639 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1641 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1643 | { } /* end */ |
| 1644 | }; |
| 1645 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1646 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1647 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1648 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1649 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1650 | spec->autocfg.hp_pins[0] = 0x15; |
| 1651 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1652 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1653 | } |
| 1654 | |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1655 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) |
| 1656 | { |
| 1657 | struct alc_spec *spec = codec->spec; |
| 1658 | |
| 1659 | spec->autocfg.hp_pins[0] = 0x15; |
| 1660 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1661 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1662 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1663 | alc_automute_amp(codec); |
| 1664 | } |
| 1665 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1666 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1667 | { |
| 1668 | struct alc_spec *spec = codec->spec; |
| 1669 | |
| 1670 | spec->autocfg.hp_pins[0] = 0x15; |
| 1671 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1672 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1673 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1674 | alc_automute_amp(codec); |
| 1675 | } |
| 1676 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1677 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1678 | * ALC880 3-stack model |
| 1679 | * |
| 1680 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1681 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1682 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1683 | */ |
| 1684 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1685 | static hda_nid_t alc880_dac_nids[4] = { |
| 1686 | /* front, rear, clfe, rear_surr */ |
| 1687 | 0x02, 0x05, 0x04, 0x03 |
| 1688 | }; |
| 1689 | |
| 1690 | static hda_nid_t alc880_adc_nids[3] = { |
| 1691 | /* ADC0-2 */ |
| 1692 | 0x07, 0x08, 0x09, |
| 1693 | }; |
| 1694 | |
| 1695 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1696 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1697 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1698 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1699 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1700 | /* ADC1-2 */ |
| 1701 | 0x08, 0x09, |
| 1702 | }; |
| 1703 | |
| 1704 | #define ALC880_DIGOUT_NID 0x06 |
| 1705 | #define ALC880_DIGIN_NID 0x0a |
| 1706 | |
| 1707 | static struct hda_input_mux alc880_capture_source = { |
| 1708 | .num_items = 4, |
| 1709 | .items = { |
| 1710 | { "Mic", 0x0 }, |
| 1711 | { "Front Mic", 0x3 }, |
| 1712 | { "Line", 0x2 }, |
| 1713 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1714 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1715 | }; |
| 1716 | |
| 1717 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1718 | /* 2ch mode */ |
| 1719 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1720 | /* set line-in to input, mute it */ |
| 1721 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1722 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1723 | /* set mic-in to input vref 80%, mute it */ |
| 1724 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1725 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1726 | { } /* end */ |
| 1727 | }; |
| 1728 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1729 | /* 6ch mode */ |
| 1730 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1731 | /* set line-in to output, unmute it */ |
| 1732 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1733 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1734 | /* set mic-in to output, unmute it */ |
| 1735 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1736 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1737 | { } /* end */ |
| 1738 | }; |
| 1739 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1740 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1741 | { 2, alc880_threestack_ch2_init }, |
| 1742 | { 6, alc880_threestack_ch6_init }, |
| 1743 | }; |
| 1744 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1745 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1746 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1747 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1748 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1749 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1750 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1751 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1752 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1753 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1760 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1761 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1763 | { |
| 1764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1765 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1766 | .info = alc_ch_mode_info, |
| 1767 | .get = alc_ch_mode_get, |
| 1768 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1769 | }, |
| 1770 | { } /* end */ |
| 1771 | }; |
| 1772 | |
| 1773 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1774 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1775 | struct snd_ctl_elem_info *uinfo) |
| 1776 | { |
| 1777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1778 | struct alc_spec *spec = codec->spec; |
| 1779 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1780 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1781 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1782 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1783 | HDA_INPUT); |
| 1784 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1785 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1786 | return err; |
| 1787 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1788 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1789 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1790 | unsigned int size, unsigned int __user *tlv) |
| 1791 | { |
| 1792 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1793 | struct alc_spec *spec = codec->spec; |
| 1794 | int err; |
| 1795 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1796 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1797 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1798 | HDA_INPUT); |
| 1799 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1800 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1801 | return err; |
| 1802 | } |
| 1803 | |
| 1804 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1805 | struct snd_ctl_elem_value *ucontrol); |
| 1806 | |
| 1807 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1808 | struct snd_ctl_elem_value *ucontrol, |
| 1809 | getput_call_t func) |
| 1810 | { |
| 1811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1812 | struct alc_spec *spec = codec->spec; |
| 1813 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1814 | int err; |
| 1815 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1816 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1817 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1818 | 3, 0, HDA_INPUT); |
| 1819 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1820 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1821 | return err; |
| 1822 | } |
| 1823 | |
| 1824 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1825 | struct snd_ctl_elem_value *ucontrol) |
| 1826 | { |
| 1827 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1828 | snd_hda_mixer_amp_volume_get); |
| 1829 | } |
| 1830 | |
| 1831 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1832 | struct snd_ctl_elem_value *ucontrol) |
| 1833 | { |
| 1834 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1835 | snd_hda_mixer_amp_volume_put); |
| 1836 | } |
| 1837 | |
| 1838 | /* capture mixer elements */ |
| 1839 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1840 | |
| 1841 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1842 | struct snd_ctl_elem_value *ucontrol) |
| 1843 | { |
| 1844 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1845 | snd_hda_mixer_amp_switch_get); |
| 1846 | } |
| 1847 | |
| 1848 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1849 | struct snd_ctl_elem_value *ucontrol) |
| 1850 | { |
| 1851 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1852 | snd_hda_mixer_amp_switch_put); |
| 1853 | } |
| 1854 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1855 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1856 | { \ |
| 1857 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1858 | .name = "Capture Switch", \ |
| 1859 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1860 | .count = num, \ |
| 1861 | .info = alc_cap_sw_info, \ |
| 1862 | .get = alc_cap_sw_get, \ |
| 1863 | .put = alc_cap_sw_put, \ |
| 1864 | }, \ |
| 1865 | { \ |
| 1866 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1867 | .name = "Capture Volume", \ |
| 1868 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1869 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1870 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1871 | .count = num, \ |
| 1872 | .info = alc_cap_vol_info, \ |
| 1873 | .get = alc_cap_vol_get, \ |
| 1874 | .put = alc_cap_vol_put, \ |
| 1875 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1876 | } |
| 1877 | |
| 1878 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1879 | { \ |
| 1880 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1881 | /* .name = "Capture Source", */ \ |
| 1882 | .name = "Input Source", \ |
| 1883 | .count = num, \ |
| 1884 | .info = alc_mux_enum_info, \ |
| 1885 | .get = alc_mux_enum_get, \ |
| 1886 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1887 | } |
| 1888 | |
| 1889 | #define DEFINE_CAPMIX(num) \ |
| 1890 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1891 | _DEFINE_CAPMIX(num), \ |
| 1892 | _DEFINE_CAPSRC(num), \ |
| 1893 | { } /* end */ \ |
| 1894 | } |
| 1895 | |
| 1896 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1897 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1898 | _DEFINE_CAPMIX(num), \ |
| 1899 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1900 | } |
| 1901 | |
| 1902 | /* up to three ADCs */ |
| 1903 | DEFINE_CAPMIX(1); |
| 1904 | DEFINE_CAPMIX(2); |
| 1905 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1906 | DEFINE_CAPMIX_NOSRC(1); |
| 1907 | DEFINE_CAPMIX_NOSRC(2); |
| 1908 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1909 | |
| 1910 | /* |
| 1911 | * ALC880 5-stack model |
| 1912 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1913 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1914 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1915 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1916 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1917 | */ |
| 1918 | |
| 1919 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1920 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1921 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1922 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1923 | { } /* end */ |
| 1924 | }; |
| 1925 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1926 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1927 | /* 6ch mode */ |
| 1928 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1929 | /* set line-in to input, mute it */ |
| 1930 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1931 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1932 | { } /* end */ |
| 1933 | }; |
| 1934 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1935 | /* 8ch mode */ |
| 1936 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1937 | /* set line-in to output, unmute it */ |
| 1938 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1939 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1940 | { } /* end */ |
| 1941 | }; |
| 1942 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1943 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1944 | { 6, alc880_fivestack_ch6_init }, |
| 1945 | { 8, alc880_fivestack_ch8_init }, |
| 1946 | }; |
| 1947 | |
| 1948 | |
| 1949 | /* |
| 1950 | * ALC880 6-stack model |
| 1951 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1952 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1953 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1954 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1955 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1956 | */ |
| 1957 | |
| 1958 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1959 | /* front, rear, clfe, rear_surr */ |
| 1960 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1961 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1962 | |
| 1963 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1964 | .num_items = 4, |
| 1965 | .items = { |
| 1966 | { "Mic", 0x0 }, |
| 1967 | { "Front Mic", 0x1 }, |
| 1968 | { "Line", 0x2 }, |
| 1969 | { "CD", 0x4 }, |
| 1970 | }, |
| 1971 | }; |
| 1972 | |
| 1973 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1974 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1975 | { 8, NULL }, |
| 1976 | }; |
| 1977 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1978 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1981 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1982 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1983 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1984 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1985 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1986 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1987 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1988 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1989 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1990 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1992 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1997 | { |
| 1998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1999 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2000 | .info = alc_ch_mode_info, |
| 2001 | .get = alc_ch_mode_get, |
| 2002 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2003 | }, |
| 2004 | { } /* end */ |
| 2005 | }; |
| 2006 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2007 | |
| 2008 | /* |
| 2009 | * ALC880 W810 model |
| 2010 | * |
| 2011 | * W810 has rear IO for: |
| 2012 | * Front (DAC 02) |
| 2013 | * Surround (DAC 03) |
| 2014 | * Center/LFE (DAC 04) |
| 2015 | * Digital out (06) |
| 2016 | * |
| 2017 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2018 | * 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] | 2019 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2020 | * There is a variable resistor to control the speaker or headphone |
| 2021 | * volume. This is a hardware-only device without a software API. |
| 2022 | * |
| 2023 | * Plugging headphones in will disable the internal speakers. This is |
| 2024 | * implemented in hardware, not via the driver using jack sense. In |
| 2025 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2026 | * disable both the speakers and headphones. |
| 2027 | * |
| 2028 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2029 | * These may not do anything useful with this driver yet, because I |
| 2030 | * haven't setup any initialization verbs for these yet... |
| 2031 | */ |
| 2032 | |
| 2033 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2034 | /* front, rear/surround, clfe */ |
| 2035 | 0x02, 0x03, 0x04 |
| 2036 | }; |
| 2037 | |
| 2038 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2039 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2040 | { 6, NULL } |
| 2041 | }; |
| 2042 | |
| 2043 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2044 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2046 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2047 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2048 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2049 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2050 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2051 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2052 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2054 | { } /* end */ |
| 2055 | }; |
| 2056 | |
| 2057 | |
| 2058 | /* |
| 2059 | * Z710V model |
| 2060 | * |
| 2061 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2062 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2063 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2064 | */ |
| 2065 | |
| 2066 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2067 | 0x02 |
| 2068 | }; |
| 2069 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2070 | |
| 2071 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2072 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2073 | { 2, NULL } |
| 2074 | }; |
| 2075 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2076 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2077 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2078 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2079 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2080 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2081 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2082 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2084 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2085 | { } /* end */ |
| 2086 | }; |
| 2087 | |
| 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* |
| 2090 | * ALC880 F1734 model |
| 2091 | * |
| 2092 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2093 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2094 | */ |
| 2095 | |
| 2096 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2097 | 0x03 |
| 2098 | }; |
| 2099 | #define ALC880_F1734_HP_DAC 0x02 |
| 2100 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2101 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2103 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2105 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2110 | { } /* end */ |
| 2111 | }; |
| 2112 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2113 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2114 | .num_items = 2, |
| 2115 | .items = { |
| 2116 | { "Mic", 0x1 }, |
| 2117 | { "CD", 0x4 }, |
| 2118 | }, |
| 2119 | }; |
| 2120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2122 | /* |
| 2123 | * ALC880 ASUS model |
| 2124 | * |
| 2125 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2126 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2127 | * Mic = 0x18, Line = 0x1a |
| 2128 | */ |
| 2129 | |
| 2130 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2131 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2132 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2133 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2135 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2136 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2137 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2138 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2139 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2140 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2141 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2142 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2143 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2144 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2145 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2146 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2148 | { |
| 2149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2150 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2151 | .info = alc_ch_mode_info, |
| 2152 | .get = alc_ch_mode_get, |
| 2153 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2154 | }, |
| 2155 | { } /* end */ |
| 2156 | }; |
| 2157 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2158 | /* |
| 2159 | * ALC880 ASUS W1V model |
| 2160 | * |
| 2161 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2162 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2163 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2164 | */ |
| 2165 | |
| 2166 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2167 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2168 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2169 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2170 | { } /* end */ |
| 2171 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2173 | /* TCL S700 */ |
| 2174 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2175 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2176 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2178 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2179 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2181 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2182 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2183 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2184 | { } /* end */ |
| 2185 | }; |
| 2186 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2187 | /* Uniwill */ |
| 2188 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2189 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2190 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2192 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2193 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2194 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2195 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2196 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2197 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2201 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2202 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2203 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2204 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2205 | { |
| 2206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2207 | .name = "Channel Mode", |
| 2208 | .info = alc_ch_mode_info, |
| 2209 | .get = alc_ch_mode_get, |
| 2210 | .put = alc_ch_mode_put, |
| 2211 | }, |
| 2212 | { } /* end */ |
| 2213 | }; |
| 2214 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2215 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2216 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2217 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2218 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2219 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2220 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2223 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2224 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2225 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2226 | { } /* end */ |
| 2227 | }; |
| 2228 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2229 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2230 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2231 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2232 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2233 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2236 | { } /* end */ |
| 2237 | }; |
| 2238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2240 | * virtual master controls |
| 2241 | */ |
| 2242 | |
| 2243 | /* |
| 2244 | * slave controls for virtual master |
| 2245 | */ |
| 2246 | static const char *alc_slave_vols[] = { |
| 2247 | "Front Playback Volume", |
| 2248 | "Surround Playback Volume", |
| 2249 | "Center Playback Volume", |
| 2250 | "LFE Playback Volume", |
| 2251 | "Side Playback Volume", |
| 2252 | "Headphone Playback Volume", |
| 2253 | "Speaker Playback Volume", |
| 2254 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2255 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2256 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2257 | NULL, |
| 2258 | }; |
| 2259 | |
| 2260 | static const char *alc_slave_sws[] = { |
| 2261 | "Front Playback Switch", |
| 2262 | "Surround Playback Switch", |
| 2263 | "Center Playback Switch", |
| 2264 | "LFE Playback Switch", |
| 2265 | "Side Playback Switch", |
| 2266 | "Headphone Playback Switch", |
| 2267 | "Speaker Playback Switch", |
| 2268 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2269 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2270 | NULL, |
| 2271 | }; |
| 2272 | |
| 2273 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2274 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2275 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2276 | |
| 2277 | static void alc_free_kctls(struct hda_codec *codec); |
| 2278 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2279 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2280 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2281 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2282 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2283 | { } /* end */ |
| 2284 | }; |
| 2285 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2286 | static int alc_build_controls(struct hda_codec *codec) |
| 2287 | { |
| 2288 | struct alc_spec *spec = codec->spec; |
| 2289 | int err; |
| 2290 | int i; |
| 2291 | |
| 2292 | for (i = 0; i < spec->num_mixers; i++) { |
| 2293 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2294 | if (err < 0) |
| 2295 | return err; |
| 2296 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2297 | if (spec->cap_mixer) { |
| 2298 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2299 | if (err < 0) |
| 2300 | return err; |
| 2301 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2302 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2303 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2304 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | if (err < 0) |
| 2306 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2307 | if (!spec->no_analog) { |
| 2308 | err = snd_hda_create_spdif_share_sw(codec, |
| 2309 | &spec->multiout); |
| 2310 | if (err < 0) |
| 2311 | return err; |
| 2312 | spec->multiout.share_spdif = 1; |
| 2313 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2314 | } |
| 2315 | if (spec->dig_in_nid) { |
| 2316 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2317 | if (err < 0) |
| 2318 | return err; |
| 2319 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2320 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2321 | /* create beep controls if needed */ |
| 2322 | if (spec->beep_amp) { |
| 2323 | struct snd_kcontrol_new *knew; |
| 2324 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2325 | struct snd_kcontrol *kctl; |
| 2326 | kctl = snd_ctl_new1(knew, codec); |
| 2327 | if (!kctl) |
| 2328 | return -ENOMEM; |
| 2329 | kctl->private_value = spec->beep_amp; |
| 2330 | err = snd_hda_ctl_add(codec, kctl); |
| 2331 | if (err < 0) |
| 2332 | return err; |
| 2333 | } |
| 2334 | } |
| 2335 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2336 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2337 | if (!spec->no_analog && |
| 2338 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2339 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2340 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2341 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2342 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2343 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2344 | if (err < 0) |
| 2345 | return err; |
| 2346 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2347 | if (!spec->no_analog && |
| 2348 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2349 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2350 | NULL, alc_slave_sws); |
| 2351 | if (err < 0) |
| 2352 | return err; |
| 2353 | } |
| 2354 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2355 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | return 0; |
| 2357 | } |
| 2358 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2359 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2360 | /* |
| 2361 | * initialize the codec volumes, etc |
| 2362 | */ |
| 2363 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2364 | /* |
| 2365 | * generic initialization of ADC, input mixers and output mixers |
| 2366 | */ |
| 2367 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2368 | /* |
| 2369 | * Unmute ADC0-2 and set the default input to mic-in |
| 2370 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2371 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2373 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2375 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2378 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2379 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2380 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2381 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2382 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2383 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2384 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2385 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2392 | /* |
| 2393 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2394 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2395 | /* set vol=0 to output mixers */ |
| 2396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2400 | /* set up input amps for analog loopback */ |
| 2401 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2404 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2405 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2406 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2407 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2408 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2409 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | |
| 2411 | { } |
| 2412 | }; |
| 2413 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2414 | /* |
| 2415 | * 3-stack pin configuration: |
| 2416 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2417 | */ |
| 2418 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2419 | /* |
| 2420 | * preset connection lists of input pins |
| 2421 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2422 | */ |
| 2423 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2424 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2425 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2426 | |
| 2427 | /* |
| 2428 | * Set pin mode and muting |
| 2429 | */ |
| 2430 | /* set front pin widgets 0x14 for output */ |
| 2431 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2432 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2433 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2434 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2435 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2436 | /* Mic2 (as headphone out) for HP output */ |
| 2437 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2438 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2439 | /* Line In pin widget for input */ |
| 2440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2441 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2442 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2445 | /* CD pin widget for input */ |
| 2446 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2447 | |
| 2448 | { } |
| 2449 | }; |
| 2450 | |
| 2451 | /* |
| 2452 | * 5-stack pin configuration: |
| 2453 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2454 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2455 | */ |
| 2456 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2457 | /* |
| 2458 | * preset connection lists of input pins |
| 2459 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2460 | */ |
| 2461 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2462 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2463 | |
| 2464 | /* |
| 2465 | * Set pin mode and muting |
| 2466 | */ |
| 2467 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2468 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2471 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2472 | /* unmute pins for output (no gain on this amp) */ |
| 2473 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2474 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2475 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2476 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2478 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2479 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2480 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2481 | /* Mic2 (as headphone out) for HP output */ |
| 2482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2483 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2484 | /* Line In pin widget for input */ |
| 2485 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2486 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2487 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2488 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2489 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2490 | /* CD pin widget for input */ |
| 2491 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | |
| 2493 | { } |
| 2494 | }; |
| 2495 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2496 | /* |
| 2497 | * W810 pin configuration: |
| 2498 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2499 | */ |
| 2500 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2501 | /* hphone/speaker input selector: front DAC */ |
| 2502 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2503 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2506 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2507 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2508 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2509 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2510 | |
| 2511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2514 | { } |
| 2515 | }; |
| 2516 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2517 | /* |
| 2518 | * Z71V pin configuration: |
| 2519 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2520 | */ |
| 2521 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2525 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2526 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2527 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2528 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2530 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2531 | |
| 2532 | { } |
| 2533 | }; |
| 2534 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2535 | /* |
| 2536 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2537 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2538 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2539 | */ |
| 2540 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2541 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2542 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2543 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2547 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2548 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2549 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2550 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2551 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2552 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2553 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2554 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2555 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2556 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2557 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2559 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2560 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2561 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2562 | { } |
| 2563 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2564 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2565 | /* |
| 2566 | * Uniwill pin configuration: |
| 2567 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2568 | * line = 0x1a |
| 2569 | */ |
| 2570 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2571 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2572 | |
| 2573 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2574 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2577 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2579 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2580 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2585 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2586 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2587 | |
| 2588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2589 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2590 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2592 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2593 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2594 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2595 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2596 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2597 | |
| 2598 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2599 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2600 | |
| 2601 | { } |
| 2602 | }; |
| 2603 | |
| 2604 | /* |
| 2605 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2606 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2607 | */ |
| 2608 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2609 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2610 | |
| 2611 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2612 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2614 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2615 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2616 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2623 | |
| 2624 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2626 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2627 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2629 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2630 | |
| 2631 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2632 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2633 | |
| 2634 | { } |
| 2635 | }; |
| 2636 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2637 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2638 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2639 | { } |
| 2640 | }; |
| 2641 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2642 | /* auto-toggle front mic */ |
| 2643 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2644 | { |
| 2645 | unsigned int present; |
| 2646 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2647 | |
| 2648 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2649 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2650 | bits = present ? HDA_AMP_MUTE : 0; |
| 2651 | 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] | 2652 | } |
| 2653 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2654 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2655 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2656 | struct alc_spec *spec = codec->spec; |
| 2657 | |
| 2658 | spec->autocfg.hp_pins[0] = 0x14; |
| 2659 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2660 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2661 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2662 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2663 | } |
| 2664 | |
| 2665 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2666 | unsigned int res) |
| 2667 | { |
| 2668 | /* Looks like the unsol event is incompatible with the standard |
| 2669 | * definition. 4bit tag is placed at 28 bit! |
| 2670 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2671 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2672 | case ALC880_MIC_EVENT: |
| 2673 | alc880_uniwill_mic_automute(codec); |
| 2674 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2675 | default: |
| 2676 | alc_automute_amp_unsol_event(codec, res); |
| 2677 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2678 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2679 | } |
| 2680 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2681 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2682 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2683 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2684 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2685 | spec->autocfg.hp_pins[0] = 0x14; |
| 2686 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2687 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2688 | } |
| 2689 | |
| 2690 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2691 | { |
| 2692 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2693 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2694 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2695 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2696 | present &= HDA_AMP_VOLMASK; |
| 2697 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2698 | HDA_AMP_VOLMASK, present); |
| 2699 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2700 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2701 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2702 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2703 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2704 | unsigned int res) |
| 2705 | { |
| 2706 | /* Looks like the unsol event is incompatible with the standard |
| 2707 | * definition. 4bit tag is placed at 28 bit! |
| 2708 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2709 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2710 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2711 | else |
| 2712 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2713 | } |
| 2714 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2715 | /* |
| 2716 | * F1734 pin configuration: |
| 2717 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2718 | */ |
| 2719 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2720 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2721 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2722 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2723 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2724 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 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_OUT}, |
| 2729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2730 | |
| 2731 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2733 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2734 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2735 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2737 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2738 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2739 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2740 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2741 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2742 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2743 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2744 | { } |
| 2745 | }; |
| 2746 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | /* |
| 2748 | * ASUS pin configuration: |
| 2749 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2750 | */ |
| 2751 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2752 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2753 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2754 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2755 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2756 | |
| 2757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2759 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2761 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2762 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2763 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2764 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2765 | |
| 2766 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2768 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2770 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2771 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2772 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2773 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2774 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2775 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2776 | { } |
| 2777 | }; |
| 2778 | |
| 2779 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2780 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2781 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2782 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2784 | /* Clevo m520g init */ |
| 2785 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2786 | /* headphone output */ |
| 2787 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2788 | /* line-out */ |
| 2789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2790 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2791 | /* Line-in */ |
| 2792 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2793 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2794 | /* CD */ |
| 2795 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2796 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2797 | /* Mic1 (rear panel) */ |
| 2798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2800 | /* Mic2 (front panel) */ |
| 2801 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2802 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2803 | /* headphone */ |
| 2804 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2805 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2806 | /* change to EAPD mode */ |
| 2807 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2808 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2809 | |
| 2810 | { } |
| 2811 | }; |
| 2812 | |
| 2813 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2814 | /* change to EAPD mode */ |
| 2815 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2816 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2818 | /* Headphone output */ |
| 2819 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2820 | /* Front output*/ |
| 2821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2822 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2823 | |
| 2824 | /* Line In pin widget for input */ |
| 2825 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2826 | /* CD pin widget for input */ |
| 2827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2828 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2830 | |
| 2831 | /* change to EAPD mode */ |
| 2832 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2833 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2834 | |
| 2835 | { } |
| 2836 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2837 | |
| 2838 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2839 | * LG m1 express dual |
| 2840 | * |
| 2841 | * Pin assignment: |
| 2842 | * Rear Line-In/Out (blue): 0x14 |
| 2843 | * Build-in Mic-In: 0x15 |
| 2844 | * Speaker-out: 0x17 |
| 2845 | * HP-Out (green): 0x1b |
| 2846 | * Mic-In/Out (red): 0x19 |
| 2847 | * SPDIF-Out: 0x1e |
| 2848 | */ |
| 2849 | |
| 2850 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2851 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2852 | 0x05, 0x02, 0x03 |
| 2853 | }; |
| 2854 | |
| 2855 | /* seems analog CD is not working */ |
| 2856 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2857 | .num_items = 3, |
| 2858 | .items = { |
| 2859 | { "Mic", 0x1 }, |
| 2860 | { "Line", 0x5 }, |
| 2861 | { "Internal Mic", 0x6 }, |
| 2862 | }, |
| 2863 | }; |
| 2864 | |
| 2865 | /* 2,4,6 channel modes */ |
| 2866 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2867 | /* set line-in and mic-in to input */ |
| 2868 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2869 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2870 | { } |
| 2871 | }; |
| 2872 | |
| 2873 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2874 | /* set line-in to out and mic-in to input */ |
| 2875 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2876 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2877 | { } |
| 2878 | }; |
| 2879 | |
| 2880 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2881 | /* set line-in and mic-in to output */ |
| 2882 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2883 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2884 | { } |
| 2885 | }; |
| 2886 | |
| 2887 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2888 | { 2, alc880_lg_ch2_init }, |
| 2889 | { 4, alc880_lg_ch4_init }, |
| 2890 | { 6, alc880_lg_ch6_init }, |
| 2891 | }; |
| 2892 | |
| 2893 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2894 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2895 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2896 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2897 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2898 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2899 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2900 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2901 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2904 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2905 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2906 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2907 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2908 | { |
| 2909 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2910 | .name = "Channel Mode", |
| 2911 | .info = alc_ch_mode_info, |
| 2912 | .get = alc_ch_mode_get, |
| 2913 | .put = alc_ch_mode_put, |
| 2914 | }, |
| 2915 | { } /* end */ |
| 2916 | }; |
| 2917 | |
| 2918 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2919 | /* set capture source to mic-in */ |
| 2920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2921 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2923 | /* mute all amp mixer inputs */ |
| 2924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2927 | /* line-in to input */ |
| 2928 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2929 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2930 | /* built-in mic */ |
| 2931 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2932 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2933 | /* speaker-out */ |
| 2934 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2935 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2936 | /* mic-in to input */ |
| 2937 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2938 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2939 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2940 | /* HP-out */ |
| 2941 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2942 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2943 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2944 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2945 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2946 | { } |
| 2947 | }; |
| 2948 | |
| 2949 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2950 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2951 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2952 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2953 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2954 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2955 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2956 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2957 | } |
| 2958 | |
| 2959 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2960 | * LG LW20 |
| 2961 | * |
| 2962 | * Pin assignment: |
| 2963 | * Speaker-out: 0x14 |
| 2964 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2965 | * Built-in Mic-In: 0x19 |
| 2966 | * Line-In: 0x1b |
| 2967 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2968 | * SPDIF-Out: 0x1e |
| 2969 | */ |
| 2970 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2971 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2972 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2973 | .items = { |
| 2974 | { "Mic", 0x0 }, |
| 2975 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2976 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2977 | }, |
| 2978 | }; |
| 2979 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2980 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2981 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2982 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2989 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2990 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2992 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2995 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2996 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2997 | { |
| 2998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2999 | .name = "Channel Mode", |
| 3000 | .info = alc_ch_mode_info, |
| 3001 | .get = alc_ch_mode_get, |
| 3002 | .put = alc_ch_mode_put, |
| 3003 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3004 | { } /* end */ |
| 3005 | }; |
| 3006 | |
| 3007 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3008 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3009 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3010 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3011 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3012 | /* set capture source to mic-in */ |
| 3013 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3014 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3015 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3017 | /* speaker-out */ |
| 3018 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3019 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3020 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3021 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3022 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3023 | /* mic-in to input */ |
| 3024 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3025 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3026 | /* built-in mic */ |
| 3027 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3028 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3029 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3030 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3031 | { } |
| 3032 | }; |
| 3033 | |
| 3034 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3035 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3036 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3037 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3038 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3039 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3040 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3041 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3042 | } |
| 3043 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3044 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3045 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3046 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3049 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3050 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3051 | { } /* end */ |
| 3052 | }; |
| 3053 | |
| 3054 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3055 | .num_items = 2, |
| 3056 | .items = { |
| 3057 | { "Mic", 0x0 }, |
| 3058 | { "Internal Mic", 0x1 }, |
| 3059 | }, |
| 3060 | }; |
| 3061 | |
| 3062 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3063 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3064 | |
| 3065 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3066 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3067 | |
| 3068 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3071 | /* Mic2 (as headphone out) for HP output */ |
| 3072 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3073 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3074 | /* Internal Speaker */ |
| 3075 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3076 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3077 | |
| 3078 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3079 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3080 | |
| 3081 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3082 | { } |
| 3083 | }; |
| 3084 | |
| 3085 | /* toggle speaker-output according to the hp-jack state */ |
| 3086 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3087 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3088 | struct alc_spec *spec = codec->spec; |
| 3089 | alc_automute_amp(codec); |
| 3090 | /* toggle EAPD */ |
| 3091 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3092 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3093 | else |
| 3094 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3095 | } |
| 3096 | |
| 3097 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3098 | unsigned int res) |
| 3099 | { |
| 3100 | /* Looks like the unsol event is incompatible with the standard |
| 3101 | * definition. 4bit tag is placed at 28 bit! |
| 3102 | */ |
| 3103 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3104 | alc880_medion_rim_automute(codec); |
| 3105 | } |
| 3106 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3107 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3108 | { |
| 3109 | struct alc_spec *spec = codec->spec; |
| 3110 | |
| 3111 | spec->autocfg.hp_pins[0] = 0x14; |
| 3112 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3113 | alc880_medion_rim_automute(codec); |
| 3114 | } |
| 3115 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3116 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3117 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3118 | { 0x0b, HDA_INPUT, 0 }, |
| 3119 | { 0x0b, HDA_INPUT, 1 }, |
| 3120 | { 0x0b, HDA_INPUT, 2 }, |
| 3121 | { 0x0b, HDA_INPUT, 3 }, |
| 3122 | { 0x0b, HDA_INPUT, 4 }, |
| 3123 | { } /* end */ |
| 3124 | }; |
| 3125 | |
| 3126 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3127 | { 0x0b, HDA_INPUT, 1 }, |
| 3128 | { 0x0b, HDA_INPUT, 6 }, |
| 3129 | { 0x0b, HDA_INPUT, 7 }, |
| 3130 | { } /* end */ |
| 3131 | }; |
| 3132 | #endif |
| 3133 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3134 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3135 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3136 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3137 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3138 | static int alc_init(struct hda_codec *codec) |
| 3139 | { |
| 3140 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | unsigned int i; |
| 3142 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3143 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3144 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3145 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3147 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3148 | |
| 3149 | if (spec->init_hook) |
| 3150 | spec->init_hook(codec); |
| 3151 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3152 | return 0; |
| 3153 | } |
| 3154 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3155 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3156 | { |
| 3157 | struct alc_spec *spec = codec->spec; |
| 3158 | |
| 3159 | if (spec->unsol_event) |
| 3160 | spec->unsol_event(codec, res); |
| 3161 | } |
| 3162 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3163 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3164 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3165 | { |
| 3166 | struct alc_spec *spec = codec->spec; |
| 3167 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3168 | } |
| 3169 | #endif |
| 3170 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3171 | /* |
| 3172 | * Analog playback callbacks |
| 3173 | */ |
| 3174 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3175 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3176 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3177 | { |
| 3178 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3179 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3180 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3181 | } |
| 3182 | |
| 3183 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3184 | struct hda_codec *codec, |
| 3185 | unsigned int stream_tag, |
| 3186 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3187 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3188 | { |
| 3189 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3190 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3191 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3192 | } |
| 3193 | |
| 3194 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3195 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3196 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3197 | { |
| 3198 | struct alc_spec *spec = codec->spec; |
| 3199 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3200 | } |
| 3201 | |
| 3202 | /* |
| 3203 | * Digital out |
| 3204 | */ |
| 3205 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3206 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3207 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3208 | { |
| 3209 | struct alc_spec *spec = codec->spec; |
| 3210 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3211 | } |
| 3212 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3213 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3214 | struct hda_codec *codec, |
| 3215 | unsigned int stream_tag, |
| 3216 | unsigned int format, |
| 3217 | struct snd_pcm_substream *substream) |
| 3218 | { |
| 3219 | struct alc_spec *spec = codec->spec; |
| 3220 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3221 | stream_tag, format, substream); |
| 3222 | } |
| 3223 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3224 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3225 | struct hda_codec *codec, |
| 3226 | struct snd_pcm_substream *substream) |
| 3227 | { |
| 3228 | struct alc_spec *spec = codec->spec; |
| 3229 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3230 | } |
| 3231 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3232 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3233 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3234 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3235 | { |
| 3236 | struct alc_spec *spec = codec->spec; |
| 3237 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3238 | } |
| 3239 | |
| 3240 | /* |
| 3241 | * Analog capture |
| 3242 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3243 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3244 | struct hda_codec *codec, |
| 3245 | unsigned int stream_tag, |
| 3246 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3247 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3248 | { |
| 3249 | struct alc_spec *spec = codec->spec; |
| 3250 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3251 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3252 | stream_tag, 0, format); |
| 3253 | return 0; |
| 3254 | } |
| 3255 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3256 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3257 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3258 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3259 | { |
| 3260 | struct alc_spec *spec = codec->spec; |
| 3261 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3262 | snd_hda_codec_cleanup_stream(codec, |
| 3263 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3264 | return 0; |
| 3265 | } |
| 3266 | |
| 3267 | |
| 3268 | /* |
| 3269 | */ |
| 3270 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3271 | .substreams = 1, |
| 3272 | .channels_min = 2, |
| 3273 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3274 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3275 | .ops = { |
| 3276 | .open = alc880_playback_pcm_open, |
| 3277 | .prepare = alc880_playback_pcm_prepare, |
| 3278 | .cleanup = alc880_playback_pcm_cleanup |
| 3279 | }, |
| 3280 | }; |
| 3281 | |
| 3282 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3283 | .substreams = 1, |
| 3284 | .channels_min = 2, |
| 3285 | .channels_max = 2, |
| 3286 | /* NID is set in alc_build_pcms */ |
| 3287 | }; |
| 3288 | |
| 3289 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3290 | .substreams = 1, |
| 3291 | .channels_min = 2, |
| 3292 | .channels_max = 2, |
| 3293 | /* NID is set in alc_build_pcms */ |
| 3294 | }; |
| 3295 | |
| 3296 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3297 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3298 | .channels_min = 2, |
| 3299 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3300 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3301 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3302 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3303 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3304 | }, |
| 3305 | }; |
| 3306 | |
| 3307 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3308 | .substreams = 1, |
| 3309 | .channels_min = 2, |
| 3310 | .channels_max = 2, |
| 3311 | /* NID is set in alc_build_pcms */ |
| 3312 | .ops = { |
| 3313 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3314 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3315 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3316 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3317 | }, |
| 3318 | }; |
| 3319 | |
| 3320 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3321 | .substreams = 1, |
| 3322 | .channels_min = 2, |
| 3323 | .channels_max = 2, |
| 3324 | /* NID is set in alc_build_pcms */ |
| 3325 | }; |
| 3326 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3327 | /* 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] | 3328 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3329 | .substreams = 0, |
| 3330 | .channels_min = 0, |
| 3331 | .channels_max = 0, |
| 3332 | }; |
| 3333 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3334 | static int alc_build_pcms(struct hda_codec *codec) |
| 3335 | { |
| 3336 | struct alc_spec *spec = codec->spec; |
| 3337 | struct hda_pcm *info = spec->pcm_rec; |
| 3338 | int i; |
| 3339 | |
| 3340 | codec->num_pcms = 1; |
| 3341 | codec->pcm_info = info; |
| 3342 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3343 | if (spec->no_analog) |
| 3344 | goto skip_analog; |
| 3345 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3346 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3347 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3348 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3349 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3350 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3351 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3352 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3353 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3354 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3355 | } |
| 3356 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3357 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3358 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3359 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3360 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3361 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3362 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3363 | if (spec->channel_mode) { |
| 3364 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3365 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3366 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3367 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3368 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3369 | } |
| 3370 | } |
| 3371 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3372 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3373 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3375 | snprintf(spec->stream_name_digital, |
| 3376 | sizeof(spec->stream_name_digital), |
| 3377 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3378 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3379 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3380 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3382 | if (spec->dig_out_type) |
| 3383 | info->pcm_type = spec->dig_out_type; |
| 3384 | else |
| 3385 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3386 | if (spec->multiout.dig_out_nid && |
| 3387 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3388 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3389 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3390 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3391 | if (spec->dig_in_nid && |
| 3392 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3393 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3394 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3395 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3396 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3397 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3398 | } |
| 3399 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3400 | if (spec->no_analog) |
| 3401 | return 0; |
| 3402 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3403 | /* If the use of more than one ADC is requested for the current |
| 3404 | * model, configure a second analog capture-only PCM. |
| 3405 | */ |
| 3406 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3407 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3408 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3409 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3410 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3411 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3412 | if (spec->alt_dac_nid) { |
| 3413 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3414 | *spec->stream_analog_alt_playback; |
| 3415 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3416 | spec->alt_dac_nid; |
| 3417 | } else { |
| 3418 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3419 | alc_pcm_null_stream; |
| 3420 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3421 | } |
| 3422 | if (spec->num_adc_nids > 1) { |
| 3423 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3424 | *spec->stream_analog_alt_capture; |
| 3425 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3426 | spec->adc_nids[1]; |
| 3427 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3428 | spec->num_adc_nids - 1; |
| 3429 | } else { |
| 3430 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3431 | alc_pcm_null_stream; |
| 3432 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3433 | } |
| 3434 | } |
| 3435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3436 | return 0; |
| 3437 | } |
| 3438 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3439 | static void alc_free_kctls(struct hda_codec *codec) |
| 3440 | { |
| 3441 | struct alc_spec *spec = codec->spec; |
| 3442 | |
| 3443 | if (spec->kctls.list) { |
| 3444 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3445 | int i; |
| 3446 | for (i = 0; i < spec->kctls.used; i++) |
| 3447 | kfree(kctl[i].name); |
| 3448 | } |
| 3449 | snd_array_free(&spec->kctls); |
| 3450 | } |
| 3451 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3452 | static void alc_free(struct hda_codec *codec) |
| 3453 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3454 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3455 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3456 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3457 | return; |
| 3458 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3459 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3460 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3461 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3462 | } |
| 3463 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3464 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3465 | static int alc_resume(struct hda_codec *codec) |
| 3466 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3467 | codec->patch_ops.init(codec); |
| 3468 | snd_hda_codec_resume_amp(codec); |
| 3469 | snd_hda_codec_resume_cache(codec); |
| 3470 | return 0; |
| 3471 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3472 | #endif |
| 3473 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3474 | /* |
| 3475 | */ |
| 3476 | static struct hda_codec_ops alc_patch_ops = { |
| 3477 | .build_controls = alc_build_controls, |
| 3478 | .build_pcms = alc_build_pcms, |
| 3479 | .init = alc_init, |
| 3480 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3481 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3482 | #ifdef SND_HDA_NEEDS_RESUME |
| 3483 | .resume = alc_resume, |
| 3484 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3485 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3486 | .check_power_status = alc_check_power_status, |
| 3487 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3488 | }; |
| 3489 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3490 | |
| 3491 | /* |
| 3492 | * Test configuration for debugging |
| 3493 | * |
| 3494 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3495 | * enum controls. |
| 3496 | */ |
| 3497 | #ifdef CONFIG_SND_DEBUG |
| 3498 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3499 | 0x02, 0x03, 0x04, 0x05 |
| 3500 | }; |
| 3501 | |
| 3502 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3503 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3504 | .items = { |
| 3505 | { "In-1", 0x0 }, |
| 3506 | { "In-2", 0x1 }, |
| 3507 | { "In-3", 0x2 }, |
| 3508 | { "In-4", 0x3 }, |
| 3509 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3510 | { "Front", 0x5 }, |
| 3511 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3512 | }, |
| 3513 | }; |
| 3514 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3515 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3517 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3518 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3519 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3520 | }; |
| 3521 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3522 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3523 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3524 | { |
| 3525 | static char *texts[] = { |
| 3526 | "N/A", "Line Out", "HP Out", |
| 3527 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3528 | }; |
| 3529 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3530 | uinfo->count = 1; |
| 3531 | uinfo->value.enumerated.items = 8; |
| 3532 | if (uinfo->value.enumerated.item >= 8) |
| 3533 | uinfo->value.enumerated.item = 7; |
| 3534 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3535 | return 0; |
| 3536 | } |
| 3537 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3538 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3539 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3540 | { |
| 3541 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3542 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3543 | unsigned int pin_ctl, item = 0; |
| 3544 | |
| 3545 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3546 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3547 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3548 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3549 | item = 2; |
| 3550 | else |
| 3551 | item = 1; |
| 3552 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3553 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3554 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3555 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3556 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3557 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3558 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3559 | } |
| 3560 | } |
| 3561 | ucontrol->value.enumerated.item[0] = item; |
| 3562 | return 0; |
| 3563 | } |
| 3564 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3565 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3566 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3567 | { |
| 3568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3569 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3570 | static unsigned int ctls[] = { |
| 3571 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3572 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3573 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3574 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3575 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3576 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3577 | }; |
| 3578 | unsigned int old_ctl, new_ctl; |
| 3579 | |
| 3580 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3581 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3582 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3583 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3584 | int val; |
| 3585 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3586 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3587 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3588 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3589 | HDA_AMP_MUTE : 0; |
| 3590 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3591 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3592 | return 1; |
| 3593 | } |
| 3594 | return 0; |
| 3595 | } |
| 3596 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3597 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3598 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3599 | { |
| 3600 | static char *texts[] = { |
| 3601 | "Front", "Surround", "CLFE", "Side" |
| 3602 | }; |
| 3603 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3604 | uinfo->count = 1; |
| 3605 | uinfo->value.enumerated.items = 4; |
| 3606 | if (uinfo->value.enumerated.item >= 4) |
| 3607 | uinfo->value.enumerated.item = 3; |
| 3608 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3609 | return 0; |
| 3610 | } |
| 3611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3612 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3613 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3614 | { |
| 3615 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3616 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3617 | unsigned int sel; |
| 3618 | |
| 3619 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3620 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3621 | return 0; |
| 3622 | } |
| 3623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3624 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3625 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3626 | { |
| 3627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3628 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3629 | unsigned int sel; |
| 3630 | |
| 3631 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3632 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3633 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3634 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3635 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3636 | return 1; |
| 3637 | } |
| 3638 | return 0; |
| 3639 | } |
| 3640 | |
| 3641 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3642 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3643 | .name = xname, \ |
| 3644 | .info = alc_test_pin_ctl_info, \ |
| 3645 | .get = alc_test_pin_ctl_get, \ |
| 3646 | .put = alc_test_pin_ctl_put, \ |
| 3647 | .private_value = nid \ |
| 3648 | } |
| 3649 | |
| 3650 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3652 | .name = xname, \ |
| 3653 | .info = alc_test_pin_src_info, \ |
| 3654 | .get = alc_test_pin_src_get, \ |
| 3655 | .put = alc_test_pin_src_put, \ |
| 3656 | .private_value = nid \ |
| 3657 | } |
| 3658 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3659 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3660 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3661 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3662 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3663 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3664 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3665 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3666 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3667 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3668 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3669 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3670 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3671 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3672 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3673 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3674 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3675 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3676 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3677 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3678 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3679 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3680 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3681 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3682 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3683 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3684 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3685 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3686 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3687 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3688 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3689 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3690 | { |
| 3691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3692 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3693 | .info = alc_ch_mode_info, |
| 3694 | .get = alc_ch_mode_get, |
| 3695 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3696 | }, |
| 3697 | { } /* end */ |
| 3698 | }; |
| 3699 | |
| 3700 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3701 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3702 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3704 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3705 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3706 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3707 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3708 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3710 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3711 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3712 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3713 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3714 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3715 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3718 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3719 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3720 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3721 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3723 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3725 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3727 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3730 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3731 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3733 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3734 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3735 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3736 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3738 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3739 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3740 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3741 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3742 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3743 | /* Analog input/passthru */ |
| 3744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3746 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3747 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3748 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3749 | { } |
| 3750 | }; |
| 3751 | #endif |
| 3752 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3753 | /* |
| 3754 | */ |
| 3755 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3756 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3757 | [ALC880_3ST] = "3stack", |
| 3758 | [ALC880_TCL_S700] = "tcl", |
| 3759 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3760 | [ALC880_CLEVO] = "clevo", |
| 3761 | [ALC880_5ST] = "5stack", |
| 3762 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3763 | [ALC880_W810] = "w810", |
| 3764 | [ALC880_Z71V] = "z71v", |
| 3765 | [ALC880_6ST] = "6stack", |
| 3766 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3767 | [ALC880_ASUS] = "asus", |
| 3768 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3769 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3770 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3771 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3772 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3773 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3774 | [ALC880_F1734] = "F1734", |
| 3775 | [ALC880_LG] = "lg", |
| 3776 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3777 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3778 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3779 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3780 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3781 | [ALC880_AUTO] = "auto", |
| 3782 | }; |
| 3783 | |
| 3784 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3785 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3786 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3787 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3788 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3789 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3790 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3791 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3792 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3793 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3794 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3795 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3796 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3797 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3798 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3799 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3800 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3801 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3802 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3803 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3804 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3805 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3806 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3807 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3808 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3809 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3810 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3811 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3812 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3813 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3814 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3815 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3816 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3817 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3818 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3819 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3820 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3821 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3822 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3823 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3824 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3825 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3826 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3827 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3828 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3829 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3830 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3831 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3832 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3833 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3834 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3835 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3836 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3837 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3838 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3839 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3840 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3841 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3842 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3843 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3844 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3845 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3846 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3847 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3848 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3849 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3850 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3851 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3852 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3853 | /* default Intel */ |
| 3854 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3855 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3856 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3857 | {} |
| 3858 | }; |
| 3859 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3860 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3861 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3862 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3863 | static struct alc_config_preset alc880_presets[] = { |
| 3864 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3865 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3866 | .init_verbs = { alc880_volume_init_verbs, |
| 3867 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3868 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3869 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3870 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3871 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3872 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3873 | .input_mux = &alc880_capture_source, |
| 3874 | }, |
| 3875 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3876 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3877 | .init_verbs = { alc880_volume_init_verbs, |
| 3878 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3879 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3880 | .dac_nids = alc880_dac_nids, |
| 3881 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3882 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3883 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3884 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3885 | .input_mux = &alc880_capture_source, |
| 3886 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3887 | [ALC880_TCL_S700] = { |
| 3888 | .mixers = { alc880_tcl_s700_mixer }, |
| 3889 | .init_verbs = { alc880_volume_init_verbs, |
| 3890 | alc880_pin_tcl_S700_init_verbs, |
| 3891 | alc880_gpio2_init_verbs }, |
| 3892 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3893 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3894 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3895 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3896 | .hp_nid = 0x03, |
| 3897 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3898 | .channel_mode = alc880_2_jack_modes, |
| 3899 | .input_mux = &alc880_capture_source, |
| 3900 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3901 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3902 | .mixers = { alc880_three_stack_mixer, |
| 3903 | alc880_five_stack_mixer}, |
| 3904 | .init_verbs = { alc880_volume_init_verbs, |
| 3905 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3906 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3907 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3908 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3909 | .channel_mode = alc880_fivestack_modes, |
| 3910 | .input_mux = &alc880_capture_source, |
| 3911 | }, |
| 3912 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3913 | .mixers = { alc880_three_stack_mixer, |
| 3914 | alc880_five_stack_mixer }, |
| 3915 | .init_verbs = { alc880_volume_init_verbs, |
| 3916 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3918 | .dac_nids = alc880_dac_nids, |
| 3919 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3920 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3921 | .channel_mode = alc880_fivestack_modes, |
| 3922 | .input_mux = &alc880_capture_source, |
| 3923 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3924 | [ALC880_6ST] = { |
| 3925 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3926 | .init_verbs = { alc880_volume_init_verbs, |
| 3927 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3928 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3929 | .dac_nids = alc880_6st_dac_nids, |
| 3930 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3931 | .channel_mode = alc880_sixstack_modes, |
| 3932 | .input_mux = &alc880_6stack_capture_source, |
| 3933 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3934 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3935 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3936 | .init_verbs = { alc880_volume_init_verbs, |
| 3937 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3938 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3939 | .dac_nids = alc880_6st_dac_nids, |
| 3940 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3941 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3942 | .channel_mode = alc880_sixstack_modes, |
| 3943 | .input_mux = &alc880_6stack_capture_source, |
| 3944 | }, |
| 3945 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3946 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3947 | .init_verbs = { alc880_volume_init_verbs, |
| 3948 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3949 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3950 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3951 | .dac_nids = alc880_w810_dac_nids, |
| 3952 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3953 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3954 | .channel_mode = alc880_w810_modes, |
| 3955 | .input_mux = &alc880_capture_source, |
| 3956 | }, |
| 3957 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3958 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3959 | .init_verbs = { alc880_volume_init_verbs, |
| 3960 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3961 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3962 | .dac_nids = alc880_z71v_dac_nids, |
| 3963 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3964 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3965 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3966 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3967 | .input_mux = &alc880_capture_source, |
| 3968 | }, |
| 3969 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3970 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3971 | .init_verbs = { alc880_volume_init_verbs, |
| 3972 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3973 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3974 | .dac_nids = alc880_f1734_dac_nids, |
| 3975 | .hp_nid = 0x02, |
| 3976 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3977 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3978 | .input_mux = &alc880_f1734_capture_source, |
| 3979 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3980 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3981 | }, |
| 3982 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3983 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3984 | .init_verbs = { alc880_volume_init_verbs, |
| 3985 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3986 | alc880_gpio1_init_verbs }, |
| 3987 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3988 | .dac_nids = alc880_asus_dac_nids, |
| 3989 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3990 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3991 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3992 | .input_mux = &alc880_capture_source, |
| 3993 | }, |
| 3994 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3995 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3996 | .init_verbs = { alc880_volume_init_verbs, |
| 3997 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3998 | alc880_gpio1_init_verbs }, |
| 3999 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4000 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4001 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4002 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4003 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4004 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4005 | .input_mux = &alc880_capture_source, |
| 4006 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4007 | [ALC880_ASUS_DIG2] = { |
| 4008 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4009 | .init_verbs = { alc880_volume_init_verbs, |
| 4010 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4012 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4013 | .dac_nids = alc880_asus_dac_nids, |
| 4014 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4015 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4016 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4017 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4018 | .input_mux = &alc880_capture_source, |
| 4019 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4020 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4021 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4022 | .init_verbs = { alc880_volume_init_verbs, |
| 4023 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4024 | alc880_gpio1_init_verbs }, |
| 4025 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4026 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4027 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4028 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4029 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4030 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4031 | .input_mux = &alc880_capture_source, |
| 4032 | }, |
| 4033 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4034 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4035 | .init_verbs = { alc880_volume_init_verbs, |
| 4036 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4037 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4038 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4039 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4040 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4041 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4042 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4043 | .input_mux = &alc880_capture_source, |
| 4044 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4045 | [ALC880_UNIWILL] = { |
| 4046 | .mixers = { alc880_uniwill_mixer }, |
| 4047 | .init_verbs = { alc880_volume_init_verbs, |
| 4048 | alc880_uniwill_init_verbs }, |
| 4049 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4050 | .dac_nids = alc880_asus_dac_nids, |
| 4051 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4052 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4053 | .channel_mode = alc880_threestack_modes, |
| 4054 | .need_dac_fix = 1, |
| 4055 | .input_mux = &alc880_capture_source, |
| 4056 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4057 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4058 | }, |
| 4059 | [ALC880_UNIWILL_P53] = { |
| 4060 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4061 | .init_verbs = { alc880_volume_init_verbs, |
| 4062 | alc880_uniwill_p53_init_verbs }, |
| 4063 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4064 | .dac_nids = alc880_asus_dac_nids, |
| 4065 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4066 | .channel_mode = alc880_threestack_modes, |
| 4067 | .input_mux = &alc880_capture_source, |
| 4068 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4069 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4070 | }, |
| 4071 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4072 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4073 | .init_verbs = { alc880_volume_init_verbs, |
| 4074 | alc880_uniwill_p53_init_verbs, |
| 4075 | alc880_beep_init_verbs }, |
| 4076 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4077 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4078 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4079 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4080 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4081 | .input_mux = &alc880_capture_source, |
| 4082 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4083 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4084 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4085 | [ALC880_CLEVO] = { |
| 4086 | .mixers = { alc880_three_stack_mixer }, |
| 4087 | .init_verbs = { alc880_volume_init_verbs, |
| 4088 | alc880_pin_clevo_init_verbs }, |
| 4089 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4090 | .dac_nids = alc880_dac_nids, |
| 4091 | .hp_nid = 0x03, |
| 4092 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4093 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4094 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4095 | .input_mux = &alc880_capture_source, |
| 4096 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4097 | [ALC880_LG] = { |
| 4098 | .mixers = { alc880_lg_mixer }, |
| 4099 | .init_verbs = { alc880_volume_init_verbs, |
| 4100 | alc880_lg_init_verbs }, |
| 4101 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4102 | .dac_nids = alc880_lg_dac_nids, |
| 4103 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4104 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4105 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4106 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4107 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4108 | .unsol_event = alc_automute_amp_unsol_event, |
| 4109 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4110 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4111 | .loopbacks = alc880_lg_loopbacks, |
| 4112 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4113 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4114 | [ALC880_LG_LW] = { |
| 4115 | .mixers = { alc880_lg_lw_mixer }, |
| 4116 | .init_verbs = { alc880_volume_init_verbs, |
| 4117 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4118 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4119 | .dac_nids = alc880_dac_nids, |
| 4120 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4121 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4122 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4123 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4124 | .unsol_event = alc_automute_amp_unsol_event, |
| 4125 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4126 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4127 | [ALC880_MEDION_RIM] = { |
| 4128 | .mixers = { alc880_medion_rim_mixer }, |
| 4129 | .init_verbs = { alc880_volume_init_verbs, |
| 4130 | alc880_medion_rim_init_verbs, |
| 4131 | alc_gpio2_init_verbs }, |
| 4132 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4133 | .dac_nids = alc880_dac_nids, |
| 4134 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4135 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4136 | .channel_mode = alc880_2_jack_modes, |
| 4137 | .input_mux = &alc880_medion_rim_capture_source, |
| 4138 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4139 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4140 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | #ifdef CONFIG_SND_DEBUG |
| 4142 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4143 | .mixers = { alc880_test_mixer }, |
| 4144 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4145 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4146 | .dac_nids = alc880_test_dac_nids, |
| 4147 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4148 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4149 | .channel_mode = alc880_test_modes, |
| 4150 | .input_mux = &alc880_test_capture_source, |
| 4151 | }, |
| 4152 | #endif |
| 4153 | }; |
| 4154 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | /* |
| 4156 | * Automatic parse of I/O pins from the BIOS configuration |
| 4157 | */ |
| 4158 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4159 | enum { |
| 4160 | ALC_CTL_WIDGET_VOL, |
| 4161 | ALC_CTL_WIDGET_MUTE, |
| 4162 | ALC_CTL_BIND_MUTE, |
| 4163 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4164 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4165 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4166 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4167 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4168 | }; |
| 4169 | |
| 4170 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4171 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4172 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4173 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4174 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4175 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4176 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4177 | knew = snd_array_new(&spec->kctls); |
| 4178 | if (!knew) |
| 4179 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4180 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4181 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4182 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4183 | return -ENOMEM; |
| 4184 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4185 | return 0; |
| 4186 | } |
| 4187 | |
| 4188 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4189 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4190 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4191 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4192 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4193 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4194 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4195 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4196 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4197 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4198 | #define ALC880_PIN_CD_NID 0x1c |
| 4199 | |
| 4200 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4201 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4202 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4203 | { |
| 4204 | hda_nid_t nid; |
| 4205 | int assigned[4]; |
| 4206 | int i, j; |
| 4207 | |
| 4208 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4209 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4210 | |
| 4211 | /* check the pins hardwired to audio widget */ |
| 4212 | for (i = 0; i < cfg->line_outs; i++) { |
| 4213 | nid = cfg->line_out_pins[i]; |
| 4214 | if (alc880_is_fixed_pin(nid)) { |
| 4215 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4216 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4217 | assigned[idx] = 1; |
| 4218 | } |
| 4219 | } |
| 4220 | /* left pins can be connect to any audio widget */ |
| 4221 | for (i = 0; i < cfg->line_outs; i++) { |
| 4222 | nid = cfg->line_out_pins[i]; |
| 4223 | if (alc880_is_fixed_pin(nid)) |
| 4224 | continue; |
| 4225 | /* search for an empty channel */ |
| 4226 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4227 | if (!assigned[j]) { |
| 4228 | spec->multiout.dac_nids[i] = |
| 4229 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4230 | assigned[j] = 1; |
| 4231 | break; |
| 4232 | } |
| 4233 | } |
| 4234 | } |
| 4235 | spec->multiout.num_dacs = cfg->line_outs; |
| 4236 | return 0; |
| 4237 | } |
| 4238 | |
| 4239 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4240 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4241 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4242 | { |
| 4243 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4244 | static const char *chname[4] = { |
| 4245 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4246 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4247 | hda_nid_t nid; |
| 4248 | int i, err; |
| 4249 | |
| 4250 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4251 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4252 | continue; |
| 4253 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4254 | if (i == 2) { |
| 4255 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4256 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4257 | "Center Playback Volume", |
| 4258 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4259 | HDA_OUTPUT)); |
| 4260 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4261 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4262 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4263 | "LFE Playback Volume", |
| 4264 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4265 | HDA_OUTPUT)); |
| 4266 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4267 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4268 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4269 | "Center Playback Switch", |
| 4270 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4271 | HDA_INPUT)); |
| 4272 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4273 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4274 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4275 | "LFE Playback Switch", |
| 4276 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4277 | HDA_INPUT)); |
| 4278 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4279 | return err; |
| 4280 | } else { |
| 4281 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4283 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4284 | HDA_OUTPUT)); |
| 4285 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4286 | return err; |
| 4287 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4288 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4289 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4290 | HDA_INPUT)); |
| 4291 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4292 | return err; |
| 4293 | } |
| 4294 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4295 | return 0; |
| 4296 | } |
| 4297 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4298 | /* add playback controls for speaker and HP outputs */ |
| 4299 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4300 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4301 | { |
| 4302 | hda_nid_t nid; |
| 4303 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4304 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4305 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4306 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4307 | return 0; |
| 4308 | |
| 4309 | if (alc880_is_fixed_pin(pin)) { |
| 4310 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4311 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4312 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4313 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4314 | else |
| 4315 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4316 | /* control HP volume/switch on the output mixer amp */ |
| 4317 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4318 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4319 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4320 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4321 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4322 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4323 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4324 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4325 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4326 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | return err; |
| 4328 | } else if (alc880_is_multi_pin(pin)) { |
| 4329 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4330 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4331 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4332 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4333 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4334 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4335 | return err; |
| 4336 | } |
| 4337 | return 0; |
| 4338 | } |
| 4339 | |
| 4340 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4341 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4342 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4343 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4344 | { |
| 4345 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4346 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | |
| 4348 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4349 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4350 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4351 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4352 | return err; |
| 4353 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4354 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4355 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4356 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | return err; |
| 4358 | return 0; |
| 4359 | } |
| 4360 | |
| 4361 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | static int alc880_auto_create_analog_input_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 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4365 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4366 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4367 | |
| 4368 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4369 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4370 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4371 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4372 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4373 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | if (err < 0) |
| 4375 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4376 | imux->items[imux->num_items].label = |
| 4377 | auto_pin_cfg_labels[i]; |
| 4378 | imux->items[imux->num_items].index = |
| 4379 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4380 | imux->num_items++; |
| 4381 | } |
| 4382 | } |
| 4383 | return 0; |
| 4384 | } |
| 4385 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4386 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4387 | unsigned int pin_type) |
| 4388 | { |
| 4389 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4390 | pin_type); |
| 4391 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4392 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4393 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4394 | } |
| 4395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4396 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4397 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4398 | int dac_idx) |
| 4399 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4400 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4401 | /* need the manual connection? */ |
| 4402 | if (alc880_is_multi_pin(nid)) { |
| 4403 | struct alc_spec *spec = codec->spec; |
| 4404 | int idx = alc880_multi_pin_idx(nid); |
| 4405 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4406 | AC_VERB_SET_CONNECT_SEL, |
| 4407 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4408 | } |
| 4409 | } |
| 4410 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4411 | static int get_pin_type(int line_out_type) |
| 4412 | { |
| 4413 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4414 | return PIN_HP; |
| 4415 | else |
| 4416 | return PIN_OUT; |
| 4417 | } |
| 4418 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4419 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4420 | { |
| 4421 | struct alc_spec *spec = codec->spec; |
| 4422 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4423 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4424 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4425 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4426 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4427 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4428 | } |
| 4429 | } |
| 4430 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4431 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4432 | { |
| 4433 | struct alc_spec *spec = codec->spec; |
| 4434 | hda_nid_t pin; |
| 4435 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4436 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4437 | if (pin) /* connect to front */ |
| 4438 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4439 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4440 | if (pin) /* connect to front */ |
| 4441 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4442 | } |
| 4443 | |
| 4444 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4445 | { |
| 4446 | struct alc_spec *spec = codec->spec; |
| 4447 | int i; |
| 4448 | |
| 4449 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4450 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4451 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4452 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4453 | if (nid != ALC880_PIN_CD_NID && |
| 4454 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | snd_hda_codec_write(codec, nid, 0, |
| 4456 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4457 | AMP_OUT_MUTE); |
| 4458 | } |
| 4459 | } |
| 4460 | } |
| 4461 | |
| 4462 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4463 | /* return 1 if successful, 0 if the proper config is not found, |
| 4464 | * or a negative error code |
| 4465 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4466 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4467 | { |
| 4468 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4469 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4470 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4471 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4472 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4473 | alc880_ignore); |
| 4474 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4475 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4476 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4477 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4478 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4479 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4480 | if (err < 0) |
| 4481 | return err; |
| 4482 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4483 | if (err < 0) |
| 4484 | return err; |
| 4485 | err = alc880_auto_create_extra_out(spec, |
| 4486 | spec->autocfg.speaker_pins[0], |
| 4487 | "Speaker"); |
| 4488 | if (err < 0) |
| 4489 | return err; |
| 4490 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4491 | "Headphone"); |
| 4492 | if (err < 0) |
| 4493 | return err; |
| 4494 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4495 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4496 | return err; |
| 4497 | |
| 4498 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4499 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4500 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4501 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4502 | hda_nid_t dig_nid; |
| 4503 | err = snd_hda_get_connections(codec, |
| 4504 | spec->autocfg.dig_out_pins[i], |
| 4505 | &dig_nid, 1); |
| 4506 | if (err < 0) |
| 4507 | continue; |
| 4508 | if (!i) |
| 4509 | spec->multiout.dig_out_nid = dig_nid; |
| 4510 | else { |
| 4511 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4512 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4513 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4514 | break; |
| 4515 | } |
| 4516 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4517 | if (spec->autocfg.dig_in_pin) |
| 4518 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4519 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4520 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4521 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4522 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4523 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4524 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4525 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4526 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4527 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4528 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4529 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4530 | return 1; |
| 4531 | } |
| 4532 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4533 | /* additional initialization for auto-configuration model */ |
| 4534 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4535 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4536 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4537 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4538 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4539 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4540 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4541 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4542 | } |
| 4543 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4544 | static void set_capture_mixer(struct alc_spec *spec) |
| 4545 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4546 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4547 | { alc_capture_mixer_nosrc1, |
| 4548 | alc_capture_mixer_nosrc2, |
| 4549 | alc_capture_mixer_nosrc3 }, |
| 4550 | { alc_capture_mixer1, |
| 4551 | alc_capture_mixer2, |
| 4552 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4553 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4554 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4555 | int mux; |
| 4556 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4557 | mux = 1; |
| 4558 | else |
| 4559 | mux = 0; |
| 4560 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4561 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4562 | } |
| 4563 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4564 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4565 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4566 | |
| 4567 | /* |
| 4568 | * OK, here we have finally the patch for ALC880 |
| 4569 | */ |
| 4570 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4571 | static int patch_alc880(struct hda_codec *codec) |
| 4572 | { |
| 4573 | struct alc_spec *spec; |
| 4574 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4575 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4576 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4577 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4578 | if (spec == NULL) |
| 4579 | return -ENOMEM; |
| 4580 | |
| 4581 | codec->spec = spec; |
| 4582 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4583 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4584 | alc880_models, |
| 4585 | alc880_cfg_tbl); |
| 4586 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4587 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4588 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4589 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4590 | } |
| 4591 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4592 | if (board_config == ALC880_AUTO) { |
| 4593 | /* automatic parse from the BIOS config */ |
| 4594 | err = alc880_parse_auto_config(codec); |
| 4595 | if (err < 0) { |
| 4596 | alc_free(codec); |
| 4597 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4598 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4599 | printk(KERN_INFO |
| 4600 | "hda_codec: Cannot set up configuration " |
| 4601 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4602 | board_config = ALC880_3ST; |
| 4603 | } |
| 4604 | } |
| 4605 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4606 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4607 | if (err < 0) { |
| 4608 | alc_free(codec); |
| 4609 | return err; |
| 4610 | } |
| 4611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4612 | if (board_config != ALC880_AUTO) |
| 4613 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4614 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4615 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4616 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4617 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4618 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4619 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4620 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4621 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4622 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4623 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4624 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4625 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4626 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4627 | if (wcap != AC_WID_AUD_IN) { |
| 4628 | spec->adc_nids = alc880_adc_nids_alt; |
| 4629 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4630 | } else { |
| 4631 | spec->adc_nids = alc880_adc_nids; |
| 4632 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4633 | } |
| 4634 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4635 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4636 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4637 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4638 | spec->vmaster_nid = 0x0c; |
| 4639 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4640 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4641 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4642 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4643 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4644 | if (!spec->loopback.amplist) |
| 4645 | spec->loopback.amplist = alc880_loopbacks; |
| 4646 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4647 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4648 | |
| 4649 | return 0; |
| 4650 | } |
| 4651 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4652 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4653 | /* |
| 4654 | * ALC260 support |
| 4655 | */ |
| 4656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4657 | static hda_nid_t alc260_dac_nids[1] = { |
| 4658 | /* front */ |
| 4659 | 0x02, |
| 4660 | }; |
| 4661 | |
| 4662 | static hda_nid_t alc260_adc_nids[1] = { |
| 4663 | /* ADC0 */ |
| 4664 | 0x04, |
| 4665 | }; |
| 4666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4667 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4668 | /* ADC1 */ |
| 4669 | 0x05, |
| 4670 | }; |
| 4671 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4672 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4673 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4674 | */ |
| 4675 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4676 | /* ADC0, ADC1 */ |
| 4677 | 0x04, 0x05 |
| 4678 | }; |
| 4679 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4680 | #define ALC260_DIGOUT_NID 0x03 |
| 4681 | #define ALC260_DIGIN_NID 0x06 |
| 4682 | |
| 4683 | static struct hda_input_mux alc260_capture_source = { |
| 4684 | .num_items = 4, |
| 4685 | .items = { |
| 4686 | { "Mic", 0x0 }, |
| 4687 | { "Front Mic", 0x1 }, |
| 4688 | { "Line", 0x2 }, |
| 4689 | { "CD", 0x4 }, |
| 4690 | }, |
| 4691 | }; |
| 4692 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4693 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4694 | * headphone jack and the internal CD lines since these are the only pins at |
| 4695 | * which audio can appear. For flexibility, also allow the option of |
| 4696 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4697 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4698 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4699 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4700 | { |
| 4701 | .num_items = 3, |
| 4702 | .items = { |
| 4703 | { "Mic/Line", 0x0 }, |
| 4704 | { "CD", 0x4 }, |
| 4705 | { "Headphone", 0x2 }, |
| 4706 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4707 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4708 | { |
| 4709 | .num_items = 4, |
| 4710 | .items = { |
| 4711 | { "Mic/Line", 0x0 }, |
| 4712 | { "CD", 0x4 }, |
| 4713 | { "Headphone", 0x2 }, |
| 4714 | { "Mixer", 0x5 }, |
| 4715 | }, |
| 4716 | }, |
| 4717 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4718 | }; |
| 4719 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4720 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4721 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4722 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4723 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4724 | { |
| 4725 | .num_items = 4, |
| 4726 | .items = { |
| 4727 | { "Mic", 0x0 }, |
| 4728 | { "Line", 0x2 }, |
| 4729 | { "CD", 0x4 }, |
| 4730 | { "Headphone", 0x5 }, |
| 4731 | }, |
| 4732 | }, |
| 4733 | { |
| 4734 | .num_items = 5, |
| 4735 | .items = { |
| 4736 | { "Mic", 0x0 }, |
| 4737 | { "Line", 0x2 }, |
| 4738 | { "CD", 0x4 }, |
| 4739 | { "Headphone", 0x6 }, |
| 4740 | { "Mixer", 0x5 }, |
| 4741 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4742 | }, |
| 4743 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4744 | |
| 4745 | /* Maxdata Favorit 100XS */ |
| 4746 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4747 | { |
| 4748 | .num_items = 2, |
| 4749 | .items = { |
| 4750 | { "Line/Mic", 0x0 }, |
| 4751 | { "CD", 0x4 }, |
| 4752 | }, |
| 4753 | }, |
| 4754 | { |
| 4755 | .num_items = 3, |
| 4756 | .items = { |
| 4757 | { "Line/Mic", 0x0 }, |
| 4758 | { "CD", 0x4 }, |
| 4759 | { "Mixer", 0x5 }, |
| 4760 | }, |
| 4761 | }, |
| 4762 | }; |
| 4763 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4764 | /* |
| 4765 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4766 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4767 | * element which allows changing the channel mode, so the verb list is |
| 4768 | * never used. |
| 4769 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4770 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4771 | { 2, NULL }, |
| 4772 | }; |
| 4773 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4774 | |
| 4775 | /* Mixer combinations |
| 4776 | * |
| 4777 | * basic: base_output + input + pc_beep + capture |
| 4778 | * HP: base_output + input + capture_alt |
| 4779 | * HP_3013: hp_3013 + input + capture |
| 4780 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4781 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4782 | */ |
| 4783 | |
| 4784 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4785 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4786 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4787 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4788 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4789 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4790 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4791 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4792 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4793 | |
| 4794 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4795 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4796 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4797 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4798 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4803 | { } /* end */ |
| 4804 | }; |
| 4805 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4806 | /* update HP, line and mono out pins according to the master switch */ |
| 4807 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4808 | hda_nid_t hp, hda_nid_t line, |
| 4809 | hda_nid_t mono) |
| 4810 | { |
| 4811 | struct alc_spec *spec = codec->spec; |
| 4812 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4813 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4814 | 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] | 4815 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4816 | 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] | 4817 | val); |
| 4818 | /* mono (speaker) depending on the HP jack sense */ |
| 4819 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4820 | 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] | 4821 | val); |
| 4822 | } |
| 4823 | |
| 4824 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4825 | struct snd_ctl_elem_value *ucontrol) |
| 4826 | { |
| 4827 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4828 | struct alc_spec *spec = codec->spec; |
| 4829 | *ucontrol->value.integer.value = spec->master_sw; |
| 4830 | return 0; |
| 4831 | } |
| 4832 | |
| 4833 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4834 | struct snd_ctl_elem_value *ucontrol) |
| 4835 | { |
| 4836 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4837 | struct alc_spec *spec = codec->spec; |
| 4838 | int val = !!*ucontrol->value.integer.value; |
| 4839 | hda_nid_t hp, line, mono; |
| 4840 | |
| 4841 | if (val == spec->master_sw) |
| 4842 | return 0; |
| 4843 | spec->master_sw = val; |
| 4844 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4845 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4846 | mono = kcontrol->private_value & 0xff; |
| 4847 | alc260_hp_master_update(codec, hp, line, mono); |
| 4848 | return 1; |
| 4849 | } |
| 4850 | |
| 4851 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4852 | { |
| 4853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4854 | .name = "Master Playback Switch", |
| 4855 | .info = snd_ctl_boolean_mono_info, |
| 4856 | .get = alc260_hp_master_sw_get, |
| 4857 | .put = alc260_hp_master_sw_put, |
| 4858 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4859 | }, |
| 4860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4861 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4862 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4863 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4864 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4865 | HDA_OUTPUT), |
| 4866 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4867 | { } /* end */ |
| 4868 | }; |
| 4869 | |
| 4870 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4871 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4872 | {}, |
| 4873 | }; |
| 4874 | |
| 4875 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4876 | { |
| 4877 | struct alc_spec *spec = codec->spec; |
| 4878 | unsigned int present; |
| 4879 | |
| 4880 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4881 | AC_VERB_GET_PIN_SENSE, 0); |
| 4882 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4883 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4884 | } |
| 4885 | |
| 4886 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4887 | { |
| 4888 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4889 | alc260_hp_automute(codec); |
| 4890 | } |
| 4891 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4892 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4893 | { |
| 4894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4895 | .name = "Master Playback Switch", |
| 4896 | .info = snd_ctl_boolean_mono_info, |
| 4897 | .get = alc260_hp_master_sw_get, |
| 4898 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4899 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4900 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4901 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4902 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4903 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4904 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4905 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4906 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4907 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4908 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4909 | { } /* end */ |
| 4910 | }; |
| 4911 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4912 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4913 | .ops = &snd_hda_bind_vol, |
| 4914 | .values = { |
| 4915 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4916 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4917 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4918 | 0 |
| 4919 | }, |
| 4920 | }; |
| 4921 | |
| 4922 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4923 | .ops = &snd_hda_bind_sw, |
| 4924 | .values = { |
| 4925 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4926 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4927 | 0 |
| 4928 | }, |
| 4929 | }; |
| 4930 | |
| 4931 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4932 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4933 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4934 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4936 | { } /* end */ |
| 4937 | }; |
| 4938 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4939 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4940 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4941 | {}, |
| 4942 | }; |
| 4943 | |
| 4944 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4945 | { |
| 4946 | struct alc_spec *spec = codec->spec; |
| 4947 | unsigned int present; |
| 4948 | |
| 4949 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4950 | AC_VERB_GET_PIN_SENSE, 0); |
| 4951 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4952 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4953 | } |
| 4954 | |
| 4955 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4956 | unsigned int res) |
| 4957 | { |
| 4958 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4959 | alc260_hp_3013_automute(codec); |
| 4960 | } |
| 4961 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4962 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4963 | { |
| 4964 | unsigned int present, bits; |
| 4965 | |
| 4966 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4967 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4968 | |
| 4969 | bits = present ? 0 : PIN_OUT; |
| 4970 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4971 | bits); |
| 4972 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4973 | bits); |
| 4974 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4975 | bits); |
| 4976 | } |
| 4977 | |
| 4978 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4979 | unsigned int res) |
| 4980 | { |
| 4981 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4982 | alc260_hp_3012_automute(codec); |
| 4983 | } |
| 4984 | |
| 4985 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4986 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4987 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4988 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4989 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4990 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4991 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4993 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4994 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4995 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4996 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4997 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4998 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4999 | { } /* end */ |
| 5000 | }; |
| 5001 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5002 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5003 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5004 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5005 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5006 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5007 | * revisions available in early 2006. Therefore for now allow the |
| 5008 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5009 | * that the lack of mic bias for this NID is intentional we could change the |
| 5010 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5011 | * |
| 5012 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5013 | * don't appear to make the mic bias available from the "line" jack, even |
| 5014 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5015 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5016 | * and the output jack. If this turns out to be the case for all such |
| 5017 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5018 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5019 | * |
| 5020 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5021 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5022 | * controls for such models. On models without a "mono speaker" the control |
| 5023 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5024 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5025 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5026 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5027 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5028 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5029 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5030 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5031 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5032 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5034 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5035 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5037 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5039 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5040 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5041 | { } /* end */ |
| 5042 | }; |
| 5043 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5044 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5045 | */ |
| 5046 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5047 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5048 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5049 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5050 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5051 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5052 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5053 | { } /* end */ |
| 5054 | }; |
| 5055 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5056 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5057 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5058 | */ |
| 5059 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5060 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5061 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5064 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5065 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5066 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5067 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5068 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5069 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5070 | { } /* end */ |
| 5071 | }; |
| 5072 | |
| 5073 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5074 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5075 | */ |
| 5076 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5077 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5078 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5081 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5082 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5083 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5085 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5086 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5087 | { } /* end */ |
| 5088 | }; |
| 5089 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5090 | /* |
| 5091 | * initialization verbs |
| 5092 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5093 | static struct hda_verb alc260_init_verbs[] = { |
| 5094 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5096 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5097 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5098 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5100 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5101 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5102 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5103 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5104 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5105 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5106 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5107 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5108 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5109 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5110 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5111 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5112 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5113 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5114 | /* set connection select to line in (default select for this ADC) */ |
| 5115 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5116 | /* mute capture amp left and right */ |
| 5117 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5118 | /* set connection select to line in (default select for this ADC) */ |
| 5119 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5120 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5122 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5123 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5124 | /* set vol=0 HP mixer amp left and right */ |
| 5125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5126 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5127 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5128 | /* set vol=0 Mono mixer amp left and right */ |
| 5129 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5130 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5131 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5132 | /* unmute LINE-2 out pin */ |
| 5133 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5134 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5135 | * Line In 2 = 0x03 |
| 5136 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5137 | /* mute analog inputs */ |
| 5138 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5139 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5140 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5143 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5144 | /* mute Front out path */ |
| 5145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5146 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5147 | /* mute Headphone out path */ |
| 5148 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5149 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5150 | /* mute Mono out path */ |
| 5151 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5152 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5153 | { } |
| 5154 | }; |
| 5155 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5156 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5157 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5158 | /* Headphone and output */ |
| 5159 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5160 | /* mono output */ |
| 5161 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5162 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5163 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5164 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5165 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5166 | /* Line In pin widget for input */ |
| 5167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5168 | /* Line-2 pin widget for output */ |
| 5169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5170 | /* CD pin widget for input */ |
| 5171 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5172 | /* unmute amp left and right */ |
| 5173 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5174 | /* set connection select to line in (default select for this ADC) */ |
| 5175 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5176 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5177 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5178 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5179 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5180 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5181 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5182 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5183 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5184 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5185 | * Line In 2 = 0x03 |
| 5186 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5187 | /* mute analog inputs */ |
| 5188 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5189 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5191 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5192 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5193 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5194 | /* Unmute Front out path */ |
| 5195 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5196 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5197 | /* Unmute Headphone out path */ |
| 5198 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5199 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5200 | /* Unmute Mono out path */ |
| 5201 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5202 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5203 | { } |
| 5204 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5205 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5206 | |
| 5207 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5208 | /* Line out and output */ |
| 5209 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5210 | /* mono output */ |
| 5211 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5212 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5213 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5214 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5215 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5216 | /* Line In pin widget for input */ |
| 5217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5218 | /* Headphone pin widget for output */ |
| 5219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5220 | /* CD pin widget for input */ |
| 5221 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5222 | /* unmute amp left and right */ |
| 5223 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5224 | /* set connection select to line in (default select for this ADC) */ |
| 5225 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5226 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5227 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5228 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5229 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5230 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5231 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5232 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5233 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5234 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5235 | * Line In 2 = 0x03 |
| 5236 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5237 | /* mute analog inputs */ |
| 5238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5239 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5243 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5244 | /* Unmute Front out path */ |
| 5245 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5246 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5247 | /* Unmute Headphone out path */ |
| 5248 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5250 | /* Unmute Mono out path */ |
| 5251 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5252 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5253 | { } |
| 5254 | }; |
| 5255 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5256 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5257 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5258 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5259 | */ |
| 5260 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5261 | /* Disable all GPIOs */ |
| 5262 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5263 | /* Internal speaker is connected to headphone pin */ |
| 5264 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5265 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5267 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5268 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5269 | /* Ensure all other unused pins are disabled and muted. */ |
| 5270 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5271 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5272 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5273 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5274 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5275 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5276 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5277 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5278 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5279 | /* Disable digital (SPDIF) pins */ |
| 5280 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5281 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5282 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5283 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5284 | * when acting as an output. |
| 5285 | */ |
| 5286 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5287 | |
| 5288 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5291 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5292 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5295 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5296 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5297 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5298 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5299 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5300 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5301 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5302 | * If the pin mode is changed by the user the pin mode control will |
| 5303 | * take care of enabling the pin's input/output buffers as needed. |
| 5304 | * Therefore there's no need to enable the input buffer at this |
| 5305 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5306 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5308 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5309 | * mixer ctrl) |
| 5310 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5311 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5312 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5313 | /* Mute capture amp left and right */ |
| 5314 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5315 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5316 | * in (on mic1 pin) |
| 5317 | */ |
| 5318 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5319 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5320 | /* Do the same for the second ADC: mute capture input amp and |
| 5321 | * set ADC connection to line in (on mic1 pin) |
| 5322 | */ |
| 5323 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5324 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5325 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5326 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5330 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5334 | {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] | 5335 | |
| 5336 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5337 | }; |
| 5338 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5339 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5340 | * similar laptops (adapted from Fujitsu init verbs). |
| 5341 | */ |
| 5342 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5343 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5344 | * the headphone jack. Turn this on and rely on the standard mute |
| 5345 | * methods whenever the user wants to turn these outputs off. |
| 5346 | */ |
| 5347 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5348 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5349 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5350 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5351 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5352 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5353 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5354 | /* Line In jack is connected to Line1 pin */ |
| 5355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5356 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5357 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5358 | /* Ensure all other unused pins are disabled and muted. */ |
| 5359 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5360 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5361 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5362 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5365 | /* Disable digital (SPDIF) pins */ |
| 5366 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5367 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5368 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5369 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5370 | * bus when acting as outputs. |
| 5371 | */ |
| 5372 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5373 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5374 | |
| 5375 | /* Start with output sum widgets muted and their output gains at min */ |
| 5376 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5379 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5380 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5381 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5382 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5383 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5384 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5385 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5386 | /* Unmute Line-out pin widget amp left and right |
| 5387 | * (no equiv mixer ctrl) |
| 5388 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5389 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5390 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5391 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5392 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5393 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5394 | * will take care of enabling the pin's input/output buffers as needed. |
| 5395 | * Therefore there's no need to enable the input buffer at this |
| 5396 | * stage. |
| 5397 | */ |
| 5398 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5399 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5400 | |
| 5401 | /* Mute capture amp left and right */ |
| 5402 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5403 | /* Set ADC connection select to match default mixer setting - mic |
| 5404 | * (on mic1 pin) |
| 5405 | */ |
| 5406 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5407 | |
| 5408 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5409 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5410 | */ |
| 5411 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5412 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5413 | |
| 5414 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5416 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5417 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5418 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5419 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5420 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5422 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5423 | |
| 5424 | { } |
| 5425 | }; |
| 5426 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5427 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5428 | * (adapted from Acer init verbs). |
| 5429 | */ |
| 5430 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5431 | /* GPIO 0 enables the output jack. |
| 5432 | * Turn this on and rely on the standard mute |
| 5433 | * methods whenever the user wants to turn these outputs off. |
| 5434 | */ |
| 5435 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5436 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5437 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5438 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5439 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5440 | /* Ensure all other unused pins are disabled and muted. */ |
| 5441 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5442 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5443 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5444 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5445 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5446 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5451 | /* Disable digital (SPDIF) pins */ |
| 5452 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5453 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5454 | |
| 5455 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5456 | * bus when acting as outputs. |
| 5457 | */ |
| 5458 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5459 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5460 | |
| 5461 | /* Start with output sum widgets muted and their output gains at min */ |
| 5462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5463 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5468 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5469 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5471 | |
| 5472 | /* Unmute Line-out pin widget amp left and right |
| 5473 | * (no equiv mixer ctrl) |
| 5474 | */ |
| 5475 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5476 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5477 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5478 | * will take care of enabling the pin's input/output buffers as needed. |
| 5479 | * Therefore there's no need to enable the input buffer at this |
| 5480 | * stage. |
| 5481 | */ |
| 5482 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5483 | |
| 5484 | /* Mute capture amp left and right */ |
| 5485 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5486 | /* Set ADC connection select to match default mixer setting - mic |
| 5487 | * (on mic1 pin) |
| 5488 | */ |
| 5489 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5490 | |
| 5491 | /* Do similar with the second ADC: mute capture input amp and |
| 5492 | * set ADC connection to mic to match ALSA's default state. |
| 5493 | */ |
| 5494 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5495 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5496 | |
| 5497 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5506 | |
| 5507 | { } |
| 5508 | }; |
| 5509 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5510 | static struct hda_verb alc260_will_verbs[] = { |
| 5511 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5512 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5513 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5514 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5515 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5516 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5517 | {} |
| 5518 | }; |
| 5519 | |
| 5520 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5521 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5522 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5523 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5524 | |
| 5525 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5526 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5527 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5528 | |
| 5529 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5530 | {} |
| 5531 | }; |
| 5532 | |
| 5533 | /* toggle speaker-output according to the hp-jack state */ |
| 5534 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5535 | { |
| 5536 | unsigned int present; |
| 5537 | |
| 5538 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5539 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5540 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5541 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5542 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5543 | AC_VERB_SET_GPIO_DATA, 1); |
| 5544 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5545 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5546 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5547 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5548 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5549 | AC_VERB_SET_GPIO_DATA, 0); |
| 5550 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5551 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5552 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5553 | } |
| 5554 | } |
| 5555 | |
| 5556 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5557 | unsigned int res) |
| 5558 | { |
| 5559 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5560 | alc260_replacer_672v_automute(codec); |
| 5561 | } |
| 5562 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5563 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5564 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5565 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5566 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5567 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5568 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5569 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5570 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5571 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5572 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5573 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5574 | {} |
| 5575 | }; |
| 5576 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5577 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5578 | * configuration. |
| 5579 | */ |
| 5580 | #ifdef CONFIG_SND_DEBUG |
| 5581 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5582 | 0x02, |
| 5583 | }; |
| 5584 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5585 | 0x04, 0x05, |
| 5586 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5587 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5588 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5589 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5590 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5591 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5592 | { |
| 5593 | .num_items = 7, |
| 5594 | .items = { |
| 5595 | { "MIC1 pin", 0x0 }, |
| 5596 | { "MIC2 pin", 0x1 }, |
| 5597 | { "LINE1 pin", 0x2 }, |
| 5598 | { "LINE2 pin", 0x3 }, |
| 5599 | { "CD pin", 0x4 }, |
| 5600 | { "LINE-OUT pin", 0x5 }, |
| 5601 | { "HP-OUT pin", 0x6 }, |
| 5602 | }, |
| 5603 | }, |
| 5604 | { |
| 5605 | .num_items = 8, |
| 5606 | .items = { |
| 5607 | { "MIC1 pin", 0x0 }, |
| 5608 | { "MIC2 pin", 0x1 }, |
| 5609 | { "LINE1 pin", 0x2 }, |
| 5610 | { "LINE2 pin", 0x3 }, |
| 5611 | { "CD pin", 0x4 }, |
| 5612 | { "Mixer", 0x5 }, |
| 5613 | { "LINE-OUT pin", 0x6 }, |
| 5614 | { "HP-OUT pin", 0x7 }, |
| 5615 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5616 | }, |
| 5617 | }; |
| 5618 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5619 | /* Output driver widgets */ |
| 5620 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5621 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5622 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5623 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5624 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5625 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5626 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5627 | /* Modes for retasking pin widgets |
| 5628 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5629 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5630 | * mention this restriction. At this stage it's not clear whether |
| 5631 | * this behaviour is intentional or is a hardware bug in chip |
| 5632 | * revisions available at least up until early 2006. Therefore for |
| 5633 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5634 | * choices, but if it turns out that the lack of mic bias for these |
| 5635 | * NIDs is intentional we could change their modes from |
| 5636 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5637 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5638 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5639 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5640 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5641 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5642 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5643 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5644 | |
| 5645 | /* Loopback mixer controls */ |
| 5646 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5647 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5648 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5649 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5650 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5651 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5652 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5653 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5654 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5655 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5656 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5657 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5658 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5659 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5660 | |
| 5661 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5662 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5663 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5664 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5665 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5666 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5667 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5668 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5669 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5670 | */ |
| 5671 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5672 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5673 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5674 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5675 | * this output to turn on an external amplifier. |
| 5676 | */ |
| 5677 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5678 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5679 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5680 | { } /* end */ |
| 5681 | }; |
| 5682 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5683 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5684 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5685 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5686 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5687 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5688 | /* Enable retasking pins as output, initially without power amp */ |
| 5689 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5690 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5692 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5693 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5694 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5695 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5696 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5697 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5698 | * payload also sets the generation to 0, output to be in "consumer" |
| 5699 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5700 | * control. |
| 5701 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5702 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5703 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5704 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5705 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5706 | * OUT1 sum bus when acting as an output. |
| 5707 | */ |
| 5708 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5709 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5710 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5711 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5712 | |
| 5713 | /* Start with output sum widgets muted and their output gains at min */ |
| 5714 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5716 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5717 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5718 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5719 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5720 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5721 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5722 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5723 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5724 | /* Unmute retasking pin widget output buffers since the default |
| 5725 | * state appears to be output. As the pin mode is changed by the |
| 5726 | * user the pin mode control will take care of enabling the pin's |
| 5727 | * input/output buffers as needed. |
| 5728 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5729 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5730 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5732 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5733 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5734 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5735 | /* Also unmute the mono-out pin widget */ |
| 5736 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5737 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5738 | /* Mute capture amp left and right */ |
| 5739 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5740 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5741 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5742 | */ |
| 5743 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5744 | |
| 5745 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5746 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5747 | */ |
| 5748 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5749 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5750 | |
| 5751 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5752 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5755 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5756 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5757 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5758 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5760 | |
| 5761 | { } |
| 5762 | }; |
| 5763 | #endif |
| 5764 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5765 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5766 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5767 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5768 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5769 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5770 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5771 | /* |
| 5772 | * for BIOS auto-configuration |
| 5773 | */ |
| 5774 | |
| 5775 | 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] | 5776 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5777 | { |
| 5778 | hda_nid_t nid_vol; |
| 5779 | unsigned long vol_val, sw_val; |
| 5780 | char name[32]; |
| 5781 | int err; |
| 5782 | |
| 5783 | if (nid >= 0x0f && nid < 0x11) { |
| 5784 | nid_vol = nid - 0x7; |
| 5785 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5786 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5787 | } else if (nid == 0x11) { |
| 5788 | nid_vol = nid - 0x7; |
| 5789 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5790 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5791 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5792 | nid_vol = 0x08; |
| 5793 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5794 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5795 | } else |
| 5796 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5797 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5798 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5799 | /* first control for the volume widget */ |
| 5800 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5801 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5802 | if (err < 0) |
| 5803 | return err; |
| 5804 | *vol_bits |= (1 << nid_vol); |
| 5805 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5806 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5807 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5808 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5809 | return err; |
| 5810 | return 1; |
| 5811 | } |
| 5812 | |
| 5813 | /* add playback controls from the parsed DAC table */ |
| 5814 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5815 | const struct auto_pin_cfg *cfg) |
| 5816 | { |
| 5817 | hda_nid_t nid; |
| 5818 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5819 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5820 | |
| 5821 | spec->multiout.num_dacs = 1; |
| 5822 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5823 | spec->multiout.dac_nids[0] = 0x02; |
| 5824 | |
| 5825 | nid = cfg->line_out_pins[0]; |
| 5826 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5827 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5828 | if (err < 0) |
| 5829 | return err; |
| 5830 | } |
| 5831 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5832 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5834 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | if (err < 0) |
| 5836 | return err; |
| 5837 | } |
| 5838 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5839 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5840 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5841 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5842 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5843 | if (err < 0) |
| 5844 | return err; |
| 5845 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5846 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5847 | } |
| 5848 | |
| 5849 | /* create playback/capture controls for input pins */ |
| 5850 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5851 | const struct auto_pin_cfg *cfg) |
| 5852 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5853 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5854 | int i, err, idx; |
| 5855 | |
| 5856 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5857 | if (cfg->input_pins[i] >= 0x12) { |
| 5858 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5859 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5860 | auto_pin_cfg_labels[i], idx, |
| 5861 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | if (err < 0) |
| 5863 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5864 | imux->items[imux->num_items].label = |
| 5865 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | imux->items[imux->num_items].index = idx; |
| 5867 | imux->num_items++; |
| 5868 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5869 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5871 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5872 | auto_pin_cfg_labels[i], idx, |
| 5873 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5874 | if (err < 0) |
| 5875 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5876 | imux->items[imux->num_items].label = |
| 5877 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5878 | imux->items[imux->num_items].index = idx; |
| 5879 | imux->num_items++; |
| 5880 | } |
| 5881 | } |
| 5882 | return 0; |
| 5883 | } |
| 5884 | |
| 5885 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5886 | hda_nid_t nid, int pin_type, |
| 5887 | int sel_idx) |
| 5888 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5889 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | /* need the manual connection? */ |
| 5891 | if (nid >= 0x12) { |
| 5892 | int idx = nid - 0x12; |
| 5893 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5894 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5895 | } |
| 5896 | } |
| 5897 | |
| 5898 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5899 | { |
| 5900 | struct alc_spec *spec = codec->spec; |
| 5901 | hda_nid_t nid; |
| 5902 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5903 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5904 | if (nid) { |
| 5905 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5906 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5907 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5908 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5909 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5910 | if (nid) |
| 5911 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5912 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5913 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5914 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5915 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5916 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5917 | |
| 5918 | #define ALC260_PIN_CD_NID 0x16 |
| 5919 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5920 | { |
| 5921 | struct alc_spec *spec = codec->spec; |
| 5922 | int i; |
| 5923 | |
| 5924 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5925 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5926 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5927 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5928 | if (nid != ALC260_PIN_CD_NID && |
| 5929 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5930 | snd_hda_codec_write(codec, nid, 0, |
| 5931 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5932 | AMP_OUT_MUTE); |
| 5933 | } |
| 5934 | } |
| 5935 | } |
| 5936 | |
| 5937 | /* |
| 5938 | * generic initialization of ADC, input mixers and output mixers |
| 5939 | */ |
| 5940 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5941 | /* |
| 5942 | * Unmute ADC0-1 and set the default input to mic-in |
| 5943 | */ |
| 5944 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5945 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5946 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5947 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5948 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5949 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5950 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5951 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5952 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5953 | */ |
| 5954 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5955 | /* mute analog inputs */ |
| 5956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5957 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5958 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5960 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | |
| 5962 | /* |
| 5963 | * Set up output mixers (0x08 - 0x0a) |
| 5964 | */ |
| 5965 | /* set vol=0 to output mixers */ |
| 5966 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5967 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5968 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5969 | /* set up input amps for analog loopback */ |
| 5970 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5971 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5972 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5973 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5974 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5975 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5976 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5977 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | { } |
| 5979 | }; |
| 5980 | |
| 5981 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5982 | { |
| 5983 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5984 | int err; |
| 5985 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5986 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5987 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5988 | alc260_ignore); |
| 5989 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5990 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5991 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5992 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5993 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5994 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5995 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5996 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5997 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5998 | return err; |
| 5999 | |
| 6000 | spec->multiout.max_channels = 2; |
| 6001 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6002 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6003 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6004 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6005 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6006 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6007 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6009 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6010 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6011 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6012 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6013 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | return 1; |
| 6015 | } |
| 6016 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6017 | /* additional initialization for auto-configuration model */ |
| 6018 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6019 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6020 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6021 | alc260_auto_init_multi_out(codec); |
| 6022 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6023 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6024 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6025 | } |
| 6026 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6027 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6028 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6029 | { 0x07, HDA_INPUT, 0 }, |
| 6030 | { 0x07, HDA_INPUT, 1 }, |
| 6031 | { 0x07, HDA_INPUT, 2 }, |
| 6032 | { 0x07, HDA_INPUT, 3 }, |
| 6033 | { 0x07, HDA_INPUT, 4 }, |
| 6034 | { } /* end */ |
| 6035 | }; |
| 6036 | #endif |
| 6037 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6038 | /* |
| 6039 | * ALC260 configurations |
| 6040 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6041 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6042 | [ALC260_BASIC] = "basic", |
| 6043 | [ALC260_HP] = "hp", |
| 6044 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6045 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6046 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6047 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6048 | [ALC260_WILL] = "will", |
| 6049 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6050 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6051 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6052 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6053 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6054 | [ALC260_AUTO] = "auto", |
| 6055 | }; |
| 6056 | |
| 6057 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6058 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6059 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6060 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6061 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6062 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6063 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6064 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6065 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6066 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6067 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6068 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6069 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6070 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6071 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6072 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6073 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6074 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6075 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6076 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6077 | {} |
| 6078 | }; |
| 6079 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6080 | static struct alc_config_preset alc260_presets[] = { |
| 6081 | [ALC260_BASIC] = { |
| 6082 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6083 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6084 | .init_verbs = { alc260_init_verbs }, |
| 6085 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6086 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6087 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6088 | .adc_nids = alc260_adc_nids, |
| 6089 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6090 | .channel_mode = alc260_modes, |
| 6091 | .input_mux = &alc260_capture_source, |
| 6092 | }, |
| 6093 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6094 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6095 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6096 | .init_verbs = { alc260_init_verbs, |
| 6097 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6099 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6100 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6101 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6102 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6103 | .channel_mode = alc260_modes, |
| 6104 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6105 | .unsol_event = alc260_hp_unsol_event, |
| 6106 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6107 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6108 | [ALC260_HP_DC7600] = { |
| 6109 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6110 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6111 | .init_verbs = { alc260_init_verbs, |
| 6112 | alc260_hp_dc7600_verbs }, |
| 6113 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6114 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6115 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6116 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6117 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6118 | .channel_mode = alc260_modes, |
| 6119 | .input_mux = &alc260_capture_source, |
| 6120 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6121 | .init_hook = alc260_hp_3012_automute, |
| 6122 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6123 | [ALC260_HP_3013] = { |
| 6124 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6125 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6126 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6127 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6128 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6129 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6130 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6131 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6132 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6133 | .channel_mode = alc260_modes, |
| 6134 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6135 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6136 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6137 | }, |
| 6138 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6139 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6140 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6141 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6142 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6143 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6144 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6145 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6146 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6147 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6148 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6150 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6151 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6152 | .init_verbs = { alc260_acer_init_verbs }, |
| 6153 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6154 | .dac_nids = alc260_dac_nids, |
| 6155 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6156 | .adc_nids = alc260_dual_adc_nids, |
| 6157 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6158 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6159 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6160 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6161 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6162 | [ALC260_FAVORIT100] = { |
| 6163 | .mixers = { alc260_favorit100_mixer }, |
| 6164 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6165 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6166 | .dac_nids = alc260_dac_nids, |
| 6167 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6168 | .adc_nids = alc260_dual_adc_nids, |
| 6169 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6170 | .channel_mode = alc260_modes, |
| 6171 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6172 | .input_mux = alc260_favorit100_capture_sources, |
| 6173 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6174 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6175 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6176 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6177 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6178 | .dac_nids = alc260_dac_nids, |
| 6179 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6180 | .adc_nids = alc260_adc_nids, |
| 6181 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6182 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6183 | .channel_mode = alc260_modes, |
| 6184 | .input_mux = &alc260_capture_source, |
| 6185 | }, |
| 6186 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6187 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6188 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6189 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6190 | .dac_nids = alc260_dac_nids, |
| 6191 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6192 | .adc_nids = alc260_adc_nids, |
| 6193 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6194 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6195 | .channel_mode = alc260_modes, |
| 6196 | .input_mux = &alc260_capture_source, |
| 6197 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6198 | .init_hook = alc260_replacer_672v_automute, |
| 6199 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6200 | #ifdef CONFIG_SND_DEBUG |
| 6201 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6202 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6203 | .init_verbs = { alc260_test_init_verbs }, |
| 6204 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6205 | .dac_nids = alc260_test_dac_nids, |
| 6206 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6207 | .adc_nids = alc260_test_adc_nids, |
| 6208 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6209 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6210 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6211 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6212 | }, |
| 6213 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6214 | }; |
| 6215 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6216 | static int patch_alc260(struct hda_codec *codec) |
| 6217 | { |
| 6218 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6219 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6220 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6221 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6222 | if (spec == NULL) |
| 6223 | return -ENOMEM; |
| 6224 | |
| 6225 | codec->spec = spec; |
| 6226 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6227 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6228 | alc260_models, |
| 6229 | alc260_cfg_tbl); |
| 6230 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6231 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6232 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6234 | } |
| 6235 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6236 | if (board_config == ALC260_AUTO) { |
| 6237 | /* automatic parse from the BIOS config */ |
| 6238 | err = alc260_parse_auto_config(codec); |
| 6239 | if (err < 0) { |
| 6240 | alc_free(codec); |
| 6241 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6242 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6243 | printk(KERN_INFO |
| 6244 | "hda_codec: Cannot set up configuration " |
| 6245 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6246 | board_config = ALC260_BASIC; |
| 6247 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6248 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6249 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6250 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6251 | if (err < 0) { |
| 6252 | alc_free(codec); |
| 6253 | return err; |
| 6254 | } |
| 6255 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6256 | if (board_config != ALC260_AUTO) |
| 6257 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6258 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6259 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6260 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6261 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6262 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6263 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6264 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6265 | if (!spec->adc_nids && spec->input_mux) { |
| 6266 | /* check whether NID 0x04 is valid */ |
| 6267 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6268 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6269 | /* get type */ |
| 6270 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6271 | spec->adc_nids = alc260_adc_nids_alt; |
| 6272 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6273 | } else { |
| 6274 | spec->adc_nids = alc260_adc_nids; |
| 6275 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6276 | } |
| 6277 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6278 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6279 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6280 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6281 | spec->vmaster_nid = 0x08; |
| 6282 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6283 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6284 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6285 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6286 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6287 | if (!spec->loopback.amplist) |
| 6288 | spec->loopback.amplist = alc260_loopbacks; |
| 6289 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6290 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6291 | |
| 6292 | return 0; |
| 6293 | } |
| 6294 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6295 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6296 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6297 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6298 | * |
| 6299 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6300 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6301 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6302 | * 6-channel independent captures. |
| 6303 | * |
| 6304 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6305 | * driver yet). |
| 6306 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6307 | #define ALC882_DIGOUT_NID 0x06 |
| 6308 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6309 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6310 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6311 | #define ALC1200_DIGOUT_NID 0x10 |
| 6312 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6313 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6314 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6315 | { 8, NULL } |
| 6316 | }; |
| 6317 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6318 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6319 | static hda_nid_t alc882_dac_nids[4] = { |
| 6320 | /* front, rear, clfe, rear_surr */ |
| 6321 | 0x02, 0x03, 0x04, 0x05 |
| 6322 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6323 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6324 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6325 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6326 | #define alc882_adc_nids alc880_adc_nids |
| 6327 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6328 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6329 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6330 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6331 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6332 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6333 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6334 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6335 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6336 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6337 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6338 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6339 | /* input MUX */ |
| 6340 | /* FIXME: should be a matrix-type input source selection */ |
| 6341 | |
| 6342 | static struct hda_input_mux alc882_capture_source = { |
| 6343 | .num_items = 4, |
| 6344 | .items = { |
| 6345 | { "Mic", 0x0 }, |
| 6346 | { "Front Mic", 0x1 }, |
| 6347 | { "Line", 0x2 }, |
| 6348 | { "CD", 0x4 }, |
| 6349 | }, |
| 6350 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6351 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6352 | #define alc883_capture_source alc882_capture_source |
| 6353 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6354 | static struct hda_input_mux alc889_capture_source = { |
| 6355 | .num_items = 3, |
| 6356 | .items = { |
| 6357 | { "Front Mic", 0x0 }, |
| 6358 | { "Mic", 0x3 }, |
| 6359 | { "Line", 0x2 }, |
| 6360 | }, |
| 6361 | }; |
| 6362 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6363 | static struct hda_input_mux mb5_capture_source = { |
| 6364 | .num_items = 3, |
| 6365 | .items = { |
| 6366 | { "Mic", 0x1 }, |
| 6367 | { "Line", 0x2 }, |
| 6368 | { "CD", 0x4 }, |
| 6369 | }, |
| 6370 | }; |
| 6371 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6372 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6373 | .num_items = 4, |
| 6374 | .items = { |
| 6375 | { "Mic", 0x1 }, |
| 6376 | { "Front Mic", 0x0 }, |
| 6377 | { "Line", 0x2 }, |
| 6378 | { "CD", 0x4 }, |
| 6379 | }, |
| 6380 | }; |
| 6381 | |
| 6382 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6383 | .num_items = 2, |
| 6384 | .items = { |
| 6385 | { "Mic", 0x1 }, |
| 6386 | { "Line", 0x2 }, |
| 6387 | }, |
| 6388 | }; |
| 6389 | |
| 6390 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6391 | .num_items = 4, |
| 6392 | .items = { |
| 6393 | { "Mic", 0x0 }, |
| 6394 | { "iMic", 0x1 }, |
| 6395 | { "Line", 0x2 }, |
| 6396 | { "CD", 0x4 }, |
| 6397 | }, |
| 6398 | }; |
| 6399 | |
| 6400 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6401 | .num_items = 2, |
| 6402 | .items = { |
| 6403 | { "Mic", 0x0 }, |
| 6404 | { "Int Mic", 0x1 }, |
| 6405 | }, |
| 6406 | }; |
| 6407 | |
| 6408 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6409 | .num_items = 3, |
| 6410 | .items = { |
| 6411 | { "Mic", 0x0 }, |
| 6412 | { "Front Mic", 0x1 }, |
| 6413 | { "Line", 0x4 }, |
| 6414 | }, |
| 6415 | }; |
| 6416 | |
| 6417 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6418 | .num_items = 2, |
| 6419 | .items = { |
| 6420 | { "Mic", 0x0 }, |
| 6421 | { "Line", 0x2 }, |
| 6422 | }, |
| 6423 | }; |
| 6424 | |
| 6425 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6426 | .num_items = 2, |
| 6427 | .items = { |
| 6428 | { "Mic", 0x0 }, |
| 6429 | /* Front Mic (0x01) unused */ |
| 6430 | { "Line", 0x2 }, |
| 6431 | /* Line 2 (0x03) unused */ |
| 6432 | /* CD (0x04) unsused? */ |
| 6433 | }, |
| 6434 | }; |
| 6435 | |
| 6436 | /* |
| 6437 | * 2ch mode |
| 6438 | */ |
| 6439 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6440 | { 2, NULL } |
| 6441 | }; |
| 6442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6443 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6444 | * 2ch mode |
| 6445 | */ |
| 6446 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6447 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6448 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6449 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6450 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6451 | { } /* end */ |
| 6452 | }; |
| 6453 | |
| 6454 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6455 | * 4ch mode |
| 6456 | */ |
| 6457 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6458 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6459 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6460 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6461 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6462 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6463 | { } /* end */ |
| 6464 | }; |
| 6465 | |
| 6466 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6467 | * 6ch mode |
| 6468 | */ |
| 6469 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6470 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6471 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6472 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6473 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6474 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6475 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6476 | { } /* end */ |
| 6477 | }; |
| 6478 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6479 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6480 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6481 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6482 | { 6, alc882_3ST_ch6_init }, |
| 6483 | }; |
| 6484 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6485 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6486 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6487 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6488 | * 6ch mode |
| 6489 | */ |
| 6490 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6491 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6492 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6493 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6494 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6495 | { } /* end */ |
| 6496 | }; |
| 6497 | |
| 6498 | /* |
| 6499 | * 8ch mode |
| 6500 | */ |
| 6501 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6502 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6503 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6504 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6505 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6506 | { } /* end */ |
| 6507 | }; |
| 6508 | |
| 6509 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6510 | { 6, alc882_sixstack_ch6_init }, |
| 6511 | { 8, alc882_sixstack_ch8_init }, |
| 6512 | }; |
| 6513 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6514 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6515 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6516 | */ |
| 6517 | |
| 6518 | /* |
| 6519 | * 2ch mode |
| 6520 | */ |
| 6521 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6522 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6523 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6524 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6525 | { } /* end */ |
| 6526 | }; |
| 6527 | |
| 6528 | /* |
| 6529 | * 6ch mode |
| 6530 | */ |
| 6531 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6532 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6533 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6534 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6535 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6536 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6537 | { } /* end */ |
| 6538 | }; |
| 6539 | |
| 6540 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6541 | { 2, alc885_mbp_ch2_init }, |
| 6542 | { 6, alc885_mbp_ch6_init }, |
| 6543 | }; |
| 6544 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6545 | /* |
| 6546 | * 2ch |
| 6547 | * Speakers/Woofer/HP = Front |
| 6548 | * LineIn = Input |
| 6549 | */ |
| 6550 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6553 | { } /* end */ |
| 6554 | }; |
| 6555 | |
| 6556 | /* |
| 6557 | * 6ch mode |
| 6558 | * Speakers/HP = Front |
| 6559 | * Woofer = LFE |
| 6560 | * LineIn = Surround |
| 6561 | */ |
| 6562 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6563 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6564 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6565 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6566 | { } /* end */ |
| 6567 | }; |
| 6568 | |
| 6569 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6570 | { 2, alc885_mb5_ch2_init }, |
| 6571 | { 6, alc885_mb5_ch6_init }, |
| 6572 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6573 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6574 | |
| 6575 | /* |
| 6576 | * 2ch mode |
| 6577 | */ |
| 6578 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6579 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6580 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6581 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6582 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6583 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6584 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6585 | { } /* end */ |
| 6586 | }; |
| 6587 | |
| 6588 | /* |
| 6589 | * 4ch mode |
| 6590 | */ |
| 6591 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6592 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6593 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6594 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6595 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6596 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6597 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6598 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6599 | { } /* end */ |
| 6600 | }; |
| 6601 | |
| 6602 | /* |
| 6603 | * 6ch mode |
| 6604 | */ |
| 6605 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6606 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6607 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6608 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6609 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6610 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6611 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6612 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6613 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6614 | { } /* end */ |
| 6615 | }; |
| 6616 | |
| 6617 | /* |
| 6618 | * 8ch mode |
| 6619 | */ |
| 6620 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6621 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6622 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6623 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6624 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6625 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6626 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6627 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6628 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6629 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6630 | { } /* end */ |
| 6631 | }; |
| 6632 | |
| 6633 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6634 | { 2, alc883_4ST_ch2_init }, |
| 6635 | { 4, alc883_4ST_ch4_init }, |
| 6636 | { 6, alc883_4ST_ch6_init }, |
| 6637 | { 8, alc883_4ST_ch8_init }, |
| 6638 | }; |
| 6639 | |
| 6640 | |
| 6641 | /* |
| 6642 | * 2ch mode |
| 6643 | */ |
| 6644 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6645 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6646 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6647 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6648 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6649 | { } /* end */ |
| 6650 | }; |
| 6651 | |
| 6652 | /* |
| 6653 | * 4ch mode |
| 6654 | */ |
| 6655 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6656 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6657 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6658 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6659 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6660 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6661 | { } /* end */ |
| 6662 | }; |
| 6663 | |
| 6664 | /* |
| 6665 | * 6ch mode |
| 6666 | */ |
| 6667 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6668 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6669 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6670 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6671 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6672 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6673 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6674 | { } /* end */ |
| 6675 | }; |
| 6676 | |
| 6677 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6678 | { 2, alc883_3ST_ch2_intel_init }, |
| 6679 | { 4, alc883_3ST_ch4_intel_init }, |
| 6680 | { 6, alc883_3ST_ch6_intel_init }, |
| 6681 | }; |
| 6682 | |
| 6683 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame^] | 6684 | * 2ch mode |
| 6685 | */ |
| 6686 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6687 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6688 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6689 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6690 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6691 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6692 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6693 | { } /* end */ |
| 6694 | }; |
| 6695 | |
| 6696 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6697 | * 6ch mode |
| 6698 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6699 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame^] | 6700 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6701 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6702 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6703 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6704 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6705 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6706 | { } /* end */ |
| 6707 | }; |
| 6708 | |
| 6709 | /* |
| 6710 | * 8ch mode |
| 6711 | */ |
| 6712 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame^] | 6713 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6714 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6715 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6716 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6717 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6718 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6719 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6720 | { } /* end */ |
| 6721 | }; |
| 6722 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame^] | 6723 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6724 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6725 | { 6, alc889_ch6_intel_init }, |
| 6726 | { 8, alc889_ch8_intel_init }, |
| 6727 | }; |
| 6728 | |
| 6729 | /* |
| 6730 | * 6ch mode |
| 6731 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6732 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6733 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6734 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6735 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6736 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6737 | { } /* end */ |
| 6738 | }; |
| 6739 | |
| 6740 | /* |
| 6741 | * 8ch mode |
| 6742 | */ |
| 6743 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6744 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6745 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6746 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6747 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6748 | { } /* end */ |
| 6749 | }; |
| 6750 | |
| 6751 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6752 | { 6, alc883_sixstack_ch6_init }, |
| 6753 | { 8, alc883_sixstack_ch8_init }, |
| 6754 | }; |
| 6755 | |
| 6756 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6757 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6758 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6759 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6760 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6761 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6762 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6763 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6764 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6765 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6766 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6767 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6768 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6769 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6770 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6772 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6773 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6774 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6775 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6777 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6778 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6779 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6780 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6781 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6782 | { } /* end */ |
| 6783 | }; |
| 6784 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6785 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6787 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6788 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6789 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6790 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6791 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6792 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6793 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6794 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6795 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6796 | { } /* end */ |
| 6797 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6798 | |
| 6799 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6800 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6801 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6802 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6803 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6804 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6805 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6806 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6807 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6808 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6809 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6811 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6812 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6813 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6814 | { } /* end */ |
| 6815 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6816 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6817 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6818 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6819 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6820 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6821 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6822 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6823 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6825 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6827 | { } /* end */ |
| 6828 | }; |
| 6829 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6830 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6831 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6832 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6833 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6834 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6835 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6836 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6837 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6840 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6841 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6842 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6843 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6844 | { } /* end */ |
| 6845 | }; |
| 6846 | |
| 6847 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6848 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6849 | */ |
| 6850 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6851 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6852 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6853 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6854 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6855 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6856 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6857 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6858 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6859 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6860 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6862 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6863 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6864 | { } /* end */ |
| 6865 | }; |
| 6866 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6867 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6868 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6869 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6870 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6871 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6872 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6873 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6874 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6876 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6878 | { } /* end */ |
| 6879 | }; |
| 6880 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6881 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6882 | { |
| 6883 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6884 | .name = "Channel Mode", |
| 6885 | .info = alc_ch_mode_info, |
| 6886 | .get = alc_ch_mode_get, |
| 6887 | .put = alc_ch_mode_put, |
| 6888 | }, |
| 6889 | { } /* end */ |
| 6890 | }; |
| 6891 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6892 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6893 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6895 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6896 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6897 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6898 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6899 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6901 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6902 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6905 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6906 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6907 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6908 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6909 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 6910 | /* mute analog input loopbacks */ |
| 6911 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6912 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6913 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6916 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6917 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6918 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6919 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6920 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6921 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6924 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6925 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6926 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6927 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6928 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6929 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6930 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6931 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6932 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6933 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6934 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6935 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6936 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6937 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6938 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6939 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6940 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6941 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6942 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6943 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6944 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6945 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6946 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6947 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6948 | |
| 6949 | /* FIXME: use matrix-type input source selection */ |
| 6950 | /* 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] | 6951 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6952 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6953 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6954 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6955 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6956 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6957 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6958 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6959 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6960 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6961 | /* ADC2: mute amp left and right */ |
| 6962 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6963 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6964 | /* ADC3: mute amp left and right */ |
| 6965 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6966 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6967 | |
| 6968 | { } |
| 6969 | }; |
| 6970 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6971 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 6972 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6976 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6977 | /* ADC1: mute amp left and right */ |
| 6978 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6979 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6980 | { } |
| 6981 | }; |
| 6982 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6983 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6984 | /* change to EAPD mode */ |
| 6985 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6986 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6987 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6988 | }; |
| 6989 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6990 | static struct hda_verb alc889_eapd_verbs[] = { |
| 6991 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 6992 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 6993 | { } |
| 6994 | }; |
| 6995 | |
| 6996 | |
| 6997 | static struct hda_verb alc885_init_verbs[] = { |
| 6998 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6999 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7000 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7001 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7002 | /* Rear mixer */ |
| 7003 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7004 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7005 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7006 | /* CLFE mixer */ |
| 7007 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7008 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7009 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7010 | /* Side mixer */ |
| 7011 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7012 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7013 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7014 | |
| 7015 | /* mute analog input loopbacks */ |
| 7016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7017 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7018 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7019 | |
| 7020 | /* Front HP Pin: output 0 (0x0c) */ |
| 7021 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7022 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7023 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7024 | /* Front Pin: output 0 (0x0c) */ |
| 7025 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7026 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7027 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7028 | /* Rear Pin: output 1 (0x0d) */ |
| 7029 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7030 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7031 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7032 | /* CLFE Pin: output 2 (0x0e) */ |
| 7033 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7034 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7035 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7036 | /* Side Pin: output 3 (0x0f) */ |
| 7037 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7038 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7039 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7040 | /* Mic (rear) pin: input vref at 80% */ |
| 7041 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7042 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7043 | /* Front Mic pin: input vref at 80% */ |
| 7044 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7045 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7046 | /* Line In pin: input */ |
| 7047 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7048 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7049 | |
| 7050 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7051 | /* Input mixer1 */ |
| 7052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7054 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7055 | /* Input mixer2 */ |
| 7056 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7057 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7058 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7059 | /* Input mixer3 */ |
| 7060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7063 | /* ADC2: mute amp left and right */ |
| 7064 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7065 | /* ADC3: mute amp left and right */ |
| 7066 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7067 | |
| 7068 | { } |
| 7069 | }; |
| 7070 | |
| 7071 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7074 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7075 | { } |
| 7076 | }; |
| 7077 | |
| 7078 | |
| 7079 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7080 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7081 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7083 | { } |
| 7084 | }; |
| 7085 | |
| 7086 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7087 | #define alc883_init_verbs alc882_base_init_verbs |
| 7088 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7089 | /* Mac Pro test */ |
| 7090 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7091 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7092 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7093 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7094 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7095 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7096 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7097 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7098 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7099 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7100 | { } /* end */ |
| 7101 | }; |
| 7102 | |
| 7103 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7104 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7105 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7106 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7108 | /* Front Pin: output 0 (0x0c) */ |
| 7109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7110 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7111 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7112 | /* Front Mic pin: input vref at 80% */ |
| 7113 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7114 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7115 | /* Speaker: output */ |
| 7116 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7117 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7118 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7119 | /* Headphone output (output 0 - 0x0c) */ |
| 7120 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7121 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7122 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7123 | |
| 7124 | /* FIXME: use matrix-type input source selection */ |
| 7125 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7126 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7127 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7128 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7129 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7130 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7131 | /* Input mixer2 */ |
| 7132 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7133 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7134 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7135 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7136 | /* Input mixer3 */ |
| 7137 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7138 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7140 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7141 | /* ADC1: mute amp left and right */ |
| 7142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7143 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7144 | /* ADC2: mute amp left and right */ |
| 7145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7146 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7147 | /* ADC3: mute amp left and right */ |
| 7148 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7149 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7150 | |
| 7151 | { } |
| 7152 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7153 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7154 | /* Macbook 5,1 */ |
| 7155 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7156 | /* DACs */ |
| 7157 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7158 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7159 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7160 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7161 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7162 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7164 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7165 | /* Surround mixer */ |
| 7166 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7167 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7168 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7169 | /* LFE mixer */ |
| 7170 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7171 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7172 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7173 | /* HP mixer */ |
| 7174 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7175 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7176 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7177 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7178 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7179 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7180 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7181 | /* LFE Pin (0x0e) */ |
| 7182 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7183 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7184 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7185 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7186 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7187 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7188 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7189 | /* Front Mic pin: input vref at 80% */ |
| 7190 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7191 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7192 | /* Line In pin */ |
| 7193 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7194 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7195 | |
| 7196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7197 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7200 | { } |
| 7201 | }; |
| 7202 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7203 | /* Macbook Pro rev3 */ |
| 7204 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7205 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7206 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7207 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7208 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7209 | /* Rear mixer */ |
| 7210 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7211 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7212 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7213 | /* Front Pin: output 0 (0x0c) */ |
| 7214 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7215 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7216 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7217 | /* HP Pin: output 0 (0x0d) */ |
| 7218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7219 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7220 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7221 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7222 | /* Mic (rear) pin: input vref at 80% */ |
| 7223 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7224 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7225 | /* Front Mic pin: input vref at 80% */ |
| 7226 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7227 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7228 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7229 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7230 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7231 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7232 | |
| 7233 | /* FIXME: use matrix-type input source selection */ |
| 7234 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7235 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7236 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7237 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7238 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7240 | /* Input mixer2 */ |
| 7241 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7242 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7243 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7244 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7245 | /* Input mixer3 */ |
| 7246 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7248 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7249 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7250 | /* ADC1: mute amp left and right */ |
| 7251 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7252 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7253 | /* ADC2: mute amp left and right */ |
| 7254 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7255 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7256 | /* ADC3: mute amp left and right */ |
| 7257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7258 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7259 | |
| 7260 | { } |
| 7261 | }; |
| 7262 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7263 | /* iMac 24 mixer. */ |
| 7264 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7265 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7266 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7267 | { } /* end */ |
| 7268 | }; |
| 7269 | |
| 7270 | /* iMac 24 init verbs. */ |
| 7271 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7272 | /* Internal speakers: output 0 (0x0c) */ |
| 7273 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7274 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7275 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7276 | /* Internal speakers: output 0 (0x0c) */ |
| 7277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7278 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7279 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7280 | /* Headphone: output 0 (0x0c) */ |
| 7281 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7282 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7283 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7284 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7285 | /* Front Mic: input vref at 80% */ |
| 7286 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7287 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7288 | { } |
| 7289 | }; |
| 7290 | |
| 7291 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7292 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7293 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7294 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7295 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7296 | spec->autocfg.hp_pins[0] = 0x14; |
| 7297 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7298 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 7299 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7300 | } |
| 7301 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7302 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7303 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7304 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7305 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7306 | spec->autocfg.hp_pins[0] = 0x15; |
| 7307 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7308 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7309 | } |
| 7310 | |
| 7311 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7312 | static struct hda_verb alc882_targa_verbs[] = { |
| 7313 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7314 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7315 | |
| 7316 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7318 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7319 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7320 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7321 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7322 | |
| 7323 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7324 | { } /* end */ |
| 7325 | }; |
| 7326 | |
| 7327 | /* toggle speaker-output according to the hp-jack state */ |
| 7328 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7329 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7330 | struct alc_spec *spec = codec->spec; |
| 7331 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7332 | 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] | 7333 | spec->jack_present ? 1 : 3); |
| 7334 | } |
| 7335 | |
| 7336 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 7337 | { |
| 7338 | struct alc_spec *spec = codec->spec; |
| 7339 | |
| 7340 | spec->autocfg.hp_pins[0] = 0x14; |
| 7341 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 7342 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7343 | } |
| 7344 | |
| 7345 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7346 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7347 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7348 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7349 | } |
| 7350 | |
| 7351 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7352 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7353 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7354 | |
| 7355 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7356 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7357 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7358 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7359 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7360 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7361 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7362 | |
| 7363 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7364 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7365 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7366 | { } /* end */ |
| 7367 | }; |
| 7368 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7369 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7371 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7372 | |
| 7373 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7374 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7375 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7376 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7377 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7378 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7379 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7380 | |
| 7381 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7382 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7383 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7384 | { } /* end */ |
| 7385 | }; |
| 7386 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7387 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7388 | { |
| 7389 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7390 | |
| 7391 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7392 | AC_VERB_GET_GPIO_DATA, 0); |
| 7393 | |
| 7394 | if (!muted) |
| 7395 | gpiostate |= (1 << pin); |
| 7396 | else |
| 7397 | gpiostate &= ~(1 << pin); |
| 7398 | |
| 7399 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7400 | AC_VERB_GET_GPIO_MASK, 0); |
| 7401 | gpiomask |= (1 << pin); |
| 7402 | |
| 7403 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7404 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7405 | gpiodir |= (1 << pin); |
| 7406 | |
| 7407 | |
| 7408 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7409 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7410 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7411 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7412 | |
| 7413 | msleep(1); |
| 7414 | |
| 7415 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7416 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7417 | } |
| 7418 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7419 | /* set up GPIO at initialization */ |
| 7420 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7421 | { |
| 7422 | alc882_gpio_mute(codec, 0, 0); |
| 7423 | alc882_gpio_mute(codec, 1, 0); |
| 7424 | } |
| 7425 | |
| 7426 | /* set up GPIO and update auto-muting at initialization */ |
| 7427 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7428 | { |
| 7429 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7430 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7431 | } |
| 7432 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7433 | /* |
| 7434 | * generic initialization of ADC, input mixers and output mixers |
| 7435 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7436 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7437 | /* |
| 7438 | * Unmute ADC0-2 and set the default input to mic-in |
| 7439 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7440 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7441 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7442 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7443 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7444 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7445 | /* 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] | 7446 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7447 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7448 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7449 | */ |
| 7450 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7451 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7452 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7453 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7454 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7455 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7456 | |
| 7457 | /* |
| 7458 | * Set up output mixers (0x0c - 0x0f) |
| 7459 | */ |
| 7460 | /* set vol=0 to output mixers */ |
| 7461 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7462 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7463 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7464 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7465 | /* set up input amps for analog loopback */ |
| 7466 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7467 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7468 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7469 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7470 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7471 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7472 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7473 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7474 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7475 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7476 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7477 | |
| 7478 | /* FIXME: use matrix-type input source selection */ |
| 7479 | /* 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] | 7480 | /* Input mixer2 */ |
| 7481 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7482 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7483 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7484 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7485 | /* Input mixer3 */ |
| 7486 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7487 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7488 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7489 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7490 | |
| 7491 | { } |
| 7492 | }; |
| 7493 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7494 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7495 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7496 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7497 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7498 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7499 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7500 | { } /* end */ |
| 7501 | }; |
| 7502 | |
| 7503 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7504 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7505 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7506 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7507 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7508 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7509 | { } /* end */ |
| 7510 | }; |
| 7511 | |
| 7512 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7513 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7514 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7515 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7516 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7517 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7518 | { } /* end */ |
| 7519 | }; |
| 7520 | |
| 7521 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7522 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7523 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7524 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7525 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7526 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7527 | { } /* end */ |
| 7528 | }; |
| 7529 | |
| 7530 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7531 | { 2, alc889A_mb31_ch2_init }, |
| 7532 | { 4, alc889A_mb31_ch4_init }, |
| 7533 | { 5, alc889A_mb31_ch5_init }, |
| 7534 | { 6, alc889A_mb31_ch6_init }, |
| 7535 | }; |
| 7536 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7537 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7538 | /* eanable EAPD on medion laptop */ |
| 7539 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7540 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7541 | { } |
| 7542 | }; |
| 7543 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7544 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7545 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7546 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7548 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7549 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7550 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7551 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7552 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7553 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7554 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7555 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7557 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7558 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7559 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7560 | { } /* end */ |
| 7561 | }; |
| 7562 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7563 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7564 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7565 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7566 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7567 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7568 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7569 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7570 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7571 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7572 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7573 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7574 | { } /* end */ |
| 7575 | }; |
| 7576 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7577 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7578 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7579 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7580 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7581 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7582 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7583 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7584 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7585 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7586 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7587 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7588 | { } /* end */ |
| 7589 | }; |
| 7590 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7591 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7592 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7593 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7594 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7595 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7596 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7597 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7598 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7599 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7600 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7601 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7602 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7603 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7604 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7605 | { } /* end */ |
| 7606 | }; |
| 7607 | |
| 7608 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7610 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7611 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7612 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7613 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7614 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7615 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7616 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7617 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7618 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7619 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7620 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7621 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7622 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7623 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7625 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7626 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7627 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7628 | { } /* end */ |
| 7629 | }; |
| 7630 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7631 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7634 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7635 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7636 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7637 | HDA_OUTPUT), |
| 7638 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7639 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7640 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7641 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7642 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7643 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7645 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7647 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7649 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7650 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7651 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7652 | { } /* end */ |
| 7653 | }; |
| 7654 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7655 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7656 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7657 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7658 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7659 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7660 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7661 | HDA_OUTPUT), |
| 7662 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7663 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7664 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7665 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7666 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7668 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7669 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7671 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7672 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7673 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7674 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7675 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7676 | { } /* end */ |
| 7677 | }; |
| 7678 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7679 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7680 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7681 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7682 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7683 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7684 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7685 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7686 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7687 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7689 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7690 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7691 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7692 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7693 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7694 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7696 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7697 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7698 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7699 | { } /* end */ |
| 7700 | }; |
| 7701 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7702 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7703 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7704 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7705 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7706 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7707 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7708 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7709 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7710 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7711 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7712 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7713 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7714 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7715 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7716 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7717 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7718 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7719 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7720 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7721 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7722 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7723 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7724 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7725 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7726 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7727 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7728 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7729 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7730 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7731 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7732 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7733 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7734 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7735 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7736 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7737 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7738 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7739 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7740 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7741 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7742 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7744 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7745 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7746 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7747 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7748 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7749 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7750 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7751 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7752 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7753 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7754 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7756 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7757 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7758 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7759 | { } /* end */ |
| 7760 | }; |
| 7761 | |
| 7762 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7763 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7764 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7765 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7766 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7767 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7768 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7769 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7770 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7771 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7772 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7773 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7774 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7775 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7776 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7777 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7778 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7779 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7780 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7781 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7782 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7783 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7784 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7785 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7786 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7787 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 7788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7789 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7790 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7791 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 7792 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7793 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7794 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7795 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7797 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7798 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7799 | { } /* end */ |
| 7800 | }; |
| 7801 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7802 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7803 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7804 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7805 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7806 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7807 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7808 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7809 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7810 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7811 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7812 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7813 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7814 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7815 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7817 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7819 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7821 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7822 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7823 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7824 | { } /* end */ |
| 7825 | }; |
| 7826 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7827 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 7828 | /* Output mixers */ |
| 7829 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7830 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7831 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7832 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7833 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 7834 | HDA_OUTPUT), |
| 7835 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 7836 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 7837 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 7838 | /* Output switches */ |
| 7839 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 7840 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 7841 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 7842 | /* Boost mixers */ |
| 7843 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7844 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 7845 | /* Input mixers */ |
| 7846 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7847 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7848 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7849 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7850 | { } /* end */ |
| 7851 | }; |
| 7852 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 7853 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 7854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7855 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7857 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7858 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7859 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7860 | { } /* end */ |
| 7861 | }; |
| 7862 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7863 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7864 | .ops = &snd_hda_bind_vol, |
| 7865 | .values = { |
| 7866 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7867 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7868 | 0 |
| 7869 | }, |
| 7870 | }; |
| 7871 | |
| 7872 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7873 | .ops = &snd_hda_bind_sw, |
| 7874 | .values = { |
| 7875 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7876 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7877 | 0 |
| 7878 | }, |
| 7879 | }; |
| 7880 | |
| 7881 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7882 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7883 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7884 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7885 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7886 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7887 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7888 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7889 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7890 | { } /* end */ |
| 7891 | }; |
| 7892 | |
| 7893 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7894 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7895 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7896 | { |
| 7897 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7898 | /* .name = "Capture Source", */ |
| 7899 | .name = "Input Source", |
| 7900 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7901 | .info = alc_mux_enum_info, |
| 7902 | .get = alc_mux_enum_get, |
| 7903 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7904 | }, |
| 7905 | { } /* end */ |
| 7906 | }; |
| 7907 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7908 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7909 | { |
| 7910 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7911 | .name = "Channel Mode", |
| 7912 | .info = alc_ch_mode_info, |
| 7913 | .get = alc_ch_mode_get, |
| 7914 | .put = alc_ch_mode_put, |
| 7915 | }, |
| 7916 | { } /* end */ |
| 7917 | }; |
| 7918 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7919 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7920 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7921 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7922 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7923 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7924 | spec->autocfg.hp_pins[0] = 0x15; |
| 7925 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7926 | spec->autocfg.speaker_pins[1] = 0x17; |
| 7927 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7928 | } |
| 7929 | |
| 7930 | /* auto-toggle front mic */ |
| 7931 | /* |
| 7932 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7933 | { |
| 7934 | unsigned int present; |
| 7935 | unsigned char bits; |
| 7936 | |
| 7937 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7938 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7939 | bits = present ? HDA_AMP_MUTE : 0; |
| 7940 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7941 | } |
| 7942 | */ |
| 7943 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7944 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7945 | /* HP */ |
| 7946 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7947 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7948 | /* Subwoofer */ |
| 7949 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7950 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7951 | |
| 7952 | /* enable unsolicited event */ |
| 7953 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7954 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7955 | |
| 7956 | { } /* end */ |
| 7957 | }; |
| 7958 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7959 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7960 | /* HP */ |
| 7961 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7962 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7963 | /* Int speaker */ |
| 7964 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7965 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7966 | |
| 7967 | /* enable unsolicited event */ |
| 7968 | {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] | 7969 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7970 | |
| 7971 | { } /* end */ |
| 7972 | }; |
| 7973 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7974 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7975 | /* HP */ |
| 7976 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7977 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7978 | /* Subwoofer */ |
| 7979 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7980 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7981 | |
| 7982 | /* enable unsolicited event */ |
| 7983 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7984 | |
| 7985 | { } /* end */ |
| 7986 | }; |
| 7987 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7988 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7989 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7990 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7991 | |
| 7992 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7993 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7994 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7995 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 7996 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7997 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7998 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7999 | /* Connect Mic jack to CLFE */ |
| 8000 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8001 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8002 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8003 | /* Connect Line-in jack to Surround */ |
| 8004 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8005 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8006 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8007 | /* Connect HP out jack to Front */ |
| 8008 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8009 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8010 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8011 | |
| 8012 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8013 | |
| 8014 | { } /* end */ |
| 8015 | }; |
| 8016 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8017 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8018 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8019 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8020 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8021 | { } /* end */ |
| 8022 | }; |
| 8023 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8024 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8025 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8026 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8027 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8029 | { } /* end */ |
| 8030 | }; |
| 8031 | |
| 8032 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8033 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8035 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8036 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8037 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8038 | { } /* end */ |
| 8039 | }; |
| 8040 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8041 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8042 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8043 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8044 | |
| 8045 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8046 | |
| 8047 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8048 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8049 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8051 | { } /* end */ |
| 8052 | }; |
| 8053 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8054 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8058 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8059 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8060 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8061 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8062 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8063 | { } /* end */ |
| 8064 | }; |
| 8065 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8066 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8067 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8068 | { } |
| 8069 | }; |
| 8070 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8071 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8072 | /* HP */ |
| 8073 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8075 | |
| 8076 | /* enable unsolicited event */ |
| 8077 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8078 | |
| 8079 | { } /* end */ |
| 8080 | }; |
| 8081 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8082 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8083 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8084 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8085 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8086 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8087 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8088 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8089 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8090 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8091 | } |
| 8092 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8093 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8094 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8095 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8096 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8097 | {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] | 8098 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8099 | }; |
| 8100 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8101 | /* |
| 8102 | * 2ch mode |
| 8103 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8104 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8105 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8106 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8107 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8108 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8109 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8110 | }; |
| 8111 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8112 | /* |
| 8113 | * 4ch mode |
| 8114 | */ |
| 8115 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8116 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8117 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8118 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8119 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8120 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8121 | { } /* end */ |
| 8122 | }; |
| 8123 | |
| 8124 | /* |
| 8125 | * 6ch mode |
| 8126 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8127 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8128 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8129 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8130 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8131 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8132 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8133 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8134 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8135 | }; |
| 8136 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8137 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8138 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8139 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8140 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8141 | }; |
| 8142 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8143 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8144 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8145 | { |
| 8146 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8147 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8148 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8149 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8150 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8151 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8152 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8153 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8154 | } |
| 8155 | |
| 8156 | /* toggle RCA according to the front-jack state */ |
| 8157 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8158 | { |
| 8159 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8160 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8161 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8162 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8163 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8164 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8165 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8166 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8167 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8168 | unsigned int res) |
| 8169 | { |
| 8170 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8171 | alc888_lenovo_ms7195_front_automute(codec); |
| 8172 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8173 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8174 | } |
| 8175 | |
| 8176 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8177 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8178 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8179 | |
| 8180 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8181 | |
| 8182 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8183 | { } /* end */ |
| 8184 | }; |
| 8185 | |
| 8186 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8187 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8188 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8189 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8190 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8191 | spec->autocfg.hp_pins[0] = 0x14; |
| 8192 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8193 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8194 | } |
| 8195 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8196 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8197 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8198 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8199 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8200 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8201 | { |
| 8202 | unsigned int present; |
| 8203 | |
| 8204 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8205 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8206 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8207 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8208 | } |
| 8209 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8210 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8211 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8212 | struct alc_spec *spec = codec->spec; |
| 8213 | |
| 8214 | spec->autocfg.hp_pins[0] = 0x15; |
| 8215 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8216 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8217 | alc883_clevo_m720_mic_automute(codec); |
| 8218 | } |
| 8219 | |
| 8220 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8221 | unsigned int res) |
| 8222 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8223 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8224 | case ALC880_MIC_EVENT: |
| 8225 | alc883_clevo_m720_mic_automute(codec); |
| 8226 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8227 | default: |
| 8228 | alc_automute_amp_unsol_event(codec, res); |
| 8229 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8230 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8231 | } |
| 8232 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8233 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8234 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8235 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8236 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8237 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8238 | spec->autocfg.hp_pins[0] = 0x14; |
| 8239 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8240 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8241 | } |
| 8242 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8243 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8244 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8245 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8246 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8247 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8248 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8249 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8250 | } |
| 8251 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8252 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8253 | { |
| 8254 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8255 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8256 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8257 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8258 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8259 | bits = present ? HDA_AMP_MUTE : 0; |
| 8260 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8261 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8262 | } |
| 8263 | |
| 8264 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8265 | { |
| 8266 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8267 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8268 | |
| 8269 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8270 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8271 | bits = present ? HDA_AMP_MUTE : 0; |
| 8272 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8273 | HDA_AMP_MUTE, bits); |
| 8274 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8275 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8276 | } |
| 8277 | |
| 8278 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8279 | unsigned int res) |
| 8280 | { |
| 8281 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8282 | alc883_lenovo_101e_all_automute(codec); |
| 8283 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8284 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8285 | } |
| 8286 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8287 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8288 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8289 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8290 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8291 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8292 | spec->autocfg.hp_pins[0] = 0x14; |
| 8293 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8294 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8295 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8296 | } |
| 8297 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8298 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8299 | /* HP Pin: output 0 (0x0c) */ |
| 8300 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8301 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8302 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8303 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8305 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8306 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8307 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8308 | /* eanable EAPD on medion laptop */ |
| 8309 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8310 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8311 | /* enable unsolicited event */ |
| 8312 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8313 | { } |
| 8314 | }; |
| 8315 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8316 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8317 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8318 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8319 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8320 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8321 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8322 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8323 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8324 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8325 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8326 | } |
| 8327 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8328 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8329 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8330 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8331 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8332 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8333 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8334 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8335 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8336 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8337 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8338 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8339 | } |
| 8340 | |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8341 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8342 | { |
| 8343 | struct alc_spec *spec = codec->spec; |
| 8344 | |
| 8345 | spec->autocfg.hp_pins[0] = 0x15; |
| 8346 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8347 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8348 | alc_automute_amp(codec); |
| 8349 | } |
| 8350 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8351 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8352 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8353 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8354 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8355 | /* enable unsolicited event */ |
| 8356 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8357 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8358 | { } /* end */ |
| 8359 | }; |
| 8360 | |
| 8361 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8362 | { |
| 8363 | unsigned int present; |
| 8364 | |
| 8365 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8366 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8367 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8368 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8369 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8370 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8371 | } |
| 8372 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8373 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8374 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8375 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8376 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8377 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8378 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8379 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8380 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8381 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8382 | } |
| 8383 | |
| 8384 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8385 | unsigned int res) |
| 8386 | { |
| 8387 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8388 | case ALC880_MIC_EVENT: |
| 8389 | alc883_nb_mic_automute(codec); |
| 8390 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8391 | default: |
| 8392 | alc_sku_unsol_event(codec, res); |
| 8393 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8394 | } |
| 8395 | } |
| 8396 | |
| 8397 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8398 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8399 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8400 | alc883_nb_mic_automute(codec); |
| 8401 | } |
| 8402 | |
| 8403 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8404 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8405 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8406 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8407 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8408 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8409 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8410 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8411 | /* enable unsolicited event */ |
| 8412 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8413 | { } /* end */ |
| 8414 | }; |
| 8415 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8416 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8417 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8418 | struct alc_spec *spec = codec->spec; |
| 8419 | |
| 8420 | spec->autocfg.hp_pins[0] = 0x14; |
| 8421 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8422 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8423 | } |
| 8424 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8425 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8426 | /* Init rear pin (used as headphone output) */ |
| 8427 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8428 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8429 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8430 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8431 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8432 | /* Init line 2 pin (used as headphone out by default) */ |
| 8433 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8434 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8435 | { } /* end */ |
| 8436 | }; |
| 8437 | |
| 8438 | /* Mute speakers according to the headphone jack state */ |
| 8439 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8440 | { |
| 8441 | unsigned int present; |
| 8442 | |
| 8443 | /* Mute only in 2ch or 4ch mode */ |
| 8444 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8445 | == 0x00) { |
| 8446 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8447 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8448 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8449 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8450 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8451 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8452 | } |
| 8453 | } |
| 8454 | |
| 8455 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8456 | { |
| 8457 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8458 | alc889A_mb31_automute(codec); |
| 8459 | } |
| 8460 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8461 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8462 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8463 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8464 | #endif |
| 8465 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8466 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8467 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8468 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8469 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8470 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8471 | |
| 8472 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8473 | ALC1200_DIGOUT_NID, 0, |
| 8474 | }; |
| 8475 | |
| 8476 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8477 | ALC883_DIGOUT_NID, 0, |
| 8478 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8479 | |
| 8480 | /* |
| 8481 | * configuration and preset |
| 8482 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8483 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8484 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8485 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8486 | [ALC882_ARIMA] = "arima", |
| 8487 | [ALC882_W2JC] = "w2jc", |
| 8488 | [ALC882_TARGA] = "targa", |
| 8489 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8490 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8491 | [ALC885_MACPRO] = "macpro", |
| 8492 | [ALC885_MB5] = "mb5", |
| 8493 | [ALC885_MBP3] = "mbp3", |
| 8494 | [ALC885_IMAC24] = "imac24", |
| 8495 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8496 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8497 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8498 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8499 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8500 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8501 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8502 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8503 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8504 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8505 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8506 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8507 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8508 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8509 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8510 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8511 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8512 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8513 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8514 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8515 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8516 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8517 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8518 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8519 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8520 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8521 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8522 | [ALC889A_INTEL] = "intel-alc889a", |
| 8523 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8524 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8525 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8526 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8527 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8528 | }; |
| 8529 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8530 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8531 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8532 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8533 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8534 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8535 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8536 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8537 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8538 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8539 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8540 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8541 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8542 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8543 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8544 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8545 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8546 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8547 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8548 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8549 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8550 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8551 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8552 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8553 | /* default Acer -- disabled as it causes more problems. |
| 8554 | * model=auto should work fine now |
| 8555 | */ |
| 8556 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8557 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8558 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8559 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8560 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8561 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8562 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8563 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8564 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8565 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8566 | |
| 8567 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8568 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8569 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8570 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8571 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8572 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8573 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8574 | 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] | 8575 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8576 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8577 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8578 | |
| 8579 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8580 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8581 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8582 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8583 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8584 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8585 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8586 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8587 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8588 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8589 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8590 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8591 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8592 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8593 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8594 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8595 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8596 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8597 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8598 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8599 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8600 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8601 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8602 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8603 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8604 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8605 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8606 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8607 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8608 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8609 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8610 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8611 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8612 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8613 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8614 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8615 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8616 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8617 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8618 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8619 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8620 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8621 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8622 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8623 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8624 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8625 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8626 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8627 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8628 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8629 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8630 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8631 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8632 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8633 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8634 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8635 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8636 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8637 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8638 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8639 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8640 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8641 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8642 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8643 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8644 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8645 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8646 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8647 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8648 | {} |
| 8649 | }; |
| 8650 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8651 | /* codec SSID table for Intel Mac */ |
| 8652 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8653 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8654 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8655 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8656 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8657 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8658 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8659 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8660 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8661 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8662 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8663 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8664 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8665 | * no perfect solution yet |
| 8666 | */ |
| 8667 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8668 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8669 | }; |
| 8670 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8671 | static struct alc_config_preset alc882_presets[] = { |
| 8672 | [ALC882_3ST_DIG] = { |
| 8673 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8674 | .init_verbs = { alc882_base_init_verbs, |
| 8675 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8676 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8677 | .dac_nids = alc882_dac_nids, |
| 8678 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8679 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8680 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8681 | .channel_mode = alc882_ch_modes, |
| 8682 | .need_dac_fix = 1, |
| 8683 | .input_mux = &alc882_capture_source, |
| 8684 | }, |
| 8685 | [ALC882_6ST_DIG] = { |
| 8686 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8687 | .init_verbs = { alc882_base_init_verbs, |
| 8688 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8689 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8690 | .dac_nids = alc882_dac_nids, |
| 8691 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8692 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8693 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8694 | .channel_mode = alc882_sixstack_modes, |
| 8695 | .input_mux = &alc882_capture_source, |
| 8696 | }, |
| 8697 | [ALC882_ARIMA] = { |
| 8698 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8699 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8700 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8701 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8702 | .dac_nids = alc882_dac_nids, |
| 8703 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8704 | .channel_mode = alc882_sixstack_modes, |
| 8705 | .input_mux = &alc882_capture_source, |
| 8706 | }, |
| 8707 | [ALC882_W2JC] = { |
| 8708 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8709 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8710 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8711 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8712 | .dac_nids = alc882_dac_nids, |
| 8713 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8714 | .channel_mode = alc880_threestack_modes, |
| 8715 | .need_dac_fix = 1, |
| 8716 | .input_mux = &alc882_capture_source, |
| 8717 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8718 | }, |
| 8719 | [ALC885_MBP3] = { |
| 8720 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8721 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8722 | alc880_gpio1_init_verbs }, |
| 8723 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8724 | .dac_nids = alc882_dac_nids, |
| 8725 | .channel_mode = alc885_mbp_6ch_modes, |
| 8726 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 8727 | .input_mux = &alc882_capture_source, |
| 8728 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8729 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8730 | .unsol_event = alc_automute_amp_unsol_event, |
| 8731 | .init_hook = alc885_mbp3_init_hook, |
| 8732 | }, |
| 8733 | [ALC885_MB5] = { |
| 8734 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8735 | .init_verbs = { alc885_mb5_init_verbs, |
| 8736 | alc880_gpio1_init_verbs }, |
| 8737 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8738 | .dac_nids = alc882_dac_nids, |
| 8739 | .channel_mode = alc885_mb5_6ch_modes, |
| 8740 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8741 | .input_mux = &mb5_capture_source, |
| 8742 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8743 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8744 | }, |
| 8745 | [ALC885_MACPRO] = { |
| 8746 | .mixers = { alc882_macpro_mixer }, |
| 8747 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8748 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8749 | .dac_nids = alc882_dac_nids, |
| 8750 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8751 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8752 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8753 | .channel_mode = alc882_ch_modes, |
| 8754 | .input_mux = &alc882_capture_source, |
| 8755 | .init_hook = alc885_macpro_init_hook, |
| 8756 | }, |
| 8757 | [ALC885_IMAC24] = { |
| 8758 | .mixers = { alc885_imac24_mixer }, |
| 8759 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8760 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8761 | .dac_nids = alc882_dac_nids, |
| 8762 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8763 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8764 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8765 | .channel_mode = alc882_ch_modes, |
| 8766 | .input_mux = &alc882_capture_source, |
| 8767 | .unsol_event = alc_automute_amp_unsol_event, |
| 8768 | .init_hook = alc885_imac24_init_hook, |
| 8769 | }, |
| 8770 | [ALC882_TARGA] = { |
| 8771 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8772 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 8773 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8774 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8775 | .dac_nids = alc882_dac_nids, |
| 8776 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8777 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8778 | .adc_nids = alc882_adc_nids, |
| 8779 | .capsrc_nids = alc882_capsrc_nids, |
| 8780 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8781 | .channel_mode = alc882_3ST_6ch_modes, |
| 8782 | .need_dac_fix = 1, |
| 8783 | .input_mux = &alc882_capture_source, |
| 8784 | .unsol_event = alc882_targa_unsol_event, |
| 8785 | .init_hook = alc882_targa_init_hook, |
| 8786 | }, |
| 8787 | [ALC882_ASUS_A7J] = { |
| 8788 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8789 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8790 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8791 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8792 | .dac_nids = alc882_dac_nids, |
| 8793 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8794 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8795 | .adc_nids = alc882_adc_nids, |
| 8796 | .capsrc_nids = alc882_capsrc_nids, |
| 8797 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8798 | .channel_mode = alc882_3ST_6ch_modes, |
| 8799 | .need_dac_fix = 1, |
| 8800 | .input_mux = &alc882_capture_source, |
| 8801 | }, |
| 8802 | [ALC882_ASUS_A7M] = { |
| 8803 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8804 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8805 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8806 | alc882_asus_a7m_verbs }, |
| 8807 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8808 | .dac_nids = alc882_dac_nids, |
| 8809 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8810 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8811 | .channel_mode = alc880_threestack_modes, |
| 8812 | .need_dac_fix = 1, |
| 8813 | .input_mux = &alc882_capture_source, |
| 8814 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8815 | [ALC883_3ST_2ch_DIG] = { |
| 8816 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8817 | .init_verbs = { alc883_init_verbs }, |
| 8818 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8819 | .dac_nids = alc883_dac_nids, |
| 8820 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8821 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8822 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8823 | .channel_mode = alc883_3ST_2ch_modes, |
| 8824 | .input_mux = &alc883_capture_source, |
| 8825 | }, |
| 8826 | [ALC883_3ST_6ch_DIG] = { |
| 8827 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8828 | .init_verbs = { alc883_init_verbs }, |
| 8829 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8830 | .dac_nids = alc883_dac_nids, |
| 8831 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8832 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8833 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8834 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8835 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8836 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8837 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8838 | [ALC883_3ST_6ch] = { |
| 8839 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8840 | .init_verbs = { alc883_init_verbs }, |
| 8841 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8842 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8843 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8844 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8845 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8846 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8847 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8848 | [ALC883_3ST_6ch_INTEL] = { |
| 8849 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8850 | .init_verbs = { alc883_init_verbs }, |
| 8851 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8852 | .dac_nids = alc883_dac_nids, |
| 8853 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8854 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8855 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8856 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8857 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8858 | .need_dac_fix = 1, |
| 8859 | .input_mux = &alc883_3stack_6ch_intel, |
| 8860 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8861 | [ALC889A_INTEL] = { |
| 8862 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 8863 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs }, |
| 8864 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8865 | .dac_nids = alc883_dac_nids, |
| 8866 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 8867 | .adc_nids = alc889_adc_nids, |
| 8868 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8869 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8870 | .slave_dig_outs = alc883_slave_dig_outs, |
| 8871 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 8872 | .channel_mode = alc889_8ch_intel_modes, |
| 8873 | .capsrc_nids = alc889_capsrc_nids, |
| 8874 | .input_mux = &alc889_capture_source, |
| 8875 | .need_dac_fix = 1, |
| 8876 | }, |
| 8877 | [ALC889_INTEL] = { |
| 8878 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 8879 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
| 8880 | alc889_eapd_verbs }, |
| 8881 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8882 | .dac_nids = alc883_dac_nids, |
| 8883 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 8884 | .adc_nids = alc889_adc_nids, |
| 8885 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8886 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8887 | .slave_dig_outs = alc883_slave_dig_outs, |
| 8888 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 8889 | .channel_mode = alc889_8ch_intel_modes, |
| 8890 | .capsrc_nids = alc889_capsrc_nids, |
| 8891 | .input_mux = &alc889_capture_source, |
| 8892 | .init_hook = alc889_coef_init, |
| 8893 | .need_dac_fix = 1, |
| 8894 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8895 | [ALC883_6ST_DIG] = { |
| 8896 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8897 | .init_verbs = { alc883_init_verbs }, |
| 8898 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8899 | .dac_nids = alc883_dac_nids, |
| 8900 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8901 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8902 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8903 | .channel_mode = alc883_sixstack_modes, |
| 8904 | .input_mux = &alc883_capture_source, |
| 8905 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8906 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8907 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 8908 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 8909 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8910 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8911 | .dac_nids = alc883_dac_nids, |
| 8912 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8913 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8914 | .channel_mode = alc883_3ST_6ch_modes, |
| 8915 | .need_dac_fix = 1, |
| 8916 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8917 | .unsol_event = alc883_targa_unsol_event, |
| 8918 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8919 | }, |
| 8920 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8921 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 8922 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 8923 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8924 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8925 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8926 | .adc_nids = alc883_adc_nids_alt, |
| 8927 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8928 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8929 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8930 | .channel_mode = alc883_3ST_2ch_modes, |
| 8931 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8932 | .unsol_event = alc883_targa_unsol_event, |
| 8933 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8934 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8935 | [ALC883_TARGA_8ch_DIG] = { |
| 8936 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8937 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8938 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8939 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8940 | .dac_nids = alc883_dac_nids, |
| 8941 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8942 | .adc_nids = alc883_adc_nids_rev, |
| 8943 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8944 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8945 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8946 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 8947 | .channel_mode = alc883_4ST_8ch_modes, |
| 8948 | .need_dac_fix = 1, |
| 8949 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8950 | .unsol_event = alc883_targa_unsol_event, |
| 8951 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8952 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8953 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8954 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8955 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8956 | * and the headphone jack. Turn this on and rely on the |
| 8957 | * standard mute methods whenever the user wants to turn |
| 8958 | * these outputs off. |
| 8959 | */ |
| 8960 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8961 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8962 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8963 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8964 | .channel_mode = alc883_3ST_2ch_modes, |
| 8965 | .input_mux = &alc883_capture_source, |
| 8966 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8967 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8968 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8969 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8970 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8971 | .dac_nids = alc883_dac_nids, |
| 8972 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8973 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8974 | .channel_mode = alc883_3ST_2ch_modes, |
| 8975 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8976 | .unsol_event = alc_automute_amp_unsol_event, |
| 8977 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8978 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8979 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8980 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8981 | alc883_chmode_mixer }, |
| 8982 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8983 | alc888_acer_aspire_4930g_verbs }, |
| 8984 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8985 | .dac_nids = alc883_dac_nids, |
| 8986 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8987 | .adc_nids = alc883_adc_nids_rev, |
| 8988 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8989 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8990 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8991 | .channel_mode = alc883_3ST_6ch_modes, |
| 8992 | .need_dac_fix = 1, |
| 8993 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8994 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8995 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8996 | .unsol_event = alc_automute_amp_unsol_event, |
| 8997 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8998 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8999 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9000 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9001 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9002 | alc888_acer_aspire_6530g_verbs }, |
| 9003 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9004 | .dac_nids = alc883_dac_nids, |
| 9005 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9006 | .adc_nids = alc883_adc_nids_rev, |
| 9007 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9008 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9009 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9010 | .channel_mode = alc883_3ST_2ch_modes, |
| 9011 | .num_mux_defs = |
| 9012 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9013 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9014 | .unsol_event = alc_automute_amp_unsol_event, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 9015 | .init_hook = alc888_acer_aspire_6530g_init_hook, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9016 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9017 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9018 | .mixers = { alc888_base_mixer, |
| 9019 | alc883_chmode_mixer }, |
| 9020 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9021 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9022 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9023 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9024 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9025 | .adc_nids = alc889_adc_nids, |
| 9026 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9027 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9028 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9029 | .channel_mode = alc883_3ST_6ch_modes, |
| 9030 | .need_dac_fix = 1, |
| 9031 | .const_channel_count = 6, |
| 9032 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9033 | ARRAY_SIZE(alc889_capture_sources), |
| 9034 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9035 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9036 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9037 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9038 | [ALC883_MEDION] = { |
| 9039 | .mixers = { alc883_fivestack_mixer, |
| 9040 | alc883_chmode_mixer }, |
| 9041 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9042 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9043 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9044 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9045 | .adc_nids = alc883_adc_nids_alt, |
| 9046 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9047 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9048 | .channel_mode = alc883_sixstack_modes, |
| 9049 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9050 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9051 | [ALC883_MEDION_MD2] = { |
| 9052 | .mixers = { alc883_medion_md2_mixer}, |
| 9053 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9054 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9055 | .dac_nids = alc883_dac_nids, |
| 9056 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9057 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9058 | .channel_mode = alc883_3ST_2ch_modes, |
| 9059 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9060 | .unsol_event = alc_automute_amp_unsol_event, |
| 9061 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9062 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9063 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9064 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9065 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9066 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9067 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [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, |
| 9071 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9072 | [ALC883_CLEVO_M720] = { |
| 9073 | .mixers = { alc883_clevo_m720_mixer }, |
| 9074 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9075 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9076 | .dac_nids = alc883_dac_nids, |
| 9077 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9078 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9079 | .channel_mode = alc883_3ST_2ch_modes, |
| 9080 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9081 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9082 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9083 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9084 | [ALC883_LENOVO_101E_2ch] = { |
| 9085 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9086 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9087 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9088 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9089 | .adc_nids = alc883_adc_nids_alt, |
| 9090 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9091 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9092 | .channel_mode = alc883_3ST_2ch_modes, |
| 9093 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9094 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9095 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9096 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9097 | [ALC883_LENOVO_NB0763] = { |
| 9098 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9099 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9100 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9101 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9102 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9103 | .channel_mode = alc883_3ST_2ch_modes, |
| 9104 | .need_dac_fix = 1, |
| 9105 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9106 | .unsol_event = alc_automute_amp_unsol_event, |
| 9107 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9108 | }, |
| 9109 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9110 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9111 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9112 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9113 | .dac_nids = alc883_dac_nids, |
| 9114 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9115 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9116 | .channel_mode = alc883_3ST_6ch_modes, |
| 9117 | .need_dac_fix = 1, |
| 9118 | .input_mux = &alc883_capture_source, |
| 9119 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9120 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9121 | }, |
| 9122 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9123 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9124 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9125 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9126 | .dac_nids = alc883_dac_nids, |
| 9127 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9128 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9129 | .channel_mode = alc883_3ST_2ch_modes, |
| 9130 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9131 | .unsol_event = alc_automute_amp_unsol_event, |
| 9132 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9133 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9134 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9135 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9136 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9137 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9138 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9139 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9140 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9141 | .need_dac_fix = 1, |
| 9142 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9143 | .unsol_event = alc_automute_amp_unsol_event, |
| 9144 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9145 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9146 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9147 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9148 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9149 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9150 | .dac_nids = alc883_dac_nids, |
| 9151 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9152 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9153 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9154 | .channel_mode = alc883_sixstack_modes, |
| 9155 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9156 | .unsol_event = alc_automute_amp_unsol_event, |
| 9157 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9158 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9159 | [ALC883_MITAC] = { |
| 9160 | .mixers = { alc883_mitac_mixer }, |
| 9161 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9162 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9163 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9164 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9165 | .channel_mode = alc883_3ST_2ch_modes, |
| 9166 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9167 | .unsol_event = alc_automute_amp_unsol_event, |
| 9168 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9169 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9170 | [ALC883_FUJITSU_PI2515] = { |
| 9171 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9172 | .init_verbs = { alc883_init_verbs, |
| 9173 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9174 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9175 | .dac_nids = alc883_dac_nids, |
| 9176 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9177 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9178 | .channel_mode = alc883_3ST_2ch_modes, |
| 9179 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9180 | .unsol_event = alc_automute_amp_unsol_event, |
| 9181 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9182 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9183 | [ALC888_FUJITSU_XA3530] = { |
| 9184 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9185 | .init_verbs = { alc883_init_verbs, |
| 9186 | alc888_fujitsu_xa3530_verbs }, |
| 9187 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9188 | .dac_nids = alc883_dac_nids, |
| 9189 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9190 | .adc_nids = alc883_adc_nids_rev, |
| 9191 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9192 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9193 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9194 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9195 | .num_mux_defs = |
| 9196 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9197 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9198 | .unsol_event = alc_automute_amp_unsol_event, |
| 9199 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9200 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9201 | [ALC888_LENOVO_SKY] = { |
| 9202 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9203 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9204 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9205 | .dac_nids = alc883_dac_nids, |
| 9206 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9207 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9208 | .channel_mode = alc883_sixstack_modes, |
| 9209 | .need_dac_fix = 1, |
| 9210 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9211 | .unsol_event = alc_automute_amp_unsol_event, |
| 9212 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9213 | }, |
| 9214 | [ALC888_ASUS_M90V] = { |
| 9215 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9216 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9217 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9218 | .dac_nids = alc883_dac_nids, |
| 9219 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9220 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9221 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9222 | .channel_mode = alc883_3ST_6ch_modes, |
| 9223 | .need_dac_fix = 1, |
| 9224 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9225 | .unsol_event = alc883_mode2_unsol_event, |
| 9226 | .init_hook = alc883_mode2_inithook, |
| 9227 | }, |
| 9228 | [ALC888_ASUS_EEE1601] = { |
| 9229 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9230 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9231 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9232 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9233 | .dac_nids = alc883_dac_nids, |
| 9234 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9235 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9236 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9237 | .channel_mode = alc883_3ST_2ch_modes, |
| 9238 | .need_dac_fix = 1, |
| 9239 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9240 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9241 | .init_hook = alc883_eee1601_inithook, |
| 9242 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9243 | [ALC1200_ASUS_P5Q] = { |
| 9244 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9245 | .init_verbs = { alc883_init_verbs }, |
| 9246 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9247 | .dac_nids = alc883_dac_nids, |
| 9248 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9249 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9250 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9251 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9252 | .channel_mode = alc883_sixstack_modes, |
| 9253 | .input_mux = &alc883_capture_source, |
| 9254 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9255 | [ALC889A_MB31] = { |
| 9256 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9257 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9258 | alc880_gpio1_init_verbs }, |
| 9259 | .adc_nids = alc883_adc_nids, |
| 9260 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9261 | .dac_nids = alc883_dac_nids, |
| 9262 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9263 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9264 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9265 | .input_mux = &alc889A_mb31_capture_source, |
| 9266 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9267 | .unsol_event = alc889A_mb31_unsol_event, |
| 9268 | .init_hook = alc889A_mb31_automute, |
| 9269 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9270 | [ALC883_SONY_VAIO_TT] = { |
| 9271 | .mixers = { alc883_vaiott_mixer }, |
| 9272 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9273 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9274 | .dac_nids = alc883_dac_nids, |
| 9275 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9276 | .channel_mode = alc883_3ST_2ch_modes, |
| 9277 | .input_mux = &alc883_capture_source, |
| 9278 | .unsol_event = alc_automute_amp_unsol_event, |
| 9279 | .init_hook = alc883_vaiott_init_hook, |
| 9280 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9281 | }; |
| 9282 | |
| 9283 | |
| 9284 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9285 | * Pin config fixes |
| 9286 | */ |
| 9287 | enum { |
| 9288 | PINFIX_ABIT_AW9D_MAX |
| 9289 | }; |
| 9290 | |
| 9291 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9292 | { 0x15, 0x01080104 }, /* side */ |
| 9293 | { 0x16, 0x01011012 }, /* rear */ |
| 9294 | { 0x17, 0x01016011 }, /* clfe */ |
| 9295 | { } |
| 9296 | }; |
| 9297 | |
| 9298 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9299 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9300 | }; |
| 9301 | |
| 9302 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9303 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9304 | {} |
| 9305 | }; |
| 9306 | |
| 9307 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9308 | * BIOS auto configuration |
| 9309 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9310 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9311 | hda_nid_t nid, int pin_type, |
| 9312 | int dac_idx) |
| 9313 | { |
| 9314 | /* set as output */ |
| 9315 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9316 | int idx; |
| 9317 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9318 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9319 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9320 | idx = 4; |
| 9321 | else |
| 9322 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9323 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9324 | |
| 9325 | } |
| 9326 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9327 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9328 | { |
| 9329 | struct alc_spec *spec = codec->spec; |
| 9330 | int i; |
| 9331 | |
| 9332 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9333 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9334 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9335 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9336 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9337 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9338 | } |
| 9339 | } |
| 9340 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9341 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9342 | { |
| 9343 | struct alc_spec *spec = codec->spec; |
| 9344 | hda_nid_t pin; |
| 9345 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9346 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9347 | if (pin) /* connect to front */ |
| 9348 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9349 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9350 | pin = spec->autocfg.speaker_pins[0]; |
| 9351 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9352 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9353 | } |
| 9354 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9355 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9356 | { |
| 9357 | struct alc_spec *spec = codec->spec; |
| 9358 | int i; |
| 9359 | |
| 9360 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9361 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9362 | if (!nid) |
| 9363 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9364 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9365 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9366 | snd_hda_codec_write(codec, nid, 0, |
| 9367 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9368 | AMP_OUT_MUTE); |
| 9369 | } |
| 9370 | } |
| 9371 | |
| 9372 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9373 | { |
| 9374 | struct alc_spec *spec = codec->spec; |
| 9375 | int c; |
| 9376 | |
| 9377 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9378 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9379 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9380 | unsigned int mux_idx; |
| 9381 | const struct hda_input_mux *imux; |
| 9382 | int conns, mute, idx, item; |
| 9383 | |
| 9384 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9385 | ARRAY_SIZE(conn_list)); |
| 9386 | if (conns < 0) |
| 9387 | continue; |
| 9388 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9389 | imux = &spec->input_mux[mux_idx]; |
| 9390 | for (idx = 0; idx < conns; idx++) { |
| 9391 | /* if the current connection is the selected one, |
| 9392 | * unmute it as default - otherwise mute it |
| 9393 | */ |
| 9394 | mute = AMP_IN_MUTE(idx); |
| 9395 | for (item = 0; item < imux->num_items; item++) { |
| 9396 | if (imux->items[item].index == idx) { |
| 9397 | if (spec->cur_mux[c] == item) |
| 9398 | mute = AMP_IN_UNMUTE(idx); |
| 9399 | break; |
| 9400 | } |
| 9401 | } |
| 9402 | /* check if we have a selector or mixer |
| 9403 | * we could check for the widget type instead, but |
| 9404 | * just check for Amp-In presence (in case of mixer |
| 9405 | * without amp-in there is something wrong, this |
| 9406 | * function shouldn't be used or capsrc nid is wrong) |
| 9407 | */ |
| 9408 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9409 | snd_hda_codec_write(codec, nid, 0, |
| 9410 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9411 | mute); |
| 9412 | else if (mute != AMP_IN_MUTE(idx)) |
| 9413 | snd_hda_codec_write(codec, nid, 0, |
| 9414 | AC_VERB_SET_CONNECT_SEL, |
| 9415 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9416 | } |
| 9417 | } |
| 9418 | } |
| 9419 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9420 | /* add mic boosts if needed */ |
| 9421 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9422 | { |
| 9423 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9424 | int err; |
| 9425 | hda_nid_t nid; |
| 9426 | |
| 9427 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9428 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9429 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9430 | "Mic Boost", |
| 9431 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9432 | if (err < 0) |
| 9433 | return err; |
| 9434 | } |
| 9435 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9436 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9437 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9438 | "Front Mic Boost", |
| 9439 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9440 | if (err < 0) |
| 9441 | return err; |
| 9442 | } |
| 9443 | return 0; |
| 9444 | } |
| 9445 | |
| 9446 | /* almost identical with ALC880 parser... */ |
| 9447 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9448 | { |
| 9449 | struct alc_spec *spec = codec->spec; |
| 9450 | struct auto_pin_cfg *autocfg = &spec->autocfg; |
| 9451 | unsigned int wcap; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9452 | int i; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9453 | int err = alc880_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9454 | |
| 9455 | if (err < 0) |
| 9456 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9457 | else if (!err) |
| 9458 | return 0; /* no config found */ |
| 9459 | |
| 9460 | err = alc_auto_add_mic_boost(codec); |
| 9461 | if (err < 0) |
| 9462 | return err; |
| 9463 | |
| 9464 | /* hack - override the init verbs */ |
| 9465 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9466 | /* if ADC 0x07 is available, initialize it, too */ |
| 9467 | wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9468 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9469 | if (wcap == AC_WID_AUD_IN) |
| 9470 | add_verb(spec, alc882_adc1_init_verbs); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9471 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9472 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9473 | * because it's under 0x18 |
| 9474 | */ |
| 9475 | if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9476 | autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9477 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9478 | for (i = 1; i < 3; i++) |
| 9479 | memcpy(&spec->private_imux[i], |
| 9480 | &spec->private_imux[0], |
| 9481 | sizeof(spec->private_imux[0])); |
| 9482 | imux->items[imux->num_items].label = "Int DMic"; |
| 9483 | imux->items[imux->num_items].index = 0x0b; |
| 9484 | imux->num_items++; |
| 9485 | spec->num_mux_defs = 3; |
| 9486 | spec->input_mux = spec->private_imux; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9487 | } |
| 9488 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9489 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9490 | } |
| 9491 | |
| 9492 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9493 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9494 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9495 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9496 | alc882_auto_init_multi_out(codec); |
| 9497 | alc882_auto_init_hp_out(codec); |
| 9498 | alc882_auto_init_analog_input(codec); |
| 9499 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9500 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9501 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9502 | } |
| 9503 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9504 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9505 | { |
| 9506 | struct alc_spec *spec; |
| 9507 | int err, board_config; |
| 9508 | |
| 9509 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9510 | if (spec == NULL) |
| 9511 | return -ENOMEM; |
| 9512 | |
| 9513 | codec->spec = spec; |
| 9514 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9515 | switch (codec->vendor_id) { |
| 9516 | case 0x10ec0882: |
| 9517 | case 0x10ec0885: |
| 9518 | break; |
| 9519 | default: |
| 9520 | /* ALC883 and variants */ |
| 9521 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9522 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9523 | } |
| 9524 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9525 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9526 | alc882_models, |
| 9527 | alc882_cfg_tbl); |
| 9528 | |
| 9529 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9530 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9531 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9532 | |
| 9533 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9534 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9535 | codec->chip_name); |
| 9536 | board_config = ALC882_AUTO; |
| 9537 | } |
| 9538 | |
| 9539 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9540 | |
| 9541 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9542 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9543 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9544 | if (err < 0) { |
| 9545 | alc_free(codec); |
| 9546 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9547 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9548 | printk(KERN_INFO |
| 9549 | "hda_codec: Cannot set up configuration " |
| 9550 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9551 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9552 | } |
| 9553 | } |
| 9554 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9555 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9556 | if (err < 0) { |
| 9557 | alc_free(codec); |
| 9558 | return err; |
| 9559 | } |
| 9560 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9561 | if (board_config != ALC882_AUTO) |
| 9562 | setup_preset(spec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9563 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9564 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9565 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9566 | /* FIXME: setup DAC5 */ |
| 9567 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9568 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9569 | |
| 9570 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9571 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9572 | |
| 9573 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9574 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9575 | |
| 9576 | if (!spec->adc_nids && spec->input_mux) { |
| 9577 | int i; |
| 9578 | spec->num_adc_nids = 0; |
| 9579 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9580 | hda_nid_t cap; |
| 9581 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9582 | unsigned int wcap = get_wcaps(codec, nid); |
| 9583 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9584 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9585 | if (wcap != AC_WID_AUD_IN) |
| 9586 | continue; |
| 9587 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9588 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9589 | if (err < 0) |
| 9590 | continue; |
| 9591 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9592 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9593 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9594 | spec->adc_nids = spec->private_adc_nids; |
| 9595 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9596 | } |
| 9597 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9598 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9599 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9600 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9601 | spec->vmaster_nid = 0x0c; |
| 9602 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9603 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9604 | if (board_config == ALC882_AUTO) |
| 9605 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9606 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9607 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9608 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9609 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9610 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9611 | |
| 9612 | return 0; |
| 9613 | } |
| 9614 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9615 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9616 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9617 | * ALC262 support |
| 9618 | */ |
| 9619 | |
| 9620 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9621 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9622 | |
| 9623 | #define alc262_dac_nids alc260_dac_nids |
| 9624 | #define alc262_adc_nids alc882_adc_nids |
| 9625 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9626 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9627 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9628 | |
| 9629 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9630 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9631 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9632 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9633 | /* ADC0 */ |
| 9634 | 0x09 |
| 9635 | }; |
| 9636 | |
| 9637 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9639 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9640 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9641 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9642 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9643 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9644 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9645 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9647 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9648 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9649 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9650 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9651 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9652 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9654 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9655 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9656 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9657 | }; |
| 9658 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9659 | /* update HP, line and mono-out pins according to the master switch */ |
| 9660 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9661 | { |
| 9662 | struct alc_spec *spec = codec->spec; |
| 9663 | int val = spec->master_sw; |
| 9664 | |
| 9665 | /* HP & line-out */ |
| 9666 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9667 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9668 | val ? PIN_HP : 0); |
| 9669 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9670 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9671 | val ? PIN_HP : 0); |
| 9672 | /* mono (speaker) depending on the HP jack sense */ |
| 9673 | val = val && !spec->jack_present; |
| 9674 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9675 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9676 | val ? PIN_OUT : 0); |
| 9677 | } |
| 9678 | |
| 9679 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9680 | { |
| 9681 | struct alc_spec *spec = codec->spec; |
| 9682 | unsigned int presence; |
| 9683 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9684 | AC_VERB_GET_PIN_SENSE, 0); |
| 9685 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9686 | alc262_hp_master_update(codec); |
| 9687 | } |
| 9688 | |
| 9689 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9690 | { |
| 9691 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9692 | return; |
| 9693 | alc262_hp_bpc_automute(codec); |
| 9694 | } |
| 9695 | |
| 9696 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9697 | { |
| 9698 | struct alc_spec *spec = codec->spec; |
| 9699 | unsigned int presence; |
| 9700 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9701 | AC_VERB_GET_PIN_SENSE, 0); |
| 9702 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9703 | alc262_hp_master_update(codec); |
| 9704 | } |
| 9705 | |
| 9706 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9707 | unsigned int res) |
| 9708 | { |
| 9709 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9710 | return; |
| 9711 | alc262_hp_wildwest_automute(codec); |
| 9712 | } |
| 9713 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9714 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9715 | |
| 9716 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9717 | struct snd_ctl_elem_value *ucontrol) |
| 9718 | { |
| 9719 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9720 | struct alc_spec *spec = codec->spec; |
| 9721 | int val = !!*ucontrol->value.integer.value; |
| 9722 | |
| 9723 | if (val == spec->master_sw) |
| 9724 | return 0; |
| 9725 | spec->master_sw = val; |
| 9726 | alc262_hp_master_update(codec); |
| 9727 | return 1; |
| 9728 | } |
| 9729 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9730 | #define ALC262_HP_MASTER_SWITCH \ |
| 9731 | { \ |
| 9732 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9733 | .name = "Master Playback Switch", \ |
| 9734 | .info = snd_ctl_boolean_mono_info, \ |
| 9735 | .get = alc262_hp_master_sw_get, \ |
| 9736 | .put = alc262_hp_master_sw_put, \ |
| 9737 | } |
| 9738 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9739 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9740 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9741 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9742 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9743 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9744 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9745 | HDA_OUTPUT), |
| 9746 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9747 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9748 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9750 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9751 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9752 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9753 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9754 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9755 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9756 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9757 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9758 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9759 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9760 | { } /* end */ |
| 9761 | }; |
| 9762 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9763 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9764 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9766 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9767 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9768 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9769 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9770 | HDA_OUTPUT), |
| 9771 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9772 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9773 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9774 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9775 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9776 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9777 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9778 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9779 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9780 | { } /* end */ |
| 9781 | }; |
| 9782 | |
| 9783 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9784 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9785 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9786 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9787 | { } /* end */ |
| 9788 | }; |
| 9789 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9790 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9791 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9792 | { |
| 9793 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9794 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9795 | spec->autocfg.hp_pins[0] = 0x15; |
| 9796 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 9797 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9798 | } |
| 9799 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9800 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9801 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9802 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9803 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9804 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9806 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9807 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9808 | { } /* end */ |
| 9809 | }; |
| 9810 | |
| 9811 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9812 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9813 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9814 | |
| 9815 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9816 | { } |
| 9817 | }; |
| 9818 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9819 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9820 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9821 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9822 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9823 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9824 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9825 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9826 | { } /* end */ |
| 9827 | }; |
| 9828 | |
| 9829 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9830 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9831 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9832 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9833 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9834 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9835 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9836 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9838 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9839 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9840 | {} |
| 9841 | }; |
| 9842 | |
| 9843 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9844 | .num_items = 1, |
| 9845 | .items = { |
| 9846 | { "Line", 0x1 }, |
| 9847 | }, |
| 9848 | }; |
| 9849 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9850 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 9851 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 9852 | { |
| 9853 | struct alc_spec *spec = codec->spec; |
| 9854 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9855 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9856 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9857 | unsigned int mute; |
| 9858 | |
| 9859 | /* HP */ |
| 9860 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 9861 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 9862 | HDA_AMP_MUTE, mute); |
| 9863 | /* mute internal speaker per jack sense */ |
| 9864 | if (spec->jack_present) |
| 9865 | mute = HDA_AMP_MUTE; |
| 9866 | if (line_nid) |
| 9867 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 9868 | HDA_AMP_MUTE, mute); |
| 9869 | if (speaker_nid && speaker_nid != line_nid) |
| 9870 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 9871 | HDA_AMP_MUTE, mute); |
| 9872 | } |
| 9873 | |
| 9874 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 9875 | |
| 9876 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9877 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9878 | { |
| 9879 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9880 | struct alc_spec *spec = codec->spec; |
| 9881 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9882 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9883 | if (val == spec->master_sw) |
| 9884 | return 0; |
| 9885 | spec->master_sw = val; |
| 9886 | alc262_hippo_master_update(codec); |
| 9887 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9888 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9889 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9890 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 9891 | { \ |
| 9892 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9893 | .name = "Master Playback Switch", \ |
| 9894 | .info = snd_ctl_boolean_mono_info, \ |
| 9895 | .get = alc262_hippo_master_sw_get, \ |
| 9896 | .put = alc262_hippo_master_sw_put, \ |
| 9897 | } |
| 9898 | |
| 9899 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 9900 | ALC262_HIPPO_MASTER_SWITCH, |
| 9901 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9902 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9903 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9904 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9905 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9906 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9907 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9908 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9909 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9910 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9911 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9912 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9913 | { } /* end */ |
| 9914 | }; |
| 9915 | |
| 9916 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9917 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9918 | ALC262_HIPPO_MASTER_SWITCH, |
| 9919 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9920 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9921 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9922 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9924 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9925 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9926 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9927 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9928 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9929 | { } /* end */ |
| 9930 | }; |
| 9931 | |
| 9932 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9933 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 9934 | { |
| 9935 | struct alc_spec *spec = codec->spec; |
| 9936 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9937 | unsigned int present; |
| 9938 | |
| 9939 | /* need to execute and sync at first */ |
| 9940 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9941 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 9942 | AC_VERB_GET_PIN_SENSE, 0); |
| 9943 | spec->jack_present = (present & 0x80000000) != 0; |
| 9944 | alc262_hippo_master_update(codec); |
| 9945 | } |
| 9946 | |
| 9947 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9948 | { |
| 9949 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9950 | return; |
| 9951 | alc262_hippo_automute(codec); |
| 9952 | } |
| 9953 | |
| 9954 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 9955 | { |
| 9956 | struct alc_spec *spec = codec->spec; |
| 9957 | |
| 9958 | spec->autocfg.hp_pins[0] = 0x15; |
| 9959 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9960 | alc262_hippo_automute(codec); |
| 9961 | } |
| 9962 | |
| 9963 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 9964 | { |
| 9965 | struct alc_spec *spec = codec->spec; |
| 9966 | |
| 9967 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9968 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9969 | alc262_hippo_automute(codec); |
| 9970 | } |
| 9971 | |
| 9972 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9973 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9974 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9975 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9978 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9979 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9980 | { } /* end */ |
| 9981 | }; |
| 9982 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9983 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9984 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9985 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9986 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9987 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9988 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9989 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9990 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9991 | { } /* end */ |
| 9992 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9993 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9994 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9995 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9996 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9997 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9998 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9999 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10000 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10001 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10003 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10004 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10005 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10006 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10007 | { } /* end */ |
| 10008 | }; |
| 10009 | |
| 10010 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10011 | /* Headphone automute */ |
| 10012 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10013 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10014 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10015 | |
| 10016 | /* P11 AUX_IN, white 4-pin connector */ |
| 10017 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10018 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10019 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10020 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10021 | |
| 10022 | {} |
| 10023 | }; |
| 10024 | |
| 10025 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10026 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10027 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10028 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10029 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10030 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10031 | spec->autocfg.speaker_pins[0] = 0x15; |
| 10032 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10033 | } |
| 10034 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10035 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10036 | #define alc262_capture_mixer alc882_capture_mixer |
| 10037 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10038 | |
| 10039 | /* |
| 10040 | * generic initialization of ADC, input mixers and output mixers |
| 10041 | */ |
| 10042 | static struct hda_verb alc262_init_verbs[] = { |
| 10043 | /* |
| 10044 | * Unmute ADC0-2 and set the default input to mic-in |
| 10045 | */ |
| 10046 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10047 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10048 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10049 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10050 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10051 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10052 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10053 | /* 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] | 10054 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10055 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10056 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10057 | */ |
| 10058 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10060 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10061 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10062 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10063 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10064 | |
| 10065 | /* |
| 10066 | * Set up output mixers (0x0c - 0x0e) |
| 10067 | */ |
| 10068 | /* set vol=0 to output mixers */ |
| 10069 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10070 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10071 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10072 | /* set up input amps for analog loopback */ |
| 10073 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10075 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10076 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10077 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10078 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10079 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10080 | |
| 10081 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10082 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10083 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10084 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10085 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10086 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10087 | |
| 10088 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10090 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10091 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10092 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10093 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10094 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10095 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10096 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10097 | /* FIXME: use matrix-type input source selection */ |
| 10098 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10099 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10100 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10101 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10102 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10103 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10104 | /* Input mixer2 */ |
| 10105 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10106 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10107 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10108 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10109 | /* Input mixer3 */ |
| 10110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10113 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10114 | |
| 10115 | { } |
| 10116 | }; |
| 10117 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10118 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10119 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10120 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10121 | { } |
| 10122 | }; |
| 10123 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10124 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 10125 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10126 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10127 | {} |
| 10128 | }; |
| 10129 | |
| 10130 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10131 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10132 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10133 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10134 | |
| 10135 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10136 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10137 | {} |
| 10138 | }; |
| 10139 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10140 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10141 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10142 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10143 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10144 | |
| 10145 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10146 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10147 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10148 | }; |
| 10149 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10150 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10151 | .num_items = 2, |
| 10152 | .items = { |
| 10153 | { "Int DMic", 0x9 }, |
| 10154 | { "Mic", 0x0 }, |
| 10155 | }, |
| 10156 | }; |
| 10157 | |
| 10158 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10159 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10160 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10161 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10162 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10163 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10164 | { } /* end */ |
| 10165 | }; |
| 10166 | |
| 10167 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10168 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10169 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10170 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10172 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10173 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10174 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10175 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10176 | {} |
| 10177 | }; |
| 10178 | |
| 10179 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10180 | { |
| 10181 | unsigned int present; |
| 10182 | |
| 10183 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10184 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10185 | snd_hda_codec_write(codec, 0x22, 0, |
| 10186 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10187 | } |
| 10188 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10189 | |
| 10190 | /* unsolicited event for HP jack sensing */ |
| 10191 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10192 | unsigned int res) |
| 10193 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10194 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10195 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10196 | else |
| 10197 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10198 | } |
| 10199 | |
| 10200 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10201 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10202 | struct alc_spec *spec = codec->spec; |
| 10203 | |
| 10204 | spec->autocfg.hp_pins[0] = 0x15; |
| 10205 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10206 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10207 | alc262_dmic_automute(codec); |
| 10208 | } |
| 10209 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10210 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10211 | * nec model |
| 10212 | * 0x15 = headphone |
| 10213 | * 0x16 = internal speaker |
| 10214 | * 0x18 = external mic |
| 10215 | */ |
| 10216 | |
| 10217 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10218 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10219 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10220 | |
| 10221 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10223 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10224 | |
| 10225 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10227 | { } /* end */ |
| 10228 | }; |
| 10229 | |
| 10230 | static struct hda_verb alc262_nec_verbs[] = { |
| 10231 | /* Unmute Speaker */ |
| 10232 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10233 | |
| 10234 | /* Headphone */ |
| 10235 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10237 | |
| 10238 | /* External mic to headphone */ |
| 10239 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10240 | /* External mic to speaker */ |
| 10241 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10242 | {} |
| 10243 | }; |
| 10244 | |
| 10245 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10246 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10247 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10248 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10249 | */ |
| 10250 | |
| 10251 | #define ALC_HP_EVENT 0x37 |
| 10252 | |
| 10253 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10254 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10256 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10257 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10258 | {} |
| 10259 | }; |
| 10260 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10261 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10262 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10263 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10264 | {} |
| 10265 | }; |
| 10266 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10267 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10268 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10269 | .items = { |
| 10270 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10271 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10272 | { "CD", 0x4 }, |
| 10273 | }, |
| 10274 | }; |
| 10275 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10276 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10277 | .num_items = 5, |
| 10278 | .items = { |
| 10279 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10280 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10281 | { "Line", 0x2 }, |
| 10282 | { "CD", 0x4 }, |
| 10283 | { "AUX IN", 0x6 }, |
| 10284 | }, |
| 10285 | }; |
| 10286 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10287 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10288 | .num_items = 4, |
| 10289 | .items = { |
| 10290 | { "Mic", 0x0 }, |
| 10291 | { "Front Mic", 0x2 }, |
| 10292 | { "Line", 0x1 }, |
| 10293 | { "CD", 0x4 }, |
| 10294 | }, |
| 10295 | }; |
| 10296 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10297 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10298 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10299 | { |
| 10300 | struct alc_spec *spec = codec->spec; |
| 10301 | unsigned int mute; |
| 10302 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10303 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10304 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10305 | /* need to execute and sync at first */ |
| 10306 | 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] | 10307 | /* check laptop HP jack */ |
| 10308 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10309 | AC_VERB_GET_PIN_SENSE, 0); |
| 10310 | /* need to execute and sync at first */ |
| 10311 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10312 | /* check docking HP jack */ |
| 10313 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10314 | AC_VERB_GET_PIN_SENSE, 0); |
| 10315 | if (present & AC_PINSENSE_PRESENCE) |
| 10316 | spec->jack_present = 1; |
| 10317 | else |
| 10318 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10319 | spec->sense_updated = 1; |
| 10320 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10321 | /* unmute internal speaker only if both HPs are unplugged and |
| 10322 | * master switch is on |
| 10323 | */ |
| 10324 | if (spec->jack_present) |
| 10325 | mute = HDA_AMP_MUTE; |
| 10326 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10327 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10328 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10329 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10330 | } |
| 10331 | |
| 10332 | /* unsolicited event for HP jack sensing */ |
| 10333 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10334 | unsigned int res) |
| 10335 | { |
| 10336 | if ((res >> 26) != ALC_HP_EVENT) |
| 10337 | return; |
| 10338 | alc262_fujitsu_automute(codec, 1); |
| 10339 | } |
| 10340 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10341 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10342 | { |
| 10343 | alc262_fujitsu_automute(codec, 1); |
| 10344 | } |
| 10345 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10346 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10347 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10348 | .ops = &snd_hda_bind_vol, |
| 10349 | .values = { |
| 10350 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10351 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10352 | 0 |
| 10353 | }, |
| 10354 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10355 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10356 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10357 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10358 | { |
| 10359 | struct alc_spec *spec = codec->spec; |
| 10360 | unsigned int mute; |
| 10361 | |
| 10362 | if (force || !spec->sense_updated) { |
| 10363 | unsigned int present_int_hp; |
| 10364 | /* need to execute and sync at first */ |
| 10365 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10366 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10367 | AC_VERB_GET_PIN_SENSE, 0); |
| 10368 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10369 | spec->sense_updated = 1; |
| 10370 | } |
| 10371 | if (spec->jack_present) { |
| 10372 | /* mute internal speaker */ |
| 10373 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10374 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10375 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10376 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10377 | } else { |
| 10378 | /* unmute internal speaker if necessary */ |
| 10379 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10380 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10381 | HDA_AMP_MUTE, mute); |
| 10382 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10383 | HDA_AMP_MUTE, mute); |
| 10384 | } |
| 10385 | } |
| 10386 | |
| 10387 | /* unsolicited event for HP jack sensing */ |
| 10388 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10389 | unsigned int res) |
| 10390 | { |
| 10391 | if ((res >> 26) != ALC_HP_EVENT) |
| 10392 | return; |
| 10393 | alc262_lenovo_3000_automute(codec, 1); |
| 10394 | } |
| 10395 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10396 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10397 | int dir, int idx, long *valp) |
| 10398 | { |
| 10399 | int i, change = 0; |
| 10400 | |
| 10401 | for (i = 0; i < 2; i++, valp++) |
| 10402 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10403 | HDA_AMP_MUTE, |
| 10404 | *valp ? 0 : HDA_AMP_MUTE); |
| 10405 | return change; |
| 10406 | } |
| 10407 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10408 | /* bind hp and internal speaker mute (with plug check) */ |
| 10409 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10410 | struct snd_ctl_elem_value *ucontrol) |
| 10411 | { |
| 10412 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10413 | long *valp = ucontrol->value.integer.value; |
| 10414 | int change; |
| 10415 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10416 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10417 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10418 | if (change) |
| 10419 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10420 | return change; |
| 10421 | } |
| 10422 | |
| 10423 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10424 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10425 | { |
| 10426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10427 | .name = "Master Playback Switch", |
| 10428 | .info = snd_hda_mixer_amp_switch_info, |
| 10429 | .get = snd_hda_mixer_amp_switch_get, |
| 10430 | .put = alc262_fujitsu_master_sw_put, |
| 10431 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10432 | }, |
| 10433 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10434 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10435 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10436 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10438 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10439 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10440 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10441 | { } /* end */ |
| 10442 | }; |
| 10443 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10444 | /* bind hp and internal speaker mute (with plug check) */ |
| 10445 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10446 | struct snd_ctl_elem_value *ucontrol) |
| 10447 | { |
| 10448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10449 | long *valp = ucontrol->value.integer.value; |
| 10450 | int change; |
| 10451 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10452 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10453 | if (change) |
| 10454 | alc262_lenovo_3000_automute(codec, 0); |
| 10455 | return change; |
| 10456 | } |
| 10457 | |
| 10458 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10459 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10460 | { |
| 10461 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10462 | .name = "Master Playback Switch", |
| 10463 | .info = snd_hda_mixer_amp_switch_info, |
| 10464 | .get = snd_hda_mixer_amp_switch_get, |
| 10465 | .put = alc262_lenovo_3000_master_sw_put, |
| 10466 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10467 | }, |
| 10468 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10469 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10470 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10471 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10473 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10474 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10475 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10476 | { } /* end */ |
| 10477 | }; |
| 10478 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10479 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10480 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10481 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10484 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10485 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10486 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10487 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10488 | { } /* end */ |
| 10489 | }; |
| 10490 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10491 | /* additional init verbs for Benq laptops */ |
| 10492 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10493 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10494 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10495 | {} |
| 10496 | }; |
| 10497 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10498 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10499 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10500 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10501 | |
| 10502 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10503 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10504 | {} |
| 10505 | }; |
| 10506 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10507 | /* Samsung Q1 Ultra Vista model setup */ |
| 10508 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10509 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10510 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10511 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10512 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10513 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10514 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10515 | { } /* end */ |
| 10516 | }; |
| 10517 | |
| 10518 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10519 | /* output mixer */ |
| 10520 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10521 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10522 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10523 | /* speaker */ |
| 10524 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10525 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10526 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10527 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10528 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10529 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10530 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10531 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10532 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10533 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10534 | /* internal mic */ |
| 10535 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10536 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10537 | /* ADC, choose mic */ |
| 10538 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10539 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10540 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10542 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10543 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10544 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10545 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10546 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10547 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10548 | {} |
| 10549 | }; |
| 10550 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10551 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10552 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10553 | { |
| 10554 | struct alc_spec *spec = codec->spec; |
| 10555 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10556 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10557 | mute = 0; |
| 10558 | /* auto-mute only when HP is used as HP */ |
| 10559 | if (!spec->cur_mux[0]) { |
| 10560 | unsigned int present; |
| 10561 | /* need to execute and sync at first */ |
| 10562 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10563 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10564 | AC_VERB_GET_PIN_SENSE, 0); |
| 10565 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10566 | if (spec->jack_present) |
| 10567 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10568 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10569 | /* mute/unmute internal speaker */ |
| 10570 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10571 | HDA_AMP_MUTE, mute); |
| 10572 | /* mute/unmute HP */ |
| 10573 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10574 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10575 | } |
| 10576 | |
| 10577 | /* unsolicited event for HP jack sensing */ |
| 10578 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10579 | unsigned int res) |
| 10580 | { |
| 10581 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10582 | return; |
| 10583 | alc262_ultra_automute(codec); |
| 10584 | } |
| 10585 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10586 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10587 | .num_items = 2, |
| 10588 | .items = { |
| 10589 | { "Mic", 0x1 }, |
| 10590 | { "Headphone", 0x7 }, |
| 10591 | }, |
| 10592 | }; |
| 10593 | |
| 10594 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10595 | struct snd_ctl_elem_value *ucontrol) |
| 10596 | { |
| 10597 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10598 | struct alc_spec *spec = codec->spec; |
| 10599 | int ret; |
| 10600 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10601 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10602 | if (!ret) |
| 10603 | return 0; |
| 10604 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10605 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10606 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10607 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10608 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10609 | return ret; |
| 10610 | } |
| 10611 | |
| 10612 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10613 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10614 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10615 | { |
| 10616 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10617 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10618 | .info = alc_mux_enum_info, |
| 10619 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10620 | .put = alc262_ultra_mux_enum_put, |
| 10621 | }, |
| 10622 | { } /* end */ |
| 10623 | }; |
| 10624 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10625 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10626 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10627 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10628 | { |
| 10629 | hda_nid_t nid; |
| 10630 | int err; |
| 10631 | |
| 10632 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10633 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10634 | spec->multiout.dac_nids[0] = 2; |
| 10635 | |
| 10636 | nid = cfg->line_out_pins[0]; |
| 10637 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10638 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10639 | "Front Playback Volume", |
| 10640 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10641 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10642 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10643 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10644 | "Front Playback Switch", |
| 10645 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10646 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10647 | return err; |
| 10648 | } |
| 10649 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10650 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10651 | if (nid) { |
| 10652 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10653 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10654 | "Speaker Playback Volume", |
| 10655 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10656 | HDA_OUTPUT)); |
| 10657 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10658 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10659 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10660 | "Speaker Playback Switch", |
| 10661 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10662 | HDA_OUTPUT)); |
| 10663 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10664 | return err; |
| 10665 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10666 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10667 | "Speaker Playback Switch", |
| 10668 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10669 | HDA_OUTPUT)); |
| 10670 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10671 | return err; |
| 10672 | } |
| 10673 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10674 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10675 | if (nid) { |
| 10676 | /* spec->multiout.hp_nid = 2; */ |
| 10677 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10678 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10679 | "Headphone Playback Volume", |
| 10680 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10681 | HDA_OUTPUT)); |
| 10682 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10683 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10684 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10685 | "Headphone Playback Switch", |
| 10686 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10687 | HDA_OUTPUT)); |
| 10688 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10689 | return err; |
| 10690 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10691 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10692 | "Headphone Playback Switch", |
| 10693 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10694 | HDA_OUTPUT)); |
| 10695 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10696 | return err; |
| 10697 | } |
| 10698 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10699 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10700 | } |
| 10701 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 10702 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10703 | const struct auto_pin_cfg *cfg) |
| 10704 | { |
| 10705 | int err; |
| 10706 | |
| 10707 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10708 | if (err < 0) |
| 10709 | return err; |
| 10710 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10711 | * because it's under 0x18 |
| 10712 | */ |
| 10713 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10714 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10715 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10716 | imux->items[imux->num_items].label = "Int Mic"; |
| 10717 | imux->items[imux->num_items].index = 0x09; |
| 10718 | imux->num_items++; |
| 10719 | } |
| 10720 | return 0; |
| 10721 | } |
| 10722 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10723 | |
| 10724 | /* |
| 10725 | * generic initialization of ADC, input mixers and output mixers |
| 10726 | */ |
| 10727 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10728 | /* |
| 10729 | * Unmute ADC0-2 and set the default input to mic-in |
| 10730 | */ |
| 10731 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10732 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10733 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10734 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10735 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10736 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10737 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10738 | /* 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] | 10739 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10740 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10741 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10742 | */ |
| 10743 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10746 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10747 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10748 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10749 | |
| 10750 | /* |
| 10751 | * Set up output mixers (0x0c - 0x0f) |
| 10752 | */ |
| 10753 | /* set vol=0 to output mixers */ |
| 10754 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10755 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10756 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10757 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10758 | /* set up input amps for analog loopback */ |
| 10759 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10760 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10762 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10763 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10764 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10765 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10766 | |
| 10767 | /* FIXME: use matrix-type input source selection */ |
| 10768 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10769 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10770 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10771 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10772 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10773 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10774 | /* Input mixer2 */ |
| 10775 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10776 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10777 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10778 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10779 | /* Input mixer3 */ |
| 10780 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10781 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10782 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10783 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10784 | |
| 10785 | { } |
| 10786 | }; |
| 10787 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10788 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10789 | /* |
| 10790 | * Unmute ADC0-2 and set the default input to mic-in |
| 10791 | */ |
| 10792 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10794 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10795 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10796 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10797 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10798 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10799 | /* 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] | 10800 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10801 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10802 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10803 | */ |
| 10804 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10806 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10807 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10808 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10809 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10810 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10811 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10812 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10813 | /* |
| 10814 | * Set up output mixers (0x0c - 0x0e) |
| 10815 | */ |
| 10816 | /* set vol=0 to output mixers */ |
| 10817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10818 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10819 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10820 | |
| 10821 | /* set up input amps for analog loopback */ |
| 10822 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10823 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10824 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10825 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10826 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10827 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10828 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10829 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10830 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10831 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10832 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10833 | |
| 10834 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10835 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10836 | |
| 10837 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10838 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10839 | |
| 10840 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10841 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10842 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10843 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10844 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10845 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10846 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10848 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10849 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10850 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10851 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10852 | |
| 10853 | |
| 10854 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10855 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 10856 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10858 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10864 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10865 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10866 | /* Input mixer2 */ |
| 10867 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10871 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10872 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10873 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10874 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10875 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10876 | /* Input mixer3 */ |
| 10877 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10878 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10879 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10880 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10882 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10883 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10884 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10885 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10886 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10887 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10888 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10889 | { } |
| 10890 | }; |
| 10891 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10892 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10893 | /* |
| 10894 | * Unmute ADC0-2 and set the default input to mic-in |
| 10895 | */ |
| 10896 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10898 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10899 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10900 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10901 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10902 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10903 | /* 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] | 10904 | * mixer widget |
| 10905 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10906 | * panel mic (mic 2) |
| 10907 | */ |
| 10908 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10910 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10911 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10912 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10913 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10916 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10917 | /* |
| 10918 | * Set up output mixers (0x0c - 0x0e) |
| 10919 | */ |
| 10920 | /* set vol=0 to output mixers */ |
| 10921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10922 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10923 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10924 | |
| 10925 | /* set up input amps for analog loopback */ |
| 10926 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10928 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10929 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10930 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10931 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10932 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10933 | |
| 10934 | |
| 10935 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10936 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10937 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10938 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10939 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10941 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10942 | |
| 10943 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10944 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10945 | |
| 10946 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10947 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10948 | |
| 10949 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10950 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10951 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10952 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10953 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10954 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10955 | |
| 10956 | /* FIXME: use matrix-type input source selection */ |
| 10957 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10958 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10959 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10960 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10961 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10962 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10963 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10964 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10965 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10966 | /* Input mixer2 */ |
| 10967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10968 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10969 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10970 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10971 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10972 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10973 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10974 | /* Input mixer3 */ |
| 10975 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10979 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10980 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10981 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10982 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10983 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10984 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10985 | { } |
| 10986 | }; |
| 10987 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10988 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10989 | |
| 10990 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10991 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10992 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10993 | |
| 10994 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10995 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10996 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10997 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10998 | |
| 10999 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11000 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11001 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11002 | {} |
| 11003 | }; |
| 11004 | |
| 11005 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11006 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11007 | #define alc262_loopbacks alc880_loopbacks |
| 11008 | #endif |
| 11009 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11010 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11011 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11012 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11013 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11014 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11015 | |
| 11016 | /* |
| 11017 | * BIOS auto configuration |
| 11018 | */ |
| 11019 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11020 | { |
| 11021 | struct alc_spec *spec = codec->spec; |
| 11022 | int err; |
| 11023 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11024 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11025 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11026 | alc262_ignore); |
| 11027 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11028 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11029 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11030 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11031 | spec->multiout.max_channels = 2; |
| 11032 | spec->no_analog = 1; |
| 11033 | goto dig_only; |
| 11034 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11035 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11036 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11037 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11038 | if (err < 0) |
| 11039 | return err; |
| 11040 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11041 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11042 | return err; |
| 11043 | |
| 11044 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11045 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11046 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11047 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11048 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11049 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11050 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11051 | if (spec->autocfg.dig_in_pin) |
| 11052 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11053 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11054 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11055 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11056 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11057 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11058 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11059 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11060 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11061 | err = alc_auto_add_mic_boost(codec); |
| 11062 | if (err < 0) |
| 11063 | return err; |
| 11064 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11065 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11066 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11067 | return 1; |
| 11068 | } |
| 11069 | |
| 11070 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11071 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11072 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11073 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11074 | |
| 11075 | |
| 11076 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11077 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11078 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11079 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11080 | alc262_auto_init_multi_out(codec); |
| 11081 | alc262_auto_init_hp_out(codec); |
| 11082 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11083 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11084 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11085 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11086 | } |
| 11087 | |
| 11088 | /* |
| 11089 | * configuration and preset |
| 11090 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11091 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11092 | [ALC262_BASIC] = "basic", |
| 11093 | [ALC262_HIPPO] = "hippo", |
| 11094 | [ALC262_HIPPO_1] = "hippo_1", |
| 11095 | [ALC262_FUJITSU] = "fujitsu", |
| 11096 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11097 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11098 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11099 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11100 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11101 | [ALC262_BENQ_T31] = "benq-t31", |
| 11102 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11103 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11104 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11105 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11106 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11107 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11108 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11109 | [ALC262_AUTO] = "auto", |
| 11110 | }; |
| 11111 | |
| 11112 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11113 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11114 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11115 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11116 | ALC262_HP_BPC), |
| 11117 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11118 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11119 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11120 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11121 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11122 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11123 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11124 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11125 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11126 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11127 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11128 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11129 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11130 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11131 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11132 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11133 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11134 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11135 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11136 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11137 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11138 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11139 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11140 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11141 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11142 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11143 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11144 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11145 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11146 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11147 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11148 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11149 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11150 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11151 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11152 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11153 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11154 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11155 | {} |
| 11156 | }; |
| 11157 | |
| 11158 | static struct alc_config_preset alc262_presets[] = { |
| 11159 | [ALC262_BASIC] = { |
| 11160 | .mixers = { alc262_base_mixer }, |
| 11161 | .init_verbs = { alc262_init_verbs }, |
| 11162 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11163 | .dac_nids = alc262_dac_nids, |
| 11164 | .hp_nid = 0x03, |
| 11165 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11166 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11167 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11168 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11169 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11170 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11171 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11172 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11173 | .dac_nids = alc262_dac_nids, |
| 11174 | .hp_nid = 0x03, |
| 11175 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11176 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11177 | .channel_mode = alc262_modes, |
| 11178 | .input_mux = &alc262_capture_source, |
| 11179 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11180 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11181 | }, |
| 11182 | [ALC262_HIPPO_1] = { |
| 11183 | .mixers = { alc262_hippo1_mixer }, |
| 11184 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11185 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11186 | .dac_nids = alc262_dac_nids, |
| 11187 | .hp_nid = 0x02, |
| 11188 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11189 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11190 | .channel_mode = alc262_modes, |
| 11191 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11192 | .unsol_event = alc262_hippo_unsol_event, |
| 11193 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11194 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11195 | [ALC262_FUJITSU] = { |
| 11196 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11197 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11198 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11199 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11200 | .dac_nids = alc262_dac_nids, |
| 11201 | .hp_nid = 0x03, |
| 11202 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11203 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11204 | .channel_mode = alc262_modes, |
| 11205 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11206 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11207 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11208 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11209 | [ALC262_HP_BPC] = { |
| 11210 | .mixers = { alc262_HP_BPC_mixer }, |
| 11211 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11212 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11213 | .dac_nids = alc262_dac_nids, |
| 11214 | .hp_nid = 0x03, |
| 11215 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11216 | .channel_mode = alc262_modes, |
| 11217 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11218 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11219 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11220 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11221 | [ALC262_HP_BPC_D7000_WF] = { |
| 11222 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11223 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11224 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11225 | .dac_nids = alc262_dac_nids, |
| 11226 | .hp_nid = 0x03, |
| 11227 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11228 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11229 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11230 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11231 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11232 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11233 | [ALC262_HP_BPC_D7000_WL] = { |
| 11234 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11235 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11236 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11237 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11238 | .dac_nids = alc262_dac_nids, |
| 11239 | .hp_nid = 0x03, |
| 11240 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11241 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11242 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11243 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11244 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11245 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11246 | [ALC262_HP_TC_T5735] = { |
| 11247 | .mixers = { alc262_hp_t5735_mixer }, |
| 11248 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11249 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11250 | .dac_nids = alc262_dac_nids, |
| 11251 | .hp_nid = 0x03, |
| 11252 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11253 | .channel_mode = alc262_modes, |
| 11254 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11255 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11256 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11257 | }, |
| 11258 | [ALC262_HP_RP5700] = { |
| 11259 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11260 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11261 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11262 | .dac_nids = alc262_dac_nids, |
| 11263 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11264 | .channel_mode = alc262_modes, |
| 11265 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11266 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11267 | [ALC262_BENQ_ED8] = { |
| 11268 | .mixers = { alc262_base_mixer }, |
| 11269 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11270 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11271 | .dac_nids = alc262_dac_nids, |
| 11272 | .hp_nid = 0x03, |
| 11273 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11274 | .channel_mode = alc262_modes, |
| 11275 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11276 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11277 | [ALC262_SONY_ASSAMD] = { |
| 11278 | .mixers = { alc262_sony_mixer }, |
| 11279 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11280 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11281 | .dac_nids = alc262_dac_nids, |
| 11282 | .hp_nid = 0x02, |
| 11283 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11284 | .channel_mode = alc262_modes, |
| 11285 | .input_mux = &alc262_capture_source, |
| 11286 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11287 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11288 | }, |
| 11289 | [ALC262_BENQ_T31] = { |
| 11290 | .mixers = { alc262_benq_t31_mixer }, |
| 11291 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11292 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11293 | .dac_nids = alc262_dac_nids, |
| 11294 | .hp_nid = 0x03, |
| 11295 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11296 | .channel_mode = alc262_modes, |
| 11297 | .input_mux = &alc262_capture_source, |
| 11298 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11299 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11300 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11301 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11302 | .mixers = { alc262_ultra_mixer }, |
| 11303 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11304 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11305 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11306 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11307 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11308 | .channel_mode = alc262_modes, |
| 11309 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11310 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11311 | .capsrc_nids = alc262_capsrc_nids, |
| 11312 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11313 | .unsol_event = alc262_ultra_unsol_event, |
| 11314 | .init_hook = alc262_ultra_automute, |
| 11315 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11316 | [ALC262_LENOVO_3000] = { |
| 11317 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11318 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11319 | alc262_lenovo_3000_unsol_verbs }, |
| 11320 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11321 | .dac_nids = alc262_dac_nids, |
| 11322 | .hp_nid = 0x03, |
| 11323 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11324 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11325 | .channel_mode = alc262_modes, |
| 11326 | .input_mux = &alc262_fujitsu_capture_source, |
| 11327 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11328 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11329 | [ALC262_NEC] = { |
| 11330 | .mixers = { alc262_nec_mixer }, |
| 11331 | .init_verbs = { alc262_nec_verbs }, |
| 11332 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11333 | .dac_nids = alc262_dac_nids, |
| 11334 | .hp_nid = 0x03, |
| 11335 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11336 | .channel_mode = alc262_modes, |
| 11337 | .input_mux = &alc262_capture_source, |
| 11338 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11339 | [ALC262_TOSHIBA_S06] = { |
| 11340 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11341 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11342 | alc262_eapd_verbs }, |
| 11343 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11344 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11345 | .dac_nids = alc262_dac_nids, |
| 11346 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11347 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11348 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11349 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11350 | .channel_mode = alc262_modes, |
| 11351 | .input_mux = &alc262_dmic_capture_source, |
| 11352 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11353 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11354 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11355 | [ALC262_TOSHIBA_RX1] = { |
| 11356 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11357 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11358 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11359 | .dac_nids = alc262_dac_nids, |
| 11360 | .hp_nid = 0x03, |
| 11361 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11362 | .channel_mode = alc262_modes, |
| 11363 | .input_mux = &alc262_capture_source, |
| 11364 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11365 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11366 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11367 | [ALC262_TYAN] = { |
| 11368 | .mixers = { alc262_tyan_mixer }, |
| 11369 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11370 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11371 | .dac_nids = alc262_dac_nids, |
| 11372 | .hp_nid = 0x02, |
| 11373 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11374 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11375 | .channel_mode = alc262_modes, |
| 11376 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11377 | .unsol_event = alc_automute_amp_unsol_event, |
| 11378 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11379 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11380 | }; |
| 11381 | |
| 11382 | static int patch_alc262(struct hda_codec *codec) |
| 11383 | { |
| 11384 | struct alc_spec *spec; |
| 11385 | int board_config; |
| 11386 | int err; |
| 11387 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11388 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11389 | if (spec == NULL) |
| 11390 | return -ENOMEM; |
| 11391 | |
| 11392 | codec->spec = spec; |
| 11393 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11394 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11395 | * under-run |
| 11396 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11397 | { |
| 11398 | int tmp; |
| 11399 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11400 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11401 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11402 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11403 | } |
| 11404 | #endif |
| 11405 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11406 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11407 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11408 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11409 | alc262_models, |
| 11410 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11411 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11412 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11413 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11414 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11415 | board_config = ALC262_AUTO; |
| 11416 | } |
| 11417 | |
| 11418 | if (board_config == ALC262_AUTO) { |
| 11419 | /* automatic parse from the BIOS config */ |
| 11420 | err = alc262_parse_auto_config(codec); |
| 11421 | if (err < 0) { |
| 11422 | alc_free(codec); |
| 11423 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11424 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11425 | printk(KERN_INFO |
| 11426 | "hda_codec: Cannot set up configuration " |
| 11427 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11428 | board_config = ALC262_BASIC; |
| 11429 | } |
| 11430 | } |
| 11431 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11432 | if (!spec->no_analog) { |
| 11433 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11434 | if (err < 0) { |
| 11435 | alc_free(codec); |
| 11436 | return err; |
| 11437 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11438 | } |
| 11439 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11440 | if (board_config != ALC262_AUTO) |
| 11441 | setup_preset(spec, &alc262_presets[board_config]); |
| 11442 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11443 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11444 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11445 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11446 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11447 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11448 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11449 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11450 | int i; |
| 11451 | /* check whether the digital-mic has to be supported */ |
| 11452 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11453 | if (spec->input_mux->items[i].index >= 9) |
| 11454 | break; |
| 11455 | } |
| 11456 | if (i < spec->input_mux->num_items) { |
| 11457 | /* use only ADC0 */ |
| 11458 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11459 | spec->num_adc_nids = 1; |
| 11460 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11461 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11462 | /* all analog inputs */ |
| 11463 | /* check whether NID 0x07 is valid */ |
| 11464 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11465 | |
| 11466 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11467 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11468 | if (wcap != AC_WID_AUD_IN) { |
| 11469 | spec->adc_nids = alc262_adc_nids_alt; |
| 11470 | spec->num_adc_nids = |
| 11471 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11472 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11473 | } else { |
| 11474 | spec->adc_nids = alc262_adc_nids; |
| 11475 | spec->num_adc_nids = |
| 11476 | ARRAY_SIZE(alc262_adc_nids); |
| 11477 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11478 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11479 | } |
| 11480 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11481 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11482 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11483 | if (!spec->no_analog) |
| 11484 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11485 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11486 | spec->vmaster_nid = 0x0c; |
| 11487 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11488 | codec->patch_ops = alc_patch_ops; |
| 11489 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11490 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11491 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11492 | if (!spec->loopback.amplist) |
| 11493 | spec->loopback.amplist = alc262_loopbacks; |
| 11494 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11495 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11496 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11497 | return 0; |
| 11498 | } |
| 11499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11500 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11501 | * ALC268 channel source setting (2 channel) |
| 11502 | */ |
| 11503 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11504 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11505 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11506 | static hda_nid_t alc268_dac_nids[2] = { |
| 11507 | /* front, hp */ |
| 11508 | 0x02, 0x03 |
| 11509 | }; |
| 11510 | |
| 11511 | static hda_nid_t alc268_adc_nids[2] = { |
| 11512 | /* ADC0-1 */ |
| 11513 | 0x08, 0x07 |
| 11514 | }; |
| 11515 | |
| 11516 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11517 | /* ADC0 */ |
| 11518 | 0x08 |
| 11519 | }; |
| 11520 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11521 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11522 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11523 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11524 | /* output mixer control */ |
| 11525 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11526 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11527 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11529 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11530 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11531 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11532 | { } |
| 11533 | }; |
| 11534 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11535 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11536 | /* output mixer control */ |
| 11537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11538 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11539 | ALC262_HIPPO_MASTER_SWITCH, |
| 11540 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11541 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11542 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11543 | { } |
| 11544 | }; |
| 11545 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11546 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11547 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11548 | .ops = &snd_hda_bind_sw, |
| 11549 | .values = { |
| 11550 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11551 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11552 | 0 |
| 11553 | }, |
| 11554 | }; |
| 11555 | |
| 11556 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11557 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11558 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11559 | { } |
| 11560 | }; |
| 11561 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11562 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11563 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11564 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11565 | { } |
| 11566 | }; |
| 11567 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11568 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11569 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11570 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11571 | { } /* end */ |
| 11572 | }; |
| 11573 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11574 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11575 | .num_items = 2, |
| 11576 | .items = { |
| 11577 | { "i-Mic", 0x6 }, |
| 11578 | { "E-Mic", 0x0 }, |
| 11579 | }, |
| 11580 | }; |
| 11581 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11582 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11583 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11584 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11585 | .ops = &snd_hda_bind_vol, |
| 11586 | .values = { |
| 11587 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11588 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11589 | 0 |
| 11590 | }, |
| 11591 | }; |
| 11592 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11593 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11594 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11595 | { |
| 11596 | struct alc_spec *spec = codec->spec; |
| 11597 | unsigned int mute; |
| 11598 | |
| 11599 | if (force || !spec->sense_updated) { |
| 11600 | unsigned int present; |
| 11601 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11602 | AC_VERB_GET_PIN_SENSE, 0); |
| 11603 | spec->jack_present = (present & 0x80000000) != 0; |
| 11604 | spec->sense_updated = 1; |
| 11605 | } |
| 11606 | if (spec->jack_present) |
| 11607 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11608 | else /* unmute internal speaker if necessary */ |
| 11609 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11610 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11611 | HDA_AMP_MUTE, mute); |
| 11612 | } |
| 11613 | |
| 11614 | |
| 11615 | /* bind hp and internal speaker mute (with plug check) */ |
| 11616 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11617 | struct snd_ctl_elem_value *ucontrol) |
| 11618 | { |
| 11619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11620 | long *valp = ucontrol->value.integer.value; |
| 11621 | int change; |
| 11622 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11623 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11624 | if (change) |
| 11625 | alc268_acer_automute(codec, 0); |
| 11626 | return change; |
| 11627 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11628 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11629 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11630 | /* output mixer control */ |
| 11631 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11632 | { |
| 11633 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11634 | .name = "Master Playback Switch", |
| 11635 | .info = snd_hda_mixer_amp_switch_info, |
| 11636 | .get = snd_hda_mixer_amp_switch_get, |
| 11637 | .put = alc268_acer_master_sw_put, |
| 11638 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11639 | }, |
| 11640 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11641 | { } |
| 11642 | }; |
| 11643 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11644 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11645 | /* output mixer control */ |
| 11646 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11647 | { |
| 11648 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11649 | .name = "Master Playback Switch", |
| 11650 | .info = snd_hda_mixer_amp_switch_info, |
| 11651 | .get = snd_hda_mixer_amp_switch_get, |
| 11652 | .put = alc268_acer_master_sw_put, |
| 11653 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11654 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11655 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11656 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11657 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11658 | { } |
| 11659 | }; |
| 11660 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11661 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11662 | /* output mixer control */ |
| 11663 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11664 | { |
| 11665 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11666 | .name = "Master Playback Switch", |
| 11667 | .info = snd_hda_mixer_amp_switch_info, |
| 11668 | .get = snd_hda_mixer_amp_switch_get, |
| 11669 | .put = alc268_acer_master_sw_put, |
| 11670 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11671 | }, |
| 11672 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11673 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11674 | { } |
| 11675 | }; |
| 11676 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11677 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11678 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11679 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11680 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11681 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11682 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11683 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11684 | { } |
| 11685 | }; |
| 11686 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11687 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11688 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11689 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11692 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11693 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11694 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11695 | { } |
| 11696 | }; |
| 11697 | |
| 11698 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11699 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11700 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11701 | |
| 11702 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11703 | unsigned int res) |
| 11704 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11705 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11706 | return; |
| 11707 | alc268_acer_automute(codec, 1); |
| 11708 | } |
| 11709 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11710 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11711 | { |
| 11712 | alc268_acer_automute(codec, 1); |
| 11713 | } |
| 11714 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11715 | /* toggle speaker-output according to the hp-jack state */ |
| 11716 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11717 | { |
| 11718 | unsigned int present; |
| 11719 | unsigned char bits; |
| 11720 | |
| 11721 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11722 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11723 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11724 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11725 | AMP_IN_MUTE(0), bits); |
| 11726 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11727 | AMP_IN_MUTE(0), bits); |
| 11728 | } |
| 11729 | |
| 11730 | |
| 11731 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11732 | { |
| 11733 | unsigned int present; |
| 11734 | |
| 11735 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11736 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11737 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11738 | present ? 0x0 : 0x6); |
| 11739 | } |
| 11740 | |
| 11741 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11742 | unsigned int res) |
| 11743 | { |
| 11744 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11745 | alc268_aspire_one_speaker_automute(codec); |
| 11746 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11747 | alc268_acer_mic_automute(codec); |
| 11748 | } |
| 11749 | |
| 11750 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11751 | { |
| 11752 | alc268_aspire_one_speaker_automute(codec); |
| 11753 | alc268_acer_mic_automute(codec); |
| 11754 | } |
| 11755 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11756 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11757 | /* output mixer control */ |
| 11758 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11759 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11760 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11761 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11762 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11763 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11764 | { } |
| 11765 | }; |
| 11766 | |
| 11767 | static struct hda_verb alc268_dell_verbs[] = { |
| 11768 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11769 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11770 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11771 | { } |
| 11772 | }; |
| 11773 | |
| 11774 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11775 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11776 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11777 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11778 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11779 | spec->autocfg.hp_pins[0] = 0x15; |
| 11780 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11781 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11782 | } |
| 11783 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11784 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11785 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11786 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11787 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11788 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11789 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11790 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11791 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11792 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11793 | { } |
| 11794 | }; |
| 11795 | |
| 11796 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11797 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11798 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11799 | { } |
| 11800 | }; |
| 11801 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11802 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11803 | { |
| 11804 | unsigned int present; |
| 11805 | |
| 11806 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11807 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11808 | snd_hda_codec_write(codec, 0x23, 0, |
| 11809 | AC_VERB_SET_CONNECT_SEL, |
| 11810 | present ? 0x00 : 0x01); |
| 11811 | } |
| 11812 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11813 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11814 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11815 | struct alc_spec *spec = codec->spec; |
| 11816 | |
| 11817 | spec->autocfg.hp_pins[0] = 0x15; |
| 11818 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11819 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11820 | alc267_quanta_il1_mic_automute(codec); |
| 11821 | } |
| 11822 | |
| 11823 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11824 | unsigned int res) |
| 11825 | { |
| 11826 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11827 | case ALC880_MIC_EVENT: |
| 11828 | alc267_quanta_il1_mic_automute(codec); |
| 11829 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11830 | default: |
| 11831 | alc_sku_unsol_event(codec, res); |
| 11832 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11833 | } |
| 11834 | } |
| 11835 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11836 | /* |
| 11837 | * generic initialization of ADC, input mixers and output mixers |
| 11838 | */ |
| 11839 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11840 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11841 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11842 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11843 | |
| 11844 | /* |
| 11845 | * Set up output mixers (0x0c - 0x0e) |
| 11846 | */ |
| 11847 | /* set vol=0 to output mixers */ |
| 11848 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11849 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11850 | |
| 11851 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11852 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11853 | |
| 11854 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11855 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11856 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11857 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11858 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11859 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11860 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11861 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11862 | |
| 11863 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11864 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11865 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11866 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11867 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11868 | |
| 11869 | /* set PCBEEP vol = 0, mute connections */ |
| 11870 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11871 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11872 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11873 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11874 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11875 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11876 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11877 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11878 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11879 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11880 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11881 | { } |
| 11882 | }; |
| 11883 | |
| 11884 | /* |
| 11885 | * generic initialization of ADC, input mixers and output mixers |
| 11886 | */ |
| 11887 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11888 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11889 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11890 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11891 | |
| 11892 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11893 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11894 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11895 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11896 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11897 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11898 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11899 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11900 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11901 | |
| 11902 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11903 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11904 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11905 | /* set PCBEEP vol = 0, mute connections */ |
| 11906 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11907 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11908 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11909 | |
| 11910 | { } |
| 11911 | }; |
| 11912 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11913 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11914 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11915 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11916 | { |
| 11917 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11918 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11919 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11920 | */ |
| 11921 | /* .name = "Capture Source", */ |
| 11922 | .name = "Input Source", |
| 11923 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11924 | .info = alc_mux_enum_info, |
| 11925 | .get = alc_mux_enum_get, |
| 11926 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11927 | }, |
| 11928 | { } /* end */ |
| 11929 | }; |
| 11930 | |
| 11931 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11932 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11933 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11934 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11935 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11936 | { |
| 11937 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11938 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11939 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11940 | */ |
| 11941 | /* .name = "Capture Source", */ |
| 11942 | .name = "Input Source", |
| 11943 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11944 | .info = alc_mux_enum_info, |
| 11945 | .get = alc_mux_enum_get, |
| 11946 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11947 | }, |
| 11948 | { } /* end */ |
| 11949 | }; |
| 11950 | |
| 11951 | static struct hda_input_mux alc268_capture_source = { |
| 11952 | .num_items = 4, |
| 11953 | .items = { |
| 11954 | { "Mic", 0x0 }, |
| 11955 | { "Front Mic", 0x1 }, |
| 11956 | { "Line", 0x2 }, |
| 11957 | { "CD", 0x3 }, |
| 11958 | }, |
| 11959 | }; |
| 11960 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11961 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11962 | .num_items = 3, |
| 11963 | .items = { |
| 11964 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11965 | { "Internal Mic", 0x1 }, |
| 11966 | { "Line", 0x2 }, |
| 11967 | }, |
| 11968 | }; |
| 11969 | |
| 11970 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11971 | .num_items = 3, |
| 11972 | .items = { |
| 11973 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11974 | { "Internal Mic", 0x6 }, |
| 11975 | { "Line", 0x2 }, |
| 11976 | }, |
| 11977 | }; |
| 11978 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11979 | #ifdef CONFIG_SND_DEBUG |
| 11980 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11981 | /* Volume widgets */ |
| 11982 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11983 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11984 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11985 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11986 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11987 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11988 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11989 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11990 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11991 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11992 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11993 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11994 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11995 | /* The below appears problematic on some hardwares */ |
| 11996 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11997 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11998 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11999 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12000 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12001 | |
| 12002 | /* Modes for retasking pin widgets */ |
| 12003 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12004 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12005 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12006 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12007 | |
| 12008 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12009 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12010 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12011 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12012 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12013 | |
| 12014 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12015 | * The ALC268 does not have an SPDIF input. |
| 12016 | */ |
| 12017 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12018 | |
| 12019 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12020 | * this output to turn on an external amplifier. |
| 12021 | */ |
| 12022 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12023 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12024 | |
| 12025 | { } /* end */ |
| 12026 | }; |
| 12027 | #endif |
| 12028 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12029 | /* create input playback/capture controls for the given pin */ |
| 12030 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12031 | const char *ctlname, int idx) |
| 12032 | { |
| 12033 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12034 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12035 | int err; |
| 12036 | |
| 12037 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12038 | switch (nid) { |
| 12039 | case 0x14: |
| 12040 | case 0x16: |
| 12041 | dac = 0x02; |
| 12042 | break; |
| 12043 | case 0x15: |
| 12044 | dac = 0x03; |
| 12045 | break; |
| 12046 | default: |
| 12047 | return 0; |
| 12048 | } |
| 12049 | if (spec->multiout.dac_nids[0] != dac && |
| 12050 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12051 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12052 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12053 | HDA_OUTPUT)); |
| 12054 | if (err < 0) |
| 12055 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12056 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12057 | } |
| 12058 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12059 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12060 | if (nid != 0x16) |
| 12061 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12062 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12063 | else /* mono */ |
| 12064 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12065 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12066 | if (err < 0) |
| 12067 | return err; |
| 12068 | return 0; |
| 12069 | } |
| 12070 | |
| 12071 | /* add playback controls from the parsed DAC table */ |
| 12072 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12073 | const struct auto_pin_cfg *cfg) |
| 12074 | { |
| 12075 | hda_nid_t nid; |
| 12076 | int err; |
| 12077 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12078 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12079 | |
| 12080 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12081 | if (nid) { |
| 12082 | const char *name; |
| 12083 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12084 | name = "Speaker"; |
| 12085 | else |
| 12086 | name = "Front"; |
| 12087 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12088 | if (err < 0) |
| 12089 | return err; |
| 12090 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12091 | |
| 12092 | nid = cfg->speaker_pins[0]; |
| 12093 | if (nid == 0x1d) { |
| 12094 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12095 | "Speaker Playback Volume", |
| 12096 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12097 | if (err < 0) |
| 12098 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12099 | } else { |
| 12100 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12101 | if (err < 0) |
| 12102 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12103 | } |
| 12104 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12105 | if (nid) { |
| 12106 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12107 | if (err < 0) |
| 12108 | return err; |
| 12109 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12110 | |
| 12111 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12112 | if (nid == 0x16) { |
| 12113 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12114 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12115 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12116 | if (err < 0) |
| 12117 | return err; |
| 12118 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12119 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12120 | } |
| 12121 | |
| 12122 | /* create playback/capture controls for input pins */ |
| 12123 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12124 | const struct auto_pin_cfg *cfg) |
| 12125 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12126 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12127 | int i, idx1; |
| 12128 | |
| 12129 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12130 | switch(cfg->input_pins[i]) { |
| 12131 | case 0x18: |
| 12132 | idx1 = 0; /* Mic 1 */ |
| 12133 | break; |
| 12134 | case 0x19: |
| 12135 | idx1 = 1; /* Mic 2 */ |
| 12136 | break; |
| 12137 | case 0x1a: |
| 12138 | idx1 = 2; /* Line In */ |
| 12139 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12140 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12141 | idx1 = 3; /* CD */ |
| 12142 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12143 | case 0x12: |
| 12144 | case 0x13: |
| 12145 | idx1 = 6; /* digital mics */ |
| 12146 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12147 | default: |
| 12148 | continue; |
| 12149 | } |
| 12150 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12151 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12152 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12153 | } |
| 12154 | return 0; |
| 12155 | } |
| 12156 | |
| 12157 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12158 | { |
| 12159 | struct alc_spec *spec = codec->spec; |
| 12160 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12161 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12162 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12163 | unsigned int dac_vol1, dac_vol2; |
| 12164 | |
| 12165 | if (speaker_nid) { |
| 12166 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12167 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12168 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12169 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12170 | AMP_IN_UNMUTE(1)); |
| 12171 | snd_hda_codec_write(codec, 0x10, 0, |
| 12172 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12173 | AMP_IN_UNMUTE(1)); |
| 12174 | } else { |
| 12175 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12176 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12177 | snd_hda_codec_write(codec, 0x10, 0, |
| 12178 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12179 | } |
| 12180 | |
| 12181 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12182 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12183 | dac_vol2 = AMP_OUT_ZERO; |
| 12184 | else if (line_nid == 0x15) |
| 12185 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12186 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12187 | dac_vol2 = AMP_OUT_ZERO; |
| 12188 | else if (hp_nid == 0x15) |
| 12189 | dac_vol1 = AMP_OUT_ZERO; |
| 12190 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12191 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12192 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12193 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12194 | |
| 12195 | snd_hda_codec_write(codec, 0x02, 0, |
| 12196 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12197 | snd_hda_codec_write(codec, 0x03, 0, |
| 12198 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12199 | } |
| 12200 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12201 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12202 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12203 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12204 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12205 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12206 | |
| 12207 | /* |
| 12208 | * BIOS auto configuration |
| 12209 | */ |
| 12210 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12211 | { |
| 12212 | struct alc_spec *spec = codec->spec; |
| 12213 | int err; |
| 12214 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12215 | |
| 12216 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12217 | alc268_ignore); |
| 12218 | if (err < 0) |
| 12219 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12220 | if (!spec->autocfg.line_outs) { |
| 12221 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12222 | spec->multiout.max_channels = 2; |
| 12223 | spec->no_analog = 1; |
| 12224 | goto dig_only; |
| 12225 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12226 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12227 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12228 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12229 | if (err < 0) |
| 12230 | return err; |
| 12231 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12232 | if (err < 0) |
| 12233 | return err; |
| 12234 | |
| 12235 | spec->multiout.max_channels = 2; |
| 12236 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12237 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12238 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12239 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12240 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12241 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12242 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12243 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12244 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12245 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12246 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12247 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12248 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12249 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12250 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12251 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12252 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12253 | err = alc_auto_add_mic_boost(codec); |
| 12254 | if (err < 0) |
| 12255 | return err; |
| 12256 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12257 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12258 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12259 | return 1; |
| 12260 | } |
| 12261 | |
| 12262 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12263 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12264 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12265 | |
| 12266 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12267 | static void alc268_auto_init(struct hda_codec *codec) |
| 12268 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12269 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12270 | alc268_auto_init_multi_out(codec); |
| 12271 | alc268_auto_init_hp_out(codec); |
| 12272 | alc268_auto_init_mono_speaker_out(codec); |
| 12273 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12274 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12275 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12276 | } |
| 12277 | |
| 12278 | /* |
| 12279 | * configuration and preset |
| 12280 | */ |
| 12281 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12282 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12283 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12284 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12285 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12286 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12287 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12288 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12289 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12290 | #ifdef CONFIG_SND_DEBUG |
| 12291 | [ALC268_TEST] = "test", |
| 12292 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12293 | [ALC268_AUTO] = "auto", |
| 12294 | }; |
| 12295 | |
| 12296 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12297 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12298 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12299 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12300 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12301 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12302 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12303 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12304 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12305 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12306 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12307 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12308 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12309 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12310 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12311 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12312 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12313 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12314 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12315 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12316 | {} |
| 12317 | }; |
| 12318 | |
| 12319 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12320 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12321 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12322 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12323 | alc267_quanta_il1_verbs }, |
| 12324 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12325 | .dac_nids = alc268_dac_nids, |
| 12326 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12327 | .adc_nids = alc268_adc_nids_alt, |
| 12328 | .hp_nid = 0x03, |
| 12329 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12330 | .channel_mode = alc268_modes, |
| 12331 | .input_mux = &alc268_capture_source, |
| 12332 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12333 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12334 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12335 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12336 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12337 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12338 | .init_verbs = { alc268_base_init_verbs }, |
| 12339 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12340 | .dac_nids = alc268_dac_nids, |
| 12341 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12342 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12343 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12344 | .hp_nid = 0x03, |
| 12345 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12346 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12347 | .channel_mode = alc268_modes, |
| 12348 | .input_mux = &alc268_capture_source, |
| 12349 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12350 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12351 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12352 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12353 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12354 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12355 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12356 | .dac_nids = alc268_dac_nids, |
| 12357 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12358 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12359 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12360 | .hp_nid = 0x03, |
| 12361 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12362 | .channel_mode = alc268_modes, |
| 12363 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12364 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12365 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12366 | }, |
| 12367 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12368 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12369 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12370 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12371 | alc268_acer_verbs }, |
| 12372 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12373 | .dac_nids = alc268_dac_nids, |
| 12374 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12375 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12376 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12377 | .hp_nid = 0x02, |
| 12378 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12379 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12380 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12381 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12382 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12383 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12384 | [ALC268_ACER_DMIC] = { |
| 12385 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12386 | alc268_beep_mixer }, |
| 12387 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12388 | alc268_acer_verbs }, |
| 12389 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12390 | .dac_nids = alc268_dac_nids, |
| 12391 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12392 | .adc_nids = alc268_adc_nids_alt, |
| 12393 | .capsrc_nids = alc268_capsrc_nids, |
| 12394 | .hp_nid = 0x02, |
| 12395 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12396 | .channel_mode = alc268_modes, |
| 12397 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12398 | .unsol_event = alc268_acer_unsol_event, |
| 12399 | .init_hook = alc268_acer_init_hook, |
| 12400 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12401 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12402 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12403 | alc268_beep_mixer, |
| 12404 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12405 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12406 | alc268_acer_aspire_one_verbs }, |
| 12407 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12408 | .dac_nids = alc268_dac_nids, |
| 12409 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12410 | .adc_nids = alc268_adc_nids_alt, |
| 12411 | .capsrc_nids = alc268_capsrc_nids, |
| 12412 | .hp_nid = 0x03, |
| 12413 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12414 | .channel_mode = alc268_modes, |
| 12415 | .input_mux = &alc268_acer_lc_capture_source, |
| 12416 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12417 | .init_hook = alc268_acer_lc_init_hook, |
| 12418 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12419 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12420 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12421 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12422 | alc268_dell_verbs }, |
| 12423 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12424 | .dac_nids = alc268_dac_nids, |
| 12425 | .hp_nid = 0x02, |
| 12426 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12427 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12428 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12429 | .init_hook = alc268_dell_init_hook, |
| 12430 | .input_mux = &alc268_capture_source, |
| 12431 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12432 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12433 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12434 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12435 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12436 | alc268_toshiba_verbs }, |
| 12437 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12438 | .dac_nids = alc268_dac_nids, |
| 12439 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12440 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12441 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12442 | .hp_nid = 0x03, |
| 12443 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12444 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12445 | .channel_mode = alc268_modes, |
| 12446 | .input_mux = &alc268_capture_source, |
| 12447 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12448 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12449 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12450 | #ifdef CONFIG_SND_DEBUG |
| 12451 | [ALC268_TEST] = { |
| 12452 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12453 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12454 | alc268_volume_init_verbs }, |
| 12455 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12456 | .dac_nids = alc268_dac_nids, |
| 12457 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12458 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12459 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12460 | .hp_nid = 0x03, |
| 12461 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12462 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12463 | .channel_mode = alc268_modes, |
| 12464 | .input_mux = &alc268_capture_source, |
| 12465 | }, |
| 12466 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12467 | }; |
| 12468 | |
| 12469 | static int patch_alc268(struct hda_codec *codec) |
| 12470 | { |
| 12471 | struct alc_spec *spec; |
| 12472 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12473 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12474 | |
| 12475 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12476 | if (spec == NULL) |
| 12477 | return -ENOMEM; |
| 12478 | |
| 12479 | codec->spec = spec; |
| 12480 | |
| 12481 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12482 | alc268_models, |
| 12483 | alc268_cfg_tbl); |
| 12484 | |
| 12485 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12486 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12487 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12488 | board_config = ALC268_AUTO; |
| 12489 | } |
| 12490 | |
| 12491 | if (board_config == ALC268_AUTO) { |
| 12492 | /* automatic parse from the BIOS config */ |
| 12493 | err = alc268_parse_auto_config(codec); |
| 12494 | if (err < 0) { |
| 12495 | alc_free(codec); |
| 12496 | return err; |
| 12497 | } else if (!err) { |
| 12498 | printk(KERN_INFO |
| 12499 | "hda_codec: Cannot set up configuration " |
| 12500 | "from BIOS. Using base mode...\n"); |
| 12501 | board_config = ALC268_3ST; |
| 12502 | } |
| 12503 | } |
| 12504 | |
| 12505 | if (board_config != ALC268_AUTO) |
| 12506 | setup_preset(spec, &alc268_presets[board_config]); |
| 12507 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12508 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12509 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12510 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12511 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12512 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12513 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12514 | has_beep = 0; |
| 12515 | for (i = 0; i < spec->num_mixers; i++) { |
| 12516 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12517 | has_beep = 1; |
| 12518 | break; |
| 12519 | } |
| 12520 | } |
| 12521 | |
| 12522 | if (has_beep) { |
| 12523 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12524 | if (err < 0) { |
| 12525 | alc_free(codec); |
| 12526 | return err; |
| 12527 | } |
| 12528 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12529 | /* override the amp caps for beep generator */ |
| 12530 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12531 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12532 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12533 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12534 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12535 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12536 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12537 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12538 | /* check whether NID 0x07 is valid */ |
| 12539 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12540 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12541 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12542 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12543 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12544 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12545 | spec->adc_nids = alc268_adc_nids_alt; |
| 12546 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12547 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12548 | } else { |
| 12549 | spec->adc_nids = alc268_adc_nids; |
| 12550 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12551 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12552 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12553 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12554 | /* set default input source */ |
| 12555 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12556 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12557 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12558 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12559 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12560 | |
| 12561 | spec->vmaster_nid = 0x02; |
| 12562 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12563 | codec->patch_ops = alc_patch_ops; |
| 12564 | if (board_config == ALC268_AUTO) |
| 12565 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12566 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12567 | codec->proc_widget_hook = print_realtek_coef; |
| 12568 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12569 | return 0; |
| 12570 | } |
| 12571 | |
| 12572 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12573 | * ALC269 channel source setting (2 channel) |
| 12574 | */ |
| 12575 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12576 | |
| 12577 | #define alc269_dac_nids alc260_dac_nids |
| 12578 | |
| 12579 | static hda_nid_t alc269_adc_nids[1] = { |
| 12580 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12581 | 0x08, |
| 12582 | }; |
| 12583 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12584 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12585 | 0x23, |
| 12586 | }; |
| 12587 | |
| 12588 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12589 | * not a mux! |
| 12590 | */ |
| 12591 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12592 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12593 | .num_items = 2, |
| 12594 | .items = { |
| 12595 | { "i-Mic", 0x5 }, |
| 12596 | { "e-Mic", 0x0 }, |
| 12597 | }, |
| 12598 | }; |
| 12599 | |
| 12600 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12601 | .num_items = 2, |
| 12602 | .items = { |
| 12603 | { "i-Mic", 0x1 }, |
| 12604 | { "e-Mic", 0x0 }, |
| 12605 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12606 | }; |
| 12607 | |
| 12608 | #define alc269_modes alc260_modes |
| 12609 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12610 | |
| 12611 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12612 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12613 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12614 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12615 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12618 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12621 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12622 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12623 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12624 | { } /* end */ |
| 12625 | }; |
| 12626 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12627 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12628 | /* output mixer control */ |
| 12629 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12630 | { |
| 12631 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12632 | .name = "Master Playback Switch", |
| 12633 | .info = snd_hda_mixer_amp_switch_info, |
| 12634 | .get = snd_hda_mixer_amp_switch_get, |
| 12635 | .put = alc268_acer_master_sw_put, |
| 12636 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12637 | }, |
| 12638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12640 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12641 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12642 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12643 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12644 | { } |
| 12645 | }; |
| 12646 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12647 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12648 | /* output mixer control */ |
| 12649 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12650 | { |
| 12651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12652 | .name = "Master Playback Switch", |
| 12653 | .info = snd_hda_mixer_amp_switch_info, |
| 12654 | .get = snd_hda_mixer_amp_switch_get, |
| 12655 | .put = alc268_acer_master_sw_put, |
| 12656 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12657 | }, |
| 12658 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12659 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12660 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12661 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12662 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12663 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12664 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12665 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12666 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12667 | { } |
| 12668 | }; |
| 12669 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12670 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12671 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12672 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12673 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12674 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12675 | { } /* end */ |
| 12676 | }; |
| 12677 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12678 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12679 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12680 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12681 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12682 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12683 | { } /* end */ |
| 12684 | }; |
| 12685 | |
| 12686 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12687 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12688 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12689 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12690 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12691 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12692 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12693 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12694 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12695 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12696 | { } |
| 12697 | }; |
| 12698 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12699 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12700 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12701 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12702 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12703 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12704 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12705 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12706 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12707 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12708 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12709 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12710 | { } |
| 12711 | }; |
| 12712 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12713 | /* toggle speaker-output according to the hp-jack state */ |
| 12714 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12715 | { |
| 12716 | unsigned int present; |
| 12717 | unsigned char bits; |
| 12718 | |
| 12719 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12720 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12721 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12722 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12723 | AMP_IN_MUTE(0), bits); |
| 12724 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12725 | AMP_IN_MUTE(0), bits); |
| 12726 | |
| 12727 | snd_hda_codec_write(codec, 0x20, 0, |
| 12728 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12729 | snd_hda_codec_write(codec, 0x20, 0, |
| 12730 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12731 | |
| 12732 | snd_hda_codec_write(codec, 0x20, 0, |
| 12733 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12734 | snd_hda_codec_write(codec, 0x20, 0, |
| 12735 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12736 | } |
| 12737 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12738 | /* toggle speaker-output according to the hp-jacks state */ |
| 12739 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12740 | { |
| 12741 | unsigned int present; |
| 12742 | unsigned char bits; |
| 12743 | |
| 12744 | /* Check laptop headphone socket */ |
| 12745 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12746 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12747 | |
| 12748 | /* Check port replicator headphone socket */ |
| 12749 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12750 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12751 | |
| 12752 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12753 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12754 | AMP_IN_MUTE(0), bits); |
| 12755 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12756 | AMP_IN_MUTE(0), bits); |
| 12757 | |
| 12758 | snd_hda_codec_write(codec, 0x20, 0, |
| 12759 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12760 | snd_hda_codec_write(codec, 0x20, 0, |
| 12761 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12762 | |
| 12763 | snd_hda_codec_write(codec, 0x20, 0, |
| 12764 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12765 | snd_hda_codec_write(codec, 0x20, 0, |
| 12766 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12767 | } |
| 12768 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12769 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12770 | { |
| 12771 | unsigned int present; |
| 12772 | |
| 12773 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12774 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12775 | snd_hda_codec_write(codec, 0x23, 0, |
| 12776 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12777 | } |
| 12778 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12779 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12780 | { |
| 12781 | unsigned int present_laptop; |
| 12782 | unsigned int present_dock; |
| 12783 | |
| 12784 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12785 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12786 | |
| 12787 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12788 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12789 | |
| 12790 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12791 | if (present_dock) |
| 12792 | snd_hda_codec_write(codec, 0x23, 0, |
| 12793 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12794 | if (present_laptop) |
| 12795 | snd_hda_codec_write(codec, 0x23, 0, |
| 12796 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12797 | if (!present_dock && !present_laptop) |
| 12798 | snd_hda_codec_write(codec, 0x23, 0, |
| 12799 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12800 | } |
| 12801 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12802 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12803 | unsigned int res) |
| 12804 | { |
| 12805 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12806 | alc269_quanta_fl1_speaker_automute(codec); |
| 12807 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12808 | alc269_quanta_fl1_mic_automute(codec); |
| 12809 | } |
| 12810 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12811 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12812 | unsigned int res) |
| 12813 | { |
| 12814 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12815 | alc269_lifebook_speaker_automute(codec); |
| 12816 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12817 | alc269_lifebook_mic_autoswitch(codec); |
| 12818 | } |
| 12819 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12820 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12821 | { |
| 12822 | alc269_quanta_fl1_speaker_automute(codec); |
| 12823 | alc269_quanta_fl1_mic_automute(codec); |
| 12824 | } |
| 12825 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12826 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12827 | { |
| 12828 | alc269_lifebook_speaker_automute(codec); |
| 12829 | alc269_lifebook_mic_autoswitch(codec); |
| 12830 | } |
| 12831 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12832 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12833 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12834 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12835 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12836 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12837 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12838 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12839 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12840 | {} |
| 12841 | }; |
| 12842 | |
| 12843 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12844 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12845 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12846 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12847 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12848 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12849 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12850 | {} |
| 12851 | }; |
| 12852 | |
| 12853 | /* toggle speaker-output according to the hp-jack state */ |
| 12854 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12855 | { |
| 12856 | unsigned int present; |
| 12857 | unsigned char bits; |
| 12858 | |
| 12859 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12860 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12861 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12862 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12863 | AMP_IN_MUTE(0), bits); |
| 12864 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12865 | AMP_IN_MUTE(0), bits); |
| 12866 | } |
| 12867 | |
| 12868 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12869 | { |
| 12870 | unsigned int present; |
| 12871 | |
| 12872 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12873 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12874 | snd_hda_codec_write(codec, 0x23, 0, |
| 12875 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12876 | } |
| 12877 | |
| 12878 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12879 | { |
| 12880 | unsigned int present; |
| 12881 | |
| 12882 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12883 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12884 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12885 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12886 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12887 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12888 | } |
| 12889 | |
| 12890 | /* unsolicited event for HP jack sensing */ |
| 12891 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12892 | unsigned int res) |
| 12893 | { |
| 12894 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12895 | alc269_speaker_automute(codec); |
| 12896 | |
| 12897 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12898 | alc269_eeepc_dmic_automute(codec); |
| 12899 | } |
| 12900 | |
| 12901 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12902 | { |
| 12903 | alc269_speaker_automute(codec); |
| 12904 | alc269_eeepc_dmic_automute(codec); |
| 12905 | } |
| 12906 | |
| 12907 | /* unsolicited event for HP jack sensing */ |
| 12908 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12909 | unsigned int res) |
| 12910 | { |
| 12911 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12912 | alc269_speaker_automute(codec); |
| 12913 | |
| 12914 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12915 | alc269_eeepc_amic_automute(codec); |
| 12916 | } |
| 12917 | |
| 12918 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12919 | { |
| 12920 | alc269_speaker_automute(codec); |
| 12921 | alc269_eeepc_amic_automute(codec); |
| 12922 | } |
| 12923 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12924 | /* |
| 12925 | * generic initialization of ADC, input mixers and output mixers |
| 12926 | */ |
| 12927 | static struct hda_verb alc269_init_verbs[] = { |
| 12928 | /* |
| 12929 | * Unmute ADC0 and set the default input to mic-in |
| 12930 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12931 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12932 | |
| 12933 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12934 | * analog-loopback mixer widget |
| 12935 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12936 | * front panel mic (mic 2) |
| 12937 | */ |
| 12938 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12939 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12940 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12941 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12942 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12943 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12944 | |
| 12945 | /* |
| 12946 | * Set up output mixers (0x0c - 0x0e) |
| 12947 | */ |
| 12948 | /* set vol=0 to output mixers */ |
| 12949 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12950 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12951 | |
| 12952 | /* set up input amps for analog loopback */ |
| 12953 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12955 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12956 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12957 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12958 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12959 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12960 | |
| 12961 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12962 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12963 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12964 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12965 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12966 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12967 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12968 | |
| 12969 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12970 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12971 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12972 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12974 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12975 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12976 | |
| 12977 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12978 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12979 | |
| 12980 | /* FIXME: use matrix-type input source selection */ |
| 12981 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12982 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12983 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12986 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12987 | |
| 12988 | /* set EAPD */ |
| 12989 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12990 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12991 | { } |
| 12992 | }; |
| 12993 | |
| 12994 | /* add playback controls from the parsed DAC table */ |
| 12995 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12996 | const struct auto_pin_cfg *cfg) |
| 12997 | { |
| 12998 | hda_nid_t nid; |
| 12999 | int err; |
| 13000 | |
| 13001 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 13002 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13003 | spec->multiout.dac_nids[0] = 2; |
| 13004 | |
| 13005 | nid = cfg->line_out_pins[0]; |
| 13006 | if (nid) { |
| 13007 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13008 | "Front Playback Volume", |
| 13009 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13010 | if (err < 0) |
| 13011 | return err; |
| 13012 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13013 | "Front Playback Switch", |
| 13014 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13015 | if (err < 0) |
| 13016 | return err; |
| 13017 | } |
| 13018 | |
| 13019 | nid = cfg->speaker_pins[0]; |
| 13020 | if (nid) { |
| 13021 | if (!cfg->line_out_pins[0]) { |
| 13022 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13023 | "Speaker Playback Volume", |
| 13024 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13025 | HDA_OUTPUT)); |
| 13026 | if (err < 0) |
| 13027 | return err; |
| 13028 | } |
| 13029 | if (nid == 0x16) { |
| 13030 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13031 | "Speaker Playback Switch", |
| 13032 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13033 | HDA_OUTPUT)); |
| 13034 | if (err < 0) |
| 13035 | return err; |
| 13036 | } else { |
| 13037 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13038 | "Speaker Playback Switch", |
| 13039 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13040 | HDA_OUTPUT)); |
| 13041 | if (err < 0) |
| 13042 | return err; |
| 13043 | } |
| 13044 | } |
| 13045 | nid = cfg->hp_pins[0]; |
| 13046 | if (nid) { |
| 13047 | /* spec->multiout.hp_nid = 2; */ |
| 13048 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13049 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13050 | "Headphone Playback Volume", |
| 13051 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13052 | HDA_OUTPUT)); |
| 13053 | if (err < 0) |
| 13054 | return err; |
| 13055 | } |
| 13056 | if (nid == 0x16) { |
| 13057 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13058 | "Headphone Playback Switch", |
| 13059 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13060 | HDA_OUTPUT)); |
| 13061 | if (err < 0) |
| 13062 | return err; |
| 13063 | } else { |
| 13064 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13065 | "Headphone Playback Switch", |
| 13066 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13067 | HDA_OUTPUT)); |
| 13068 | if (err < 0) |
| 13069 | return err; |
| 13070 | } |
| 13071 | } |
| 13072 | return 0; |
| 13073 | } |
| 13074 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13075 | #define alc269_auto_create_analog_input_ctls \ |
| 13076 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13077 | |
| 13078 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13079 | #define alc269_loopbacks alc880_loopbacks |
| 13080 | #endif |
| 13081 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13082 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13083 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13084 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13085 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13086 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13087 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13088 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13089 | .substreams = 1, |
| 13090 | .channels_min = 2, |
| 13091 | .channels_max = 8, |
| 13092 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13093 | /* NID is set in alc_build_pcms */ |
| 13094 | .ops = { |
| 13095 | .open = alc880_playback_pcm_open, |
| 13096 | .prepare = alc880_playback_pcm_prepare, |
| 13097 | .cleanup = alc880_playback_pcm_cleanup |
| 13098 | }, |
| 13099 | }; |
| 13100 | |
| 13101 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13102 | .substreams = 1, |
| 13103 | .channels_min = 2, |
| 13104 | .channels_max = 2, |
| 13105 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13106 | /* NID is set in alc_build_pcms */ |
| 13107 | }; |
| 13108 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13109 | /* |
| 13110 | * BIOS auto configuration |
| 13111 | */ |
| 13112 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13113 | { |
| 13114 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13115 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13116 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13117 | |
| 13118 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13119 | alc269_ignore); |
| 13120 | if (err < 0) |
| 13121 | return err; |
| 13122 | |
| 13123 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13124 | if (err < 0) |
| 13125 | return err; |
| 13126 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13127 | if (err < 0) |
| 13128 | return err; |
| 13129 | |
| 13130 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13131 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13132 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13133 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13134 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13135 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13136 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13137 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13138 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13139 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13140 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13141 | /* set default input source */ |
| 13142 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13143 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13144 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13145 | |
| 13146 | err = alc_auto_add_mic_boost(codec); |
| 13147 | if (err < 0) |
| 13148 | return err; |
| 13149 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13150 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13151 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13152 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13153 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13154 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13155 | return 1; |
| 13156 | } |
| 13157 | |
| 13158 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13159 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13160 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13161 | |
| 13162 | |
| 13163 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13164 | static void alc269_auto_init(struct hda_codec *codec) |
| 13165 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13166 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13167 | alc269_auto_init_multi_out(codec); |
| 13168 | alc269_auto_init_hp_out(codec); |
| 13169 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13170 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13171 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13172 | } |
| 13173 | |
| 13174 | /* |
| 13175 | * configuration and preset |
| 13176 | */ |
| 13177 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13178 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13179 | [ALC269_QUANTA_FL1] = "quanta", |
| 13180 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13181 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13182 | [ALC269_FUJITSU] = "fujitsu", |
| 13183 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13184 | }; |
| 13185 | |
| 13186 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13187 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13188 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13189 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13190 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13191 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13192 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13193 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13194 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13195 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13196 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13197 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13198 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13199 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13200 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13201 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13202 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13203 | {} |
| 13204 | }; |
| 13205 | |
| 13206 | static struct alc_config_preset alc269_presets[] = { |
| 13207 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13208 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13209 | .init_verbs = { alc269_init_verbs }, |
| 13210 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13211 | .dac_nids = alc269_dac_nids, |
| 13212 | .hp_nid = 0x03, |
| 13213 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13214 | .channel_mode = alc269_modes, |
| 13215 | .input_mux = &alc269_capture_source, |
| 13216 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13217 | [ALC269_QUANTA_FL1] = { |
| 13218 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13219 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13220 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13221 | .dac_nids = alc269_dac_nids, |
| 13222 | .hp_nid = 0x03, |
| 13223 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13224 | .channel_mode = alc269_modes, |
| 13225 | .input_mux = &alc269_capture_source, |
| 13226 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13227 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13228 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13229 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13230 | .mixers = { alc269_eeepc_mixer }, |
| 13231 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13232 | .init_verbs = { alc269_init_verbs, |
| 13233 | alc269_eeepc_amic_init_verbs }, |
| 13234 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13235 | .dac_nids = alc269_dac_nids, |
| 13236 | .hp_nid = 0x03, |
| 13237 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13238 | .channel_mode = alc269_modes, |
| 13239 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13240 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13241 | .init_hook = alc269_eeepc_amic_inithook, |
| 13242 | }, |
| 13243 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13244 | .mixers = { alc269_eeepc_mixer }, |
| 13245 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13246 | .init_verbs = { alc269_init_verbs, |
| 13247 | alc269_eeepc_dmic_init_verbs }, |
| 13248 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13249 | .dac_nids = alc269_dac_nids, |
| 13250 | .hp_nid = 0x03, |
| 13251 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13252 | .channel_mode = alc269_modes, |
| 13253 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13254 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13255 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13256 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13257 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13258 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13259 | .cap_mixer = alc269_epc_capture_mixer, |
| 13260 | .init_verbs = { alc269_init_verbs, |
| 13261 | alc269_eeepc_dmic_init_verbs }, |
| 13262 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13263 | .dac_nids = alc269_dac_nids, |
| 13264 | .hp_nid = 0x03, |
| 13265 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13266 | .channel_mode = alc269_modes, |
| 13267 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13268 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13269 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13270 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13271 | [ALC269_LIFEBOOK] = { |
| 13272 | .mixers = { alc269_lifebook_mixer }, |
| 13273 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13274 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13275 | .dac_nids = alc269_dac_nids, |
| 13276 | .hp_nid = 0x03, |
| 13277 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13278 | .channel_mode = alc269_modes, |
| 13279 | .input_mux = &alc269_capture_source, |
| 13280 | .unsol_event = alc269_lifebook_unsol_event, |
| 13281 | .init_hook = alc269_lifebook_init_hook, |
| 13282 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13283 | }; |
| 13284 | |
| 13285 | static int patch_alc269(struct hda_codec *codec) |
| 13286 | { |
| 13287 | struct alc_spec *spec; |
| 13288 | int board_config; |
| 13289 | int err; |
| 13290 | |
| 13291 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13292 | if (spec == NULL) |
| 13293 | return -ENOMEM; |
| 13294 | |
| 13295 | codec->spec = spec; |
| 13296 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13297 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13298 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13299 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13300 | alc269_models, |
| 13301 | alc269_cfg_tbl); |
| 13302 | |
| 13303 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13304 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13305 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13306 | board_config = ALC269_AUTO; |
| 13307 | } |
| 13308 | |
| 13309 | if (board_config == ALC269_AUTO) { |
| 13310 | /* automatic parse from the BIOS config */ |
| 13311 | err = alc269_parse_auto_config(codec); |
| 13312 | if (err < 0) { |
| 13313 | alc_free(codec); |
| 13314 | return err; |
| 13315 | } else if (!err) { |
| 13316 | printk(KERN_INFO |
| 13317 | "hda_codec: Cannot set up configuration " |
| 13318 | "from BIOS. Using base mode...\n"); |
| 13319 | board_config = ALC269_BASIC; |
| 13320 | } |
| 13321 | } |
| 13322 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13323 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13324 | if (err < 0) { |
| 13325 | alc_free(codec); |
| 13326 | return err; |
| 13327 | } |
| 13328 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13329 | if (board_config != ALC269_AUTO) |
| 13330 | setup_preset(spec, &alc269_presets[board_config]); |
| 13331 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13332 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13333 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13334 | * fix the sample rate of analog I/O to 44.1kHz |
| 13335 | */ |
| 13336 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13337 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13338 | } else { |
| 13339 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13340 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13341 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13342 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13343 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13344 | |
| 13345 | spec->adc_nids = alc269_adc_nids; |
| 13346 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13347 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13348 | if (!spec->cap_mixer) |
| 13349 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13350 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13351 | |
| 13352 | codec->patch_ops = alc_patch_ops; |
| 13353 | if (board_config == ALC269_AUTO) |
| 13354 | spec->init_hook = alc269_auto_init; |
| 13355 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13356 | if (!spec->loopback.amplist) |
| 13357 | spec->loopback.amplist = alc269_loopbacks; |
| 13358 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13359 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13360 | |
| 13361 | return 0; |
| 13362 | } |
| 13363 | |
| 13364 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13365 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13366 | */ |
| 13367 | |
| 13368 | /* |
| 13369 | * set the path ways for 2 channel output |
| 13370 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13371 | */ |
| 13372 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13373 | /* set pin widget 1Ah (line in) for input */ |
| 13374 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13375 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13376 | * the vref |
| 13377 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13378 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13379 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13380 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13381 | #if 0 |
| 13382 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13383 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13384 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13385 | { } /* end */ |
| 13386 | }; |
| 13387 | /* |
| 13388 | * 6ch mode |
| 13389 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13390 | */ |
| 13391 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13392 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13393 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13394 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13395 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13396 | |
| 13397 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13398 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13399 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13400 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13401 | #if 0 |
| 13402 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13403 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13404 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13405 | { } /* end */ |
| 13406 | }; |
| 13407 | |
| 13408 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13409 | { 2, alc861_threestack_ch2_init }, |
| 13410 | { 6, alc861_threestack_ch6_init }, |
| 13411 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13412 | /* Set mic1 as input and unmute the mixer */ |
| 13413 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13414 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13415 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13416 | { } /* end */ |
| 13417 | }; |
| 13418 | /* Set mic1 as output and mute mixer */ |
| 13419 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13420 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13421 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13422 | { } /* end */ |
| 13423 | }; |
| 13424 | |
| 13425 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13426 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13427 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13428 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13429 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13430 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13431 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13432 | /* set pin widget 1Ah (line in) for input */ |
| 13433 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13434 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13435 | * the vref |
| 13436 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13437 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13438 | |
| 13439 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13440 | #if 0 |
| 13441 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13442 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13443 | #endif |
| 13444 | { } /* end */ |
| 13445 | }; |
| 13446 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13447 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13448 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13449 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13450 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13451 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13452 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13453 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13454 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13455 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13456 | |
| 13457 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13458 | #if 0 |
| 13459 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13460 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13461 | #endif |
| 13462 | { } /* end */ |
| 13463 | }; |
| 13464 | |
| 13465 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13466 | { 2, alc861_asus_ch2_init }, |
| 13467 | { 6, alc861_asus_ch6_init }, |
| 13468 | }; |
| 13469 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13470 | /* patch-ALC861 */ |
| 13471 | |
| 13472 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13473 | /* output mixer control */ |
| 13474 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13475 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13476 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13477 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13478 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13479 | |
| 13480 | /*Input mixer control */ |
| 13481 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13482 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13483 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13484 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13485 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13486 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13487 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13488 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13489 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13490 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13491 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13492 | { } /* end */ |
| 13493 | }; |
| 13494 | |
| 13495 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13496 | /* output mixer control */ |
| 13497 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13498 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13499 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13500 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13501 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13502 | |
| 13503 | /* Input mixer control */ |
| 13504 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13505 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13506 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13507 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13508 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13509 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13510 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13511 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13512 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13513 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13515 | { |
| 13516 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13517 | .name = "Channel Mode", |
| 13518 | .info = alc_ch_mode_info, |
| 13519 | .get = alc_ch_mode_get, |
| 13520 | .put = alc_ch_mode_put, |
| 13521 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13522 | }, |
| 13523 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13524 | }; |
| 13525 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13526 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13527 | /* output mixer control */ |
| 13528 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13531 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13532 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13533 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13534 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13535 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13536 | /* output mixer control */ |
| 13537 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13538 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13539 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13540 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13541 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13542 | |
| 13543 | /* Input mixer control */ |
| 13544 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13545 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13547 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13549 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13552 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13553 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13554 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13555 | { |
| 13556 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13557 | .name = "Channel Mode", |
| 13558 | .info = alc_ch_mode_info, |
| 13559 | .get = alc_ch_mode_get, |
| 13560 | .put = alc_ch_mode_put, |
| 13561 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13562 | }, |
| 13563 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13564 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13565 | |
| 13566 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13567 | /* output mixer control */ |
| 13568 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13569 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13570 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13571 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13572 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13573 | |
| 13574 | /* Input mixer control */ |
| 13575 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13576 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13577 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13578 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13579 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13580 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13581 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13582 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13583 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13584 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13585 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13586 | { |
| 13587 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13588 | .name = "Channel Mode", |
| 13589 | .info = alc_ch_mode_info, |
| 13590 | .get = alc_ch_mode_get, |
| 13591 | .put = alc_ch_mode_put, |
| 13592 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13593 | }, |
| 13594 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13595 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13596 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13597 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13598 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13599 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13600 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13601 | { } |
| 13602 | }; |
| 13603 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13604 | /* |
| 13605 | * generic initialization of ADC, input mixers and output mixers |
| 13606 | */ |
| 13607 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13608 | /* |
| 13609 | * Unmute ADC0 and set the default input to mic-in |
| 13610 | */ |
| 13611 | /* port-A for surround (rear panel) */ |
| 13612 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13613 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13614 | /* port-B for mic-in (rear panel) with vref */ |
| 13615 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13616 | /* port-C for line-in (rear panel) */ |
| 13617 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13618 | /* port-D for Front */ |
| 13619 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13620 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13621 | /* port-E for HP out (front panel) */ |
| 13622 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13623 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13624 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13625 | /* port-F for mic-in (front panel) with vref */ |
| 13626 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13627 | /* port-G for CLFE (rear panel) */ |
| 13628 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13629 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13630 | /* port-H for side (rear panel) */ |
| 13631 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13632 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13633 | /* CD-in */ |
| 13634 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13635 | /* route front mic to ADC1*/ |
| 13636 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13637 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13639 | /* Unmute DAC0~3 & spdif out*/ |
| 13640 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13641 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13642 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13643 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13645 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13646 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13647 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13648 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13649 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13650 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13651 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13652 | /* Unmute Stereo Mixer 15 */ |
| 13653 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13654 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13655 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13656 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13657 | |
| 13658 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13659 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13660 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13661 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13662 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13663 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13664 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13665 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13666 | /* hp used DAC 3 (Front) */ |
| 13667 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13668 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13669 | |
| 13670 | { } |
| 13671 | }; |
| 13672 | |
| 13673 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13674 | /* |
| 13675 | * Unmute ADC0 and set the default input to mic-in |
| 13676 | */ |
| 13677 | /* port-A for surround (rear panel) */ |
| 13678 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13679 | /* port-B for mic-in (rear panel) with vref */ |
| 13680 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13681 | /* port-C for line-in (rear panel) */ |
| 13682 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13683 | /* port-D for Front */ |
| 13684 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13685 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13686 | /* port-E for HP out (front panel) */ |
| 13687 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13688 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13689 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13690 | /* port-F for mic-in (front panel) with vref */ |
| 13691 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13692 | /* port-G for CLFE (rear panel) */ |
| 13693 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13694 | /* port-H for side (rear panel) */ |
| 13695 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13696 | /* CD-in */ |
| 13697 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13698 | /* route front mic to ADC1*/ |
| 13699 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13700 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13701 | /* Unmute DAC0~3 & spdif out*/ |
| 13702 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13703 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13704 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13705 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13706 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13707 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13708 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13709 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13710 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13711 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13712 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13713 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13714 | /* Unmute Stereo Mixer 15 */ |
| 13715 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13716 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13717 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13718 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13719 | |
| 13720 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13721 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13722 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13723 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13724 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13725 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13726 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13727 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13728 | /* hp used DAC 3 (Front) */ |
| 13729 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13730 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13731 | { } |
| 13732 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13733 | |
| 13734 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13735 | /* |
| 13736 | * Unmute ADC0 and set the default input to mic-in |
| 13737 | */ |
| 13738 | /* port-A for surround (rear panel) */ |
| 13739 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13740 | /* port-B for mic-in (rear panel) with vref */ |
| 13741 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13742 | /* port-C for line-in (rear panel) */ |
| 13743 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13744 | /* port-D for Front */ |
| 13745 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13746 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13747 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13748 | /* this has to be set to VREF80 */ |
| 13749 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13750 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13751 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13752 | /* port-F for mic-in (front panel) with vref */ |
| 13753 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13754 | /* port-G for CLFE (rear panel) */ |
| 13755 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13756 | /* port-H for side (rear panel) */ |
| 13757 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13758 | /* CD-in */ |
| 13759 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13760 | /* route front mic to ADC1*/ |
| 13761 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13762 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13763 | /* Unmute DAC0~3 & spdif out*/ |
| 13764 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13765 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13766 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13767 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13768 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13769 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13770 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13771 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13772 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13773 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13774 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13775 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13776 | /* Unmute Stereo Mixer 15 */ |
| 13777 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13778 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13779 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13780 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13781 | |
| 13782 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13783 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13784 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13785 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13786 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13787 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13788 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13789 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13790 | /* hp used DAC 3 (Front) */ |
| 13791 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13792 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13793 | { } |
| 13794 | }; |
| 13795 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13796 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13797 | /* |
| 13798 | * Unmute ADC0 and set the default input to mic-in |
| 13799 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13800 | /* port-A for surround (rear panel) |
| 13801 | * according to codec#0 this is the HP jack |
| 13802 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13803 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13804 | /* route front PCM to HP */ |
| 13805 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13806 | /* port-B for mic-in (rear panel) with vref */ |
| 13807 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13808 | /* port-C for line-in (rear panel) */ |
| 13809 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13810 | /* port-D for Front */ |
| 13811 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13812 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13813 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13814 | /* this has to be set to VREF80 */ |
| 13815 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13816 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13817 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13818 | /* port-F for mic-in (front panel) with vref */ |
| 13819 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13820 | /* port-G for CLFE (rear panel) */ |
| 13821 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13822 | /* port-H for side (rear panel) */ |
| 13823 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13824 | /* CD-in */ |
| 13825 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13826 | /* route front mic to ADC1*/ |
| 13827 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13828 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13829 | /* Unmute DAC0~3 & spdif out*/ |
| 13830 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13831 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13832 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13833 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13834 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13835 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13836 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13837 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13838 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13839 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13840 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13841 | /* Unmute Stereo Mixer 15 */ |
| 13842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13845 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13846 | |
| 13847 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13848 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13849 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13850 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13851 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13852 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13853 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13854 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13855 | /* hp used DAC 3 (Front) */ |
| 13856 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13857 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13858 | { } |
| 13859 | }; |
| 13860 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13861 | /* additional init verbs for ASUS laptops */ |
| 13862 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13863 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13864 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13865 | { } |
| 13866 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13867 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13868 | /* |
| 13869 | * generic initialization of ADC, input mixers and output mixers |
| 13870 | */ |
| 13871 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13872 | /* |
| 13873 | * Unmute ADC0 and set the default input to mic-in |
| 13874 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13875 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13876 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13877 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13878 | /* Unmute DAC0~3 & spdif out*/ |
| 13879 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13880 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13881 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13882 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13883 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13884 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13885 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13886 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13887 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13888 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13889 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13890 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13891 | /* Unmute Stereo Mixer 15 */ |
| 13892 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13893 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13894 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13895 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13896 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13897 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13898 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13899 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13900 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13901 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13902 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13903 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13904 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13905 | |
| 13906 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13907 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13908 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13909 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13910 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13911 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13912 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13913 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13914 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13915 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13916 | |
| 13917 | { } |
| 13918 | }; |
| 13919 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13920 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13921 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13922 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13923 | { } |
| 13924 | }; |
| 13925 | |
| 13926 | /* toggle speaker-output according to the hp-jack state */ |
| 13927 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13928 | { |
| 13929 | unsigned int present; |
| 13930 | |
| 13931 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13932 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13933 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13934 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13935 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13936 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13937 | } |
| 13938 | |
| 13939 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13940 | unsigned int res) |
| 13941 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13942 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13943 | alc861_toshiba_automute(codec); |
| 13944 | } |
| 13945 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13946 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13947 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13948 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13949 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13950 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13951 | |
| 13952 | |
| 13953 | #define ALC861_DIGOUT_NID 0x07 |
| 13954 | |
| 13955 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13956 | { 8, NULL } |
| 13957 | }; |
| 13958 | |
| 13959 | static hda_nid_t alc861_dac_nids[4] = { |
| 13960 | /* front, surround, clfe, side */ |
| 13961 | 0x03, 0x06, 0x05, 0x04 |
| 13962 | }; |
| 13963 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13964 | static hda_nid_t alc660_dac_nids[3] = { |
| 13965 | /* front, clfe, surround */ |
| 13966 | 0x03, 0x05, 0x06 |
| 13967 | }; |
| 13968 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13969 | static hda_nid_t alc861_adc_nids[1] = { |
| 13970 | /* ADC0-2 */ |
| 13971 | 0x08, |
| 13972 | }; |
| 13973 | |
| 13974 | static struct hda_input_mux alc861_capture_source = { |
| 13975 | .num_items = 5, |
| 13976 | .items = { |
| 13977 | { "Mic", 0x0 }, |
| 13978 | { "Front Mic", 0x3 }, |
| 13979 | { "Line", 0x1 }, |
| 13980 | { "CD", 0x4 }, |
| 13981 | { "Mixer", 0x5 }, |
| 13982 | }, |
| 13983 | }; |
| 13984 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13985 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 13986 | { |
| 13987 | struct alc_spec *spec = codec->spec; |
| 13988 | hda_nid_t mix, srcs[5]; |
| 13989 | int i, j, num; |
| 13990 | |
| 13991 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 13992 | return 0; |
| 13993 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 13994 | if (num < 0) |
| 13995 | return 0; |
| 13996 | for (i = 0; i < num; i++) { |
| 13997 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13998 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13999 | if (type != AC_WID_AUD_OUT) |
| 14000 | continue; |
| 14001 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14002 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14003 | break; |
| 14004 | if (j >= spec->multiout.num_dacs) |
| 14005 | return srcs[i]; |
| 14006 | } |
| 14007 | return 0; |
| 14008 | } |
| 14009 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14010 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14011 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14012 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14013 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14014 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14015 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14016 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14017 | |
| 14018 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14019 | for (i = 0; i < cfg->line_outs; i++) { |
| 14020 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14021 | dac = alc861_look_for_dac(codec, nid); |
| 14022 | if (!dac) |
| 14023 | continue; |
| 14024 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14025 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14026 | return 0; |
| 14027 | } |
| 14028 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14029 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14030 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14031 | { |
| 14032 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14033 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14034 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14035 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14036 | } |
| 14037 | |
| 14038 | /* add playback controls from the parsed DAC table */ |
| 14039 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14040 | const struct auto_pin_cfg *cfg) |
| 14041 | { |
| 14042 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14043 | static const char *chname[4] = { |
| 14044 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14045 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14046 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14047 | int i, err; |
| 14048 | |
| 14049 | if (cfg->line_outs == 1) { |
| 14050 | const char *pfx = NULL; |
| 14051 | if (!cfg->hp_outs) |
| 14052 | pfx = "Master"; |
| 14053 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14054 | pfx = "Speaker"; |
| 14055 | if (pfx) { |
| 14056 | nid = spec->multiout.dac_nids[0]; |
| 14057 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14058 | } |
| 14059 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14060 | |
| 14061 | for (i = 0; i < cfg->line_outs; i++) { |
| 14062 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14063 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14064 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14065 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14066 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14067 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14068 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14069 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14070 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14071 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14072 | return err; |
| 14073 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14074 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14075 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14076 | return err; |
| 14077 | } |
| 14078 | } |
| 14079 | return 0; |
| 14080 | } |
| 14081 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14082 | 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] | 14083 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14084 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14085 | int err; |
| 14086 | hda_nid_t nid; |
| 14087 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14088 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14089 | return 0; |
| 14090 | |
| 14091 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14092 | nid = alc861_look_for_dac(codec, pin); |
| 14093 | if (nid) { |
| 14094 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14095 | if (err < 0) |
| 14096 | return err; |
| 14097 | spec->multiout.hp_nid = nid; |
| 14098 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14099 | } |
| 14100 | return 0; |
| 14101 | } |
| 14102 | |
| 14103 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14104 | static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14105 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14106 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14107 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14108 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14109 | int i, err, idx, idx1; |
| 14110 | |
| 14111 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14112 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14113 | case 0x0c: |
| 14114 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14115 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14116 | break; |
| 14117 | case 0x0f: |
| 14118 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14119 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14120 | break; |
| 14121 | case 0x0d: |
| 14122 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14123 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14124 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14125 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14126 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14127 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14128 | break; |
| 14129 | case 0x11: |
| 14130 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14131 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14132 | break; |
| 14133 | default: |
| 14134 | continue; |
| 14135 | } |
| 14136 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14137 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14138 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14139 | if (err < 0) |
| 14140 | return err; |
| 14141 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14142 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14143 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14144 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14145 | } |
| 14146 | return 0; |
| 14147 | } |
| 14148 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14149 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14150 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14151 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14152 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14153 | hda_nid_t mix, srcs[5]; |
| 14154 | int i, num; |
| 14155 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14156 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14157 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14158 | 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] | 14159 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14160 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14161 | return; |
| 14162 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14163 | if (num < 0) |
| 14164 | return; |
| 14165 | for (i = 0; i < num; i++) { |
| 14166 | unsigned int mute; |
| 14167 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14168 | mute = AMP_IN_UNMUTE(i); |
| 14169 | else |
| 14170 | mute = AMP_IN_MUTE(i); |
| 14171 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14172 | mute); |
| 14173 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14174 | } |
| 14175 | |
| 14176 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14177 | { |
| 14178 | struct alc_spec *spec = codec->spec; |
| 14179 | int i; |
| 14180 | |
| 14181 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14182 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14183 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14184 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14185 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14186 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14187 | } |
| 14188 | } |
| 14189 | |
| 14190 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14191 | { |
| 14192 | struct alc_spec *spec = codec->spec; |
| 14193 | hda_nid_t pin; |
| 14194 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14195 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14196 | if (pin) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14197 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14198 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14199 | pin = spec->autocfg.speaker_pins[0]; |
| 14200 | if (pin) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14201 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 14202 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14203 | } |
| 14204 | |
| 14205 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14206 | { |
| 14207 | struct alc_spec *spec = codec->spec; |
| 14208 | int i; |
| 14209 | |
| 14210 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14211 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14212 | if (nid >= 0x0c && nid <= 0x11) |
| 14213 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14214 | } |
| 14215 | } |
| 14216 | |
| 14217 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14218 | /* return 1 if successful, 0 if the proper config is not found, |
| 14219 | * or a negative error code |
| 14220 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14221 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14222 | { |
| 14223 | struct alc_spec *spec = codec->spec; |
| 14224 | int err; |
| 14225 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14226 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14227 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14228 | alc861_ignore); |
| 14229 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14230 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14231 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14232 | return 0; /* can't find valid BIOS pin config */ |
| 14233 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14234 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14235 | if (err < 0) |
| 14236 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14237 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14238 | if (err < 0) |
| 14239 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14240 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14241 | if (err < 0) |
| 14242 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14243 | err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14244 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14245 | return err; |
| 14246 | |
| 14247 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14248 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14249 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14250 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14251 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14252 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14253 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14254 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14255 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14256 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14257 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14258 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14259 | |
| 14260 | spec->adc_nids = alc861_adc_nids; |
| 14261 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14262 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14263 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14264 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14266 | return 1; |
| 14267 | } |
| 14268 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14269 | /* additional initialization for auto-configuration model */ |
| 14270 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14271 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14272 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14273 | alc861_auto_init_multi_out(codec); |
| 14274 | alc861_auto_init_hp_out(codec); |
| 14275 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14276 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14277 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14278 | } |
| 14279 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14280 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14281 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14282 | { 0x15, HDA_INPUT, 0 }, |
| 14283 | { 0x15, HDA_INPUT, 1 }, |
| 14284 | { 0x15, HDA_INPUT, 2 }, |
| 14285 | { 0x15, HDA_INPUT, 3 }, |
| 14286 | { } /* end */ |
| 14287 | }; |
| 14288 | #endif |
| 14289 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14290 | |
| 14291 | /* |
| 14292 | * configuration and preset |
| 14293 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14294 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14295 | [ALC861_3ST] = "3stack", |
| 14296 | [ALC660_3ST] = "3stack-660", |
| 14297 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14298 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14299 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14300 | [ALC861_TOSHIBA] = "toshiba", |
| 14301 | [ALC861_ASUS] = "asus", |
| 14302 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14303 | [ALC861_AUTO] = "auto", |
| 14304 | }; |
| 14305 | |
| 14306 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14307 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14308 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14309 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14310 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14311 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14312 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14313 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14314 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14315 | * Any other models that need this preset? |
| 14316 | */ |
| 14317 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14318 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14319 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14320 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14321 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14322 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14323 | /* FIXME: the below seems conflict */ |
| 14324 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14325 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14326 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14327 | {} |
| 14328 | }; |
| 14329 | |
| 14330 | static struct alc_config_preset alc861_presets[] = { |
| 14331 | [ALC861_3ST] = { |
| 14332 | .mixers = { alc861_3ST_mixer }, |
| 14333 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14334 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14335 | .dac_nids = alc861_dac_nids, |
| 14336 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14337 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14338 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14339 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14340 | .adc_nids = alc861_adc_nids, |
| 14341 | .input_mux = &alc861_capture_source, |
| 14342 | }, |
| 14343 | [ALC861_3ST_DIG] = { |
| 14344 | .mixers = { alc861_base_mixer }, |
| 14345 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14346 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14347 | .dac_nids = alc861_dac_nids, |
| 14348 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14349 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14350 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14351 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14352 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14353 | .adc_nids = alc861_adc_nids, |
| 14354 | .input_mux = &alc861_capture_source, |
| 14355 | }, |
| 14356 | [ALC861_6ST_DIG] = { |
| 14357 | .mixers = { alc861_base_mixer }, |
| 14358 | .init_verbs = { alc861_base_init_verbs }, |
| 14359 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14360 | .dac_nids = alc861_dac_nids, |
| 14361 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14362 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14363 | .channel_mode = alc861_8ch_modes, |
| 14364 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14365 | .adc_nids = alc861_adc_nids, |
| 14366 | .input_mux = &alc861_capture_source, |
| 14367 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14368 | [ALC660_3ST] = { |
| 14369 | .mixers = { alc861_3ST_mixer }, |
| 14370 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14371 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14372 | .dac_nids = alc660_dac_nids, |
| 14373 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14374 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14375 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14376 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14377 | .adc_nids = alc861_adc_nids, |
| 14378 | .input_mux = &alc861_capture_source, |
| 14379 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14380 | [ALC861_UNIWILL_M31] = { |
| 14381 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14382 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14383 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14384 | .dac_nids = alc861_dac_nids, |
| 14385 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14386 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14387 | .channel_mode = alc861_uniwill_m31_modes, |
| 14388 | .need_dac_fix = 1, |
| 14389 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14390 | .adc_nids = alc861_adc_nids, |
| 14391 | .input_mux = &alc861_capture_source, |
| 14392 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14393 | [ALC861_TOSHIBA] = { |
| 14394 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14395 | .init_verbs = { alc861_base_init_verbs, |
| 14396 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14397 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14398 | .dac_nids = alc861_dac_nids, |
| 14399 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14400 | .channel_mode = alc883_3ST_2ch_modes, |
| 14401 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14402 | .adc_nids = alc861_adc_nids, |
| 14403 | .input_mux = &alc861_capture_source, |
| 14404 | .unsol_event = alc861_toshiba_unsol_event, |
| 14405 | .init_hook = alc861_toshiba_automute, |
| 14406 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14407 | [ALC861_ASUS] = { |
| 14408 | .mixers = { alc861_asus_mixer }, |
| 14409 | .init_verbs = { alc861_asus_init_verbs }, |
| 14410 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14411 | .dac_nids = alc861_dac_nids, |
| 14412 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14413 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14414 | .channel_mode = alc861_asus_modes, |
| 14415 | .need_dac_fix = 1, |
| 14416 | .hp_nid = 0x06, |
| 14417 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14418 | .adc_nids = alc861_adc_nids, |
| 14419 | .input_mux = &alc861_capture_source, |
| 14420 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14421 | [ALC861_ASUS_LAPTOP] = { |
| 14422 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14423 | .init_verbs = { alc861_asus_init_verbs, |
| 14424 | alc861_asus_laptop_init_verbs }, |
| 14425 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14426 | .dac_nids = alc861_dac_nids, |
| 14427 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14428 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14429 | .channel_mode = alc883_3ST_2ch_modes, |
| 14430 | .need_dac_fix = 1, |
| 14431 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14432 | .adc_nids = alc861_adc_nids, |
| 14433 | .input_mux = &alc861_capture_source, |
| 14434 | }, |
| 14435 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14436 | |
| 14437 | |
| 14438 | static int patch_alc861(struct hda_codec *codec) |
| 14439 | { |
| 14440 | struct alc_spec *spec; |
| 14441 | int board_config; |
| 14442 | int err; |
| 14443 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14444 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14445 | if (spec == NULL) |
| 14446 | return -ENOMEM; |
| 14447 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14448 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14449 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14450 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14451 | alc861_models, |
| 14452 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14453 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14454 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14455 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14456 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14457 | board_config = ALC861_AUTO; |
| 14458 | } |
| 14459 | |
| 14460 | if (board_config == ALC861_AUTO) { |
| 14461 | /* automatic parse from the BIOS config */ |
| 14462 | err = alc861_parse_auto_config(codec); |
| 14463 | if (err < 0) { |
| 14464 | alc_free(codec); |
| 14465 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14466 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14467 | printk(KERN_INFO |
| 14468 | "hda_codec: Cannot set up configuration " |
| 14469 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14470 | board_config = ALC861_3ST_DIG; |
| 14471 | } |
| 14472 | } |
| 14473 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14474 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14475 | if (err < 0) { |
| 14476 | alc_free(codec); |
| 14477 | return err; |
| 14478 | } |
| 14479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14480 | if (board_config != ALC861_AUTO) |
| 14481 | setup_preset(spec, &alc861_presets[board_config]); |
| 14482 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14483 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14484 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14485 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14486 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14487 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14488 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14489 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14490 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14491 | spec->vmaster_nid = 0x03; |
| 14492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14493 | codec->patch_ops = alc_patch_ops; |
| 14494 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14495 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14496 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14497 | if (!spec->loopback.amplist) |
| 14498 | spec->loopback.amplist = alc861_loopbacks; |
| 14499 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14500 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14501 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14502 | return 0; |
| 14503 | } |
| 14504 | |
| 14505 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14506 | * ALC861-VD support |
| 14507 | * |
| 14508 | * Based on ALC882 |
| 14509 | * |
| 14510 | * In addition, an independent DAC |
| 14511 | */ |
| 14512 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14513 | |
| 14514 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14515 | /* front, surr, clfe, side surr */ |
| 14516 | 0x02, 0x03, 0x04, 0x05 |
| 14517 | }; |
| 14518 | |
| 14519 | /* dac_nids for ALC660vd are in a different order - according to |
| 14520 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14521 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14522 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14523 | * - and it is the same as in 861vd. |
| 14524 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14525 | */ |
| 14526 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14527 | /* front, rear, clfe, rear_surr */ |
| 14528 | 0x02, 0x04, 0x03 |
| 14529 | }; |
| 14530 | |
| 14531 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14532 | /* ADC0 */ |
| 14533 | 0x09, |
| 14534 | }; |
| 14535 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14536 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14537 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14538 | /* input MUX */ |
| 14539 | /* FIXME: should be a matrix-type input source selection */ |
| 14540 | static struct hda_input_mux alc861vd_capture_source = { |
| 14541 | .num_items = 4, |
| 14542 | .items = { |
| 14543 | { "Mic", 0x0 }, |
| 14544 | { "Front Mic", 0x1 }, |
| 14545 | { "Line", 0x2 }, |
| 14546 | { "CD", 0x4 }, |
| 14547 | }, |
| 14548 | }; |
| 14549 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14550 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14551 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14552 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14553 | { "Ext Mic", 0x0 }, |
| 14554 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14555 | }, |
| 14556 | }; |
| 14557 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14558 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14559 | .num_items = 2, |
| 14560 | .items = { |
| 14561 | { "Front Mic", 0x0 }, |
| 14562 | { "ATAPI Mic", 0x1 }, |
| 14563 | }, |
| 14564 | }; |
| 14565 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14566 | /* |
| 14567 | * 2ch mode |
| 14568 | */ |
| 14569 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14570 | { 2, NULL } |
| 14571 | }; |
| 14572 | |
| 14573 | /* |
| 14574 | * 6ch mode |
| 14575 | */ |
| 14576 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14577 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14578 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14579 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14580 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14581 | { } /* end */ |
| 14582 | }; |
| 14583 | |
| 14584 | /* |
| 14585 | * 8ch mode |
| 14586 | */ |
| 14587 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14588 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14589 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14590 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14591 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14592 | { } /* end */ |
| 14593 | }; |
| 14594 | |
| 14595 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14596 | { 6, alc861vd_6stack_ch6_init }, |
| 14597 | { 8, alc861vd_6stack_ch8_init }, |
| 14598 | }; |
| 14599 | |
| 14600 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14601 | { |
| 14602 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14603 | .name = "Channel Mode", |
| 14604 | .info = alc_ch_mode_info, |
| 14605 | .get = alc_ch_mode_get, |
| 14606 | .put = alc_ch_mode_put, |
| 14607 | }, |
| 14608 | { } /* end */ |
| 14609 | }; |
| 14610 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14611 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14612 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14613 | */ |
| 14614 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14615 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14616 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14617 | |
| 14618 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14619 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14620 | |
| 14621 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14622 | HDA_OUTPUT), |
| 14623 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14624 | HDA_OUTPUT), |
| 14625 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14626 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14627 | |
| 14628 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14629 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14630 | |
| 14631 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14632 | |
| 14633 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14636 | |
| 14637 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14638 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14639 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14640 | |
| 14641 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14642 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14643 | |
| 14644 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14645 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14646 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14647 | { } /* end */ |
| 14648 | }; |
| 14649 | |
| 14650 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14651 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14652 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14653 | |
| 14654 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14655 | |
| 14656 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14657 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14658 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14659 | |
| 14660 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14661 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14662 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14663 | |
| 14664 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14665 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14666 | |
| 14667 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14668 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14669 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14670 | { } /* end */ |
| 14671 | }; |
| 14672 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14673 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14675 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14676 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14677 | |
| 14678 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14679 | |
| 14680 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14683 | |
| 14684 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14685 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14686 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14687 | |
| 14688 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14689 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14690 | |
| 14691 | { } /* end */ |
| 14692 | }; |
| 14693 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14694 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14695 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14696 | */ |
| 14697 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14698 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14699 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14700 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14701 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14702 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14703 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14704 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14705 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14706 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14707 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14708 | { } /* end */ |
| 14709 | }; |
| 14710 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14711 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14712 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14713 | */ |
| 14714 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14715 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14716 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14717 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14718 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14719 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14720 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14721 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14722 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14723 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14724 | { } /* end */ |
| 14725 | }; |
| 14726 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14727 | /* |
| 14728 | * generic initialization of ADC, input mixers and output mixers |
| 14729 | */ |
| 14730 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14731 | /* |
| 14732 | * Unmute ADC0 and set the default input to mic-in |
| 14733 | */ |
| 14734 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14735 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14736 | |
| 14737 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14738 | * the analog-loopback mixer widget |
| 14739 | */ |
| 14740 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14746 | |
| 14747 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14748 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14749 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14750 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14751 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14752 | |
| 14753 | /* |
| 14754 | * Set up output mixers (0x02 - 0x05) |
| 14755 | */ |
| 14756 | /* set vol=0 to output mixers */ |
| 14757 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14758 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14759 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14760 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14761 | |
| 14762 | /* set up input amps for analog loopback */ |
| 14763 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14764 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14766 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14767 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14768 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14769 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14770 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14771 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14772 | |
| 14773 | { } |
| 14774 | }; |
| 14775 | |
| 14776 | /* |
| 14777 | * 3-stack pin configuration: |
| 14778 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14779 | */ |
| 14780 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14781 | /* |
| 14782 | * Set pin mode and muting |
| 14783 | */ |
| 14784 | /* set front pin widgets 0x14 for output */ |
| 14785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14787 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14788 | |
| 14789 | /* Mic (rear) pin: input vref at 80% */ |
| 14790 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14791 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14792 | /* Front Mic pin: input vref at 80% */ |
| 14793 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14794 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14795 | /* Line In pin: input */ |
| 14796 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14797 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14798 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14799 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14800 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14801 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14802 | /* CD pin widget for input */ |
| 14803 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14804 | |
| 14805 | { } |
| 14806 | }; |
| 14807 | |
| 14808 | /* |
| 14809 | * 6-stack pin configuration: |
| 14810 | */ |
| 14811 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14812 | /* |
| 14813 | * Set pin mode and muting |
| 14814 | */ |
| 14815 | /* set front pin widgets 0x14 for output */ |
| 14816 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14817 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14818 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14819 | |
| 14820 | /* Rear Pin: output 1 (0x0d) */ |
| 14821 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14822 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14823 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14824 | /* CLFE Pin: output 2 (0x0e) */ |
| 14825 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14826 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14827 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14828 | /* Side Pin: output 3 (0x0f) */ |
| 14829 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14830 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14831 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14832 | |
| 14833 | /* Mic (rear) pin: input vref at 80% */ |
| 14834 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14835 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14836 | /* Front Mic pin: input vref at 80% */ |
| 14837 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14838 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14839 | /* Line In pin: input */ |
| 14840 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14841 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14842 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14843 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14844 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14845 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14846 | /* CD pin widget for input */ |
| 14847 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14848 | |
| 14849 | { } |
| 14850 | }; |
| 14851 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14852 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14853 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14854 | { } |
| 14855 | }; |
| 14856 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14857 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14858 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14859 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14860 | { } |
| 14861 | }; |
| 14862 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14863 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14864 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14865 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14866 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14867 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14868 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14869 | {} |
| 14870 | }; |
| 14871 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14872 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14873 | { |
| 14874 | unsigned int present; |
| 14875 | unsigned char bits; |
| 14876 | |
| 14877 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14878 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14879 | bits = present ? HDA_AMP_MUTE : 0; |
| 14880 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14881 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14882 | } |
| 14883 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14884 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14885 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14886 | struct alc_spec *spec = codec->spec; |
| 14887 | |
| 14888 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14889 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14890 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14891 | alc861vd_lenovo_mic_automute(codec); |
| 14892 | } |
| 14893 | |
| 14894 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14895 | unsigned int res) |
| 14896 | { |
| 14897 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14898 | case ALC880_MIC_EVENT: |
| 14899 | alc861vd_lenovo_mic_automute(codec); |
| 14900 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14901 | default: |
| 14902 | alc_automute_amp_unsol_event(codec, res); |
| 14903 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14904 | } |
| 14905 | } |
| 14906 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14907 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14908 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14909 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14910 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14911 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14912 | |
| 14913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14916 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14918 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14919 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14920 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14921 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14922 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14923 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14924 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14925 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14926 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14927 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14928 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14929 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14930 | |
| 14931 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14932 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14933 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14934 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14936 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14937 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14938 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14939 | |
| 14940 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14941 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14942 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14943 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14944 | |
| 14945 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14946 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14947 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14948 | |
| 14949 | { } /* end */ |
| 14950 | }; |
| 14951 | |
| 14952 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14953 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14954 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14955 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14956 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14957 | spec->autocfg.hp_pins[0] = 0x15; |
| 14958 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14959 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14960 | } |
| 14961 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14962 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14963 | #define alc861vd_loopbacks alc880_loopbacks |
| 14964 | #endif |
| 14965 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14966 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14967 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14968 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14969 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14970 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14971 | |
| 14972 | /* |
| 14973 | * configuration and preset |
| 14974 | */ |
| 14975 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14976 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14977 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14978 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14979 | [ALC861VD_3ST] = "3stack", |
| 14980 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14981 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14982 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14983 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14984 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14985 | [ALC861VD_AUTO] = "auto", |
| 14986 | }; |
| 14987 | |
| 14988 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14989 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14990 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14991 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14992 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14993 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14994 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14995 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14996 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14997 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14998 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14999 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15000 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15001 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15002 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15003 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15004 | {} |
| 15005 | }; |
| 15006 | |
| 15007 | static struct alc_config_preset alc861vd_presets[] = { |
| 15008 | [ALC660VD_3ST] = { |
| 15009 | .mixers = { alc861vd_3st_mixer }, |
| 15010 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15011 | alc861vd_3stack_init_verbs }, |
| 15012 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15013 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15014 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15015 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15016 | .input_mux = &alc861vd_capture_source, |
| 15017 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15018 | [ALC660VD_3ST_DIG] = { |
| 15019 | .mixers = { alc861vd_3st_mixer }, |
| 15020 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15021 | alc861vd_3stack_init_verbs }, |
| 15022 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15023 | .dac_nids = alc660vd_dac_nids, |
| 15024 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15025 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15026 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15027 | .input_mux = &alc861vd_capture_source, |
| 15028 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15029 | [ALC861VD_3ST] = { |
| 15030 | .mixers = { alc861vd_3st_mixer }, |
| 15031 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15032 | alc861vd_3stack_init_verbs }, |
| 15033 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15034 | .dac_nids = alc861vd_dac_nids, |
| 15035 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15036 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15037 | .input_mux = &alc861vd_capture_source, |
| 15038 | }, |
| 15039 | [ALC861VD_3ST_DIG] = { |
| 15040 | .mixers = { alc861vd_3st_mixer }, |
| 15041 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15042 | alc861vd_3stack_init_verbs }, |
| 15043 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15044 | .dac_nids = alc861vd_dac_nids, |
| 15045 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15046 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15047 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15048 | .input_mux = &alc861vd_capture_source, |
| 15049 | }, |
| 15050 | [ALC861VD_6ST_DIG] = { |
| 15051 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15052 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15053 | alc861vd_6stack_init_verbs }, |
| 15054 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15055 | .dac_nids = alc861vd_dac_nids, |
| 15056 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15057 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15058 | .channel_mode = alc861vd_6stack_modes, |
| 15059 | .input_mux = &alc861vd_capture_source, |
| 15060 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15061 | [ALC861VD_LENOVO] = { |
| 15062 | .mixers = { alc861vd_lenovo_mixer }, |
| 15063 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15064 | alc861vd_3stack_init_verbs, |
| 15065 | alc861vd_eapd_verbs, |
| 15066 | alc861vd_lenovo_unsol_verbs }, |
| 15067 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15068 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15069 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15070 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15071 | .input_mux = &alc861vd_capture_source, |
| 15072 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15073 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15074 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15075 | [ALC861VD_DALLAS] = { |
| 15076 | .mixers = { alc861vd_dallas_mixer }, |
| 15077 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15078 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15079 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15080 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15081 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15082 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15083 | .unsol_event = alc_automute_amp_unsol_event, |
| 15084 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15085 | }, |
| 15086 | [ALC861VD_HP] = { |
| 15087 | .mixers = { alc861vd_hp_mixer }, |
| 15088 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15089 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15090 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15091 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15092 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15093 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15094 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15095 | .unsol_event = alc_automute_amp_unsol_event, |
| 15096 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15097 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15098 | [ALC660VD_ASUS_V1S] = { |
| 15099 | .mixers = { alc861vd_lenovo_mixer }, |
| 15100 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15101 | alc861vd_3stack_init_verbs, |
| 15102 | alc861vd_eapd_verbs, |
| 15103 | alc861vd_lenovo_unsol_verbs }, |
| 15104 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15105 | .dac_nids = alc660vd_dac_nids, |
| 15106 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15107 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15108 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15109 | .input_mux = &alc861vd_capture_source, |
| 15110 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15111 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15112 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15113 | }; |
| 15114 | |
| 15115 | /* |
| 15116 | * BIOS auto configuration |
| 15117 | */ |
| 15118 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15119 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15120 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15121 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15122 | } |
| 15123 | |
| 15124 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15125 | { |
| 15126 | struct alc_spec *spec = codec->spec; |
| 15127 | int i; |
| 15128 | |
| 15129 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15130 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15131 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15132 | if (nid) |
| 15133 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15134 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15135 | } |
| 15136 | } |
| 15137 | |
| 15138 | |
| 15139 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15140 | { |
| 15141 | struct alc_spec *spec = codec->spec; |
| 15142 | hda_nid_t pin; |
| 15143 | |
| 15144 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15145 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15146 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15147 | pin = spec->autocfg.speaker_pins[0]; |
| 15148 | if (pin) |
| 15149 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15150 | } |
| 15151 | |
| 15152 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15153 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15154 | |
| 15155 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15156 | { |
| 15157 | struct alc_spec *spec = codec->spec; |
| 15158 | int i; |
| 15159 | |
| 15160 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15161 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15162 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15163 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15164 | if (nid != ALC861VD_PIN_CD_NID && |
| 15165 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15166 | snd_hda_codec_write(codec, nid, 0, |
| 15167 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15168 | AMP_OUT_MUTE); |
| 15169 | } |
| 15170 | } |
| 15171 | } |
| 15172 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15173 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15174 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15175 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15176 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15177 | |
| 15178 | /* add playback controls from the parsed DAC table */ |
| 15179 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15180 | * different NIDs for mute/unmute switch and volume control */ |
| 15181 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15182 | const struct auto_pin_cfg *cfg) |
| 15183 | { |
| 15184 | char name[32]; |
| 15185 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15186 | hda_nid_t nid_v, nid_s; |
| 15187 | int i, err; |
| 15188 | |
| 15189 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15190 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15191 | continue; |
| 15192 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15193 | alc880_dac_to_idx( |
| 15194 | spec->multiout.dac_nids[i])); |
| 15195 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15196 | alc880_dac_to_idx( |
| 15197 | spec->multiout.dac_nids[i])); |
| 15198 | |
| 15199 | if (i == 2) { |
| 15200 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15201 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15202 | "Center Playback Volume", |
| 15203 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15204 | HDA_OUTPUT)); |
| 15205 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15206 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15207 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15208 | "LFE Playback Volume", |
| 15209 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15210 | HDA_OUTPUT)); |
| 15211 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15212 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15213 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15214 | "Center Playback Switch", |
| 15215 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15216 | HDA_INPUT)); |
| 15217 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15218 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15219 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15220 | "LFE Playback Switch", |
| 15221 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15222 | HDA_INPUT)); |
| 15223 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15224 | return err; |
| 15225 | } else { |
| 15226 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15227 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15228 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15229 | HDA_OUTPUT)); |
| 15230 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15231 | return err; |
| 15232 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15233 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15234 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15235 | HDA_INPUT)); |
| 15236 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15237 | return err; |
| 15238 | } |
| 15239 | } |
| 15240 | return 0; |
| 15241 | } |
| 15242 | |
| 15243 | /* add playback controls for speaker and HP outputs */ |
| 15244 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15245 | * different NIDs for mute/unmute switch and volume control */ |
| 15246 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15247 | hda_nid_t pin, const char *pfx) |
| 15248 | { |
| 15249 | hda_nid_t nid_v, nid_s; |
| 15250 | int err; |
| 15251 | char name[32]; |
| 15252 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15253 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15254 | return 0; |
| 15255 | |
| 15256 | if (alc880_is_fixed_pin(pin)) { |
| 15257 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15258 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15259 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15260 | spec->multiout.hp_nid = nid_v; |
| 15261 | else |
| 15262 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15263 | /* control HP volume/switch on the output mixer amp */ |
| 15264 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15265 | alc880_fixed_pin_idx(pin)); |
| 15266 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15267 | alc880_fixed_pin_idx(pin)); |
| 15268 | |
| 15269 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15270 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15271 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15272 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15273 | return err; |
| 15274 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15275 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15276 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15277 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15278 | return err; |
| 15279 | } else if (alc880_is_multi_pin(pin)) { |
| 15280 | /* set manual connection */ |
| 15281 | /* we have only a switch on HP-out PIN */ |
| 15282 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15283 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15284 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15285 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15286 | return err; |
| 15287 | } |
| 15288 | return 0; |
| 15289 | } |
| 15290 | |
| 15291 | /* parse the BIOS configuration and set up the alc_spec |
| 15292 | * return 1 if successful, 0 if the proper config is not found, |
| 15293 | * or a negative error code |
| 15294 | * Based on ALC880 version - had to change it to override |
| 15295 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15296 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15297 | { |
| 15298 | struct alc_spec *spec = codec->spec; |
| 15299 | int err; |
| 15300 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15301 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15302 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15303 | alc861vd_ignore); |
| 15304 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15305 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15306 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15307 | return 0; /* can't find valid BIOS pin config */ |
| 15308 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15309 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15310 | if (err < 0) |
| 15311 | return err; |
| 15312 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15313 | if (err < 0) |
| 15314 | return err; |
| 15315 | err = alc861vd_auto_create_extra_out(spec, |
| 15316 | spec->autocfg.speaker_pins[0], |
| 15317 | "Speaker"); |
| 15318 | if (err < 0) |
| 15319 | return err; |
| 15320 | err = alc861vd_auto_create_extra_out(spec, |
| 15321 | spec->autocfg.hp_pins[0], |
| 15322 | "Headphone"); |
| 15323 | if (err < 0) |
| 15324 | return err; |
| 15325 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15326 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15327 | return err; |
| 15328 | |
| 15329 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15330 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15331 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15332 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15333 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15334 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15335 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15336 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15337 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15338 | |
| 15339 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15340 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15341 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15342 | err = alc_auto_add_mic_boost(codec); |
| 15343 | if (err < 0) |
| 15344 | return err; |
| 15345 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15346 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15347 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15348 | return 1; |
| 15349 | } |
| 15350 | |
| 15351 | /* additional initialization for auto-configuration model */ |
| 15352 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15353 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15354 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15355 | alc861vd_auto_init_multi_out(codec); |
| 15356 | alc861vd_auto_init_hp_out(codec); |
| 15357 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15358 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15359 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15360 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15361 | } |
| 15362 | |
| 15363 | static int patch_alc861vd(struct hda_codec *codec) |
| 15364 | { |
| 15365 | struct alc_spec *spec; |
| 15366 | int err, board_config; |
| 15367 | |
| 15368 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15369 | if (spec == NULL) |
| 15370 | return -ENOMEM; |
| 15371 | |
| 15372 | codec->spec = spec; |
| 15373 | |
| 15374 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15375 | alc861vd_models, |
| 15376 | alc861vd_cfg_tbl); |
| 15377 | |
| 15378 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15379 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15380 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15381 | board_config = ALC861VD_AUTO; |
| 15382 | } |
| 15383 | |
| 15384 | if (board_config == ALC861VD_AUTO) { |
| 15385 | /* automatic parse from the BIOS config */ |
| 15386 | err = alc861vd_parse_auto_config(codec); |
| 15387 | if (err < 0) { |
| 15388 | alc_free(codec); |
| 15389 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15390 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15391 | printk(KERN_INFO |
| 15392 | "hda_codec: Cannot set up configuration " |
| 15393 | "from BIOS. Using base mode...\n"); |
| 15394 | board_config = ALC861VD_3ST; |
| 15395 | } |
| 15396 | } |
| 15397 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15398 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15399 | if (err < 0) { |
| 15400 | alc_free(codec); |
| 15401 | return err; |
| 15402 | } |
| 15403 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15404 | if (board_config != ALC861VD_AUTO) |
| 15405 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15406 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15407 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15408 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15409 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15410 | } |
| 15411 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15412 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15413 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15414 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15415 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15416 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15417 | |
| 15418 | spec->adc_nids = alc861vd_adc_nids; |
| 15419 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15420 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15421 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15422 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15423 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15424 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15425 | spec->vmaster_nid = 0x02; |
| 15426 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15427 | codec->patch_ops = alc_patch_ops; |
| 15428 | |
| 15429 | if (board_config == ALC861VD_AUTO) |
| 15430 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15431 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15432 | if (!spec->loopback.amplist) |
| 15433 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15434 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15435 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15436 | |
| 15437 | return 0; |
| 15438 | } |
| 15439 | |
| 15440 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15441 | * ALC662 support |
| 15442 | * |
| 15443 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15444 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15445 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15446 | * 6-channel independent captures. |
| 15447 | * |
| 15448 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15449 | * driver yet). |
| 15450 | */ |
| 15451 | #define ALC662_DIGOUT_NID 0x06 |
| 15452 | #define ALC662_DIGIN_NID 0x0a |
| 15453 | |
| 15454 | static hda_nid_t alc662_dac_nids[4] = { |
| 15455 | /* front, rear, clfe, rear_surr */ |
| 15456 | 0x02, 0x03, 0x04 |
| 15457 | }; |
| 15458 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15459 | static hda_nid_t alc272_dac_nids[2] = { |
| 15460 | 0x02, 0x03 |
| 15461 | }; |
| 15462 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15463 | static hda_nid_t alc662_adc_nids[1] = { |
| 15464 | /* ADC1-2 */ |
| 15465 | 0x09, |
| 15466 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15467 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15468 | static hda_nid_t alc272_adc_nids[1] = { |
| 15469 | /* ADC1-2 */ |
| 15470 | 0x08, |
| 15471 | }; |
| 15472 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15473 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15474 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15475 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15476 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15477 | /* input MUX */ |
| 15478 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15479 | static struct hda_input_mux alc662_capture_source = { |
| 15480 | .num_items = 4, |
| 15481 | .items = { |
| 15482 | { "Mic", 0x0 }, |
| 15483 | { "Front Mic", 0x1 }, |
| 15484 | { "Line", 0x2 }, |
| 15485 | { "CD", 0x4 }, |
| 15486 | }, |
| 15487 | }; |
| 15488 | |
| 15489 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15490 | .num_items = 2, |
| 15491 | .items = { |
| 15492 | { "Mic", 0x1 }, |
| 15493 | { "Line", 0x2 }, |
| 15494 | }, |
| 15495 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15496 | |
| 15497 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15498 | .num_items = 2, |
| 15499 | .items = { |
| 15500 | { "i-Mic", 0x1 }, |
| 15501 | { "e-Mic", 0x0 }, |
| 15502 | }, |
| 15503 | }; |
| 15504 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15505 | static struct hda_input_mux alc663_capture_source = { |
| 15506 | .num_items = 3, |
| 15507 | .items = { |
| 15508 | { "Mic", 0x0 }, |
| 15509 | { "Front Mic", 0x1 }, |
| 15510 | { "Line", 0x2 }, |
| 15511 | }, |
| 15512 | }; |
| 15513 | |
| 15514 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15515 | .num_items = 2, |
| 15516 | .items = { |
| 15517 | { "Ext-Mic", 0x0 }, |
| 15518 | { "D-Mic", 0x9 }, |
| 15519 | }, |
| 15520 | }; |
| 15521 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15522 | #if 1 /* set to 0 for testing other input sources below */ |
| 15523 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15524 | .num_items = 2, |
| 15525 | .items = { |
| 15526 | { "Autoselect Mic", 0x0 }, |
| 15527 | { "Internal Mic", 0x1 }, |
| 15528 | }, |
| 15529 | }; |
| 15530 | #else |
| 15531 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15532 | .num_items = 16, |
| 15533 | .items = { |
| 15534 | { "Autoselect Mic", 0x0 }, |
| 15535 | { "Internal Mic", 0x1 }, |
| 15536 | { "In-0x02", 0x2 }, |
| 15537 | { "In-0x03", 0x3 }, |
| 15538 | { "In-0x04", 0x4 }, |
| 15539 | { "In-0x05", 0x5 }, |
| 15540 | { "In-0x06", 0x6 }, |
| 15541 | { "In-0x07", 0x7 }, |
| 15542 | { "In-0x08", 0x8 }, |
| 15543 | { "In-0x09", 0x9 }, |
| 15544 | { "In-0x0a", 0x0a }, |
| 15545 | { "In-0x0b", 0x0b }, |
| 15546 | { "In-0x0c", 0x0c }, |
| 15547 | { "In-0x0d", 0x0d }, |
| 15548 | { "In-0x0e", 0x0e }, |
| 15549 | { "In-0x0f", 0x0f }, |
| 15550 | }, |
| 15551 | }; |
| 15552 | #endif |
| 15553 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15554 | /* |
| 15555 | * 2ch mode |
| 15556 | */ |
| 15557 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15558 | { 2, NULL } |
| 15559 | }; |
| 15560 | |
| 15561 | /* |
| 15562 | * 2ch mode |
| 15563 | */ |
| 15564 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15565 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15566 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15567 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15568 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15569 | { } /* end */ |
| 15570 | }; |
| 15571 | |
| 15572 | /* |
| 15573 | * 6ch mode |
| 15574 | */ |
| 15575 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15576 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15577 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15578 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15579 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15580 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15581 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15582 | { } /* end */ |
| 15583 | }; |
| 15584 | |
| 15585 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15586 | { 2, alc662_3ST_ch2_init }, |
| 15587 | { 6, alc662_3ST_ch6_init }, |
| 15588 | }; |
| 15589 | |
| 15590 | /* |
| 15591 | * 2ch mode |
| 15592 | */ |
| 15593 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15594 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15595 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15596 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15597 | { } /* end */ |
| 15598 | }; |
| 15599 | |
| 15600 | /* |
| 15601 | * 6ch mode |
| 15602 | */ |
| 15603 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15604 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15605 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15606 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15607 | { } /* end */ |
| 15608 | }; |
| 15609 | |
| 15610 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15611 | { 2, alc662_sixstack_ch6_init }, |
| 15612 | { 6, alc662_sixstack_ch8_init }, |
| 15613 | }; |
| 15614 | |
| 15615 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15616 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15617 | */ |
| 15618 | |
| 15619 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15620 | /* output mixer control */ |
| 15621 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15622 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15623 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15624 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15625 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15626 | 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] | 15627 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15628 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15629 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15630 | |
| 15631 | /*Input mixer control */ |
| 15632 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15633 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15634 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15635 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15637 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15638 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15639 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15640 | { } /* end */ |
| 15641 | }; |
| 15642 | |
| 15643 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15644 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15645 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15646 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15647 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15648 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15649 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15650 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15652 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15653 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15654 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15655 | { } /* end */ |
| 15656 | }; |
| 15657 | |
| 15658 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15659 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15660 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15661 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15662 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15663 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15664 | 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] | 15665 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15666 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15668 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15669 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15670 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15671 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15674 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15675 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15676 | { } /* end */ |
| 15677 | }; |
| 15678 | |
| 15679 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15680 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15681 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15682 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15683 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15684 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15685 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15686 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15689 | { } /* end */ |
| 15690 | }; |
| 15691 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15692 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15693 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15694 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15695 | |
| 15696 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15697 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15698 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15699 | |
| 15700 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15701 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15702 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15703 | { } /* end */ |
| 15704 | }; |
| 15705 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15706 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15707 | ALC262_HIPPO_MASTER_SWITCH, |
| 15708 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15709 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15710 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15711 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15712 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15713 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15714 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15715 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15716 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15717 | { } /* end */ |
| 15718 | }; |
| 15719 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15720 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15721 | .ops = &snd_hda_bind_vol, |
| 15722 | .values = { |
| 15723 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15724 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15725 | 0 |
| 15726 | }, |
| 15727 | }; |
| 15728 | |
| 15729 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15730 | .ops = &snd_hda_bind_sw, |
| 15731 | .values = { |
| 15732 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15733 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15734 | 0 |
| 15735 | }, |
| 15736 | }; |
| 15737 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15738 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15739 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15740 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15741 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15742 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15743 | { } /* end */ |
| 15744 | }; |
| 15745 | |
| 15746 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15747 | .ops = &snd_hda_bind_sw, |
| 15748 | .values = { |
| 15749 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15750 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15751 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15752 | 0 |
| 15753 | }, |
| 15754 | }; |
| 15755 | |
| 15756 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15757 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15758 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15761 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15762 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15763 | |
| 15764 | { } /* end */ |
| 15765 | }; |
| 15766 | |
| 15767 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15768 | .ops = &snd_hda_bind_sw, |
| 15769 | .values = { |
| 15770 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15771 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15772 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15773 | 0 |
| 15774 | }, |
| 15775 | }; |
| 15776 | |
| 15777 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15778 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15779 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15780 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15782 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15783 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15784 | { } /* end */ |
| 15785 | }; |
| 15786 | |
| 15787 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15788 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15789 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15790 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15792 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15793 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15794 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15795 | { } /* end */ |
| 15796 | }; |
| 15797 | |
| 15798 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15799 | .ops = &snd_hda_bind_vol, |
| 15800 | .values = { |
| 15801 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15802 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15803 | 0 |
| 15804 | }, |
| 15805 | }; |
| 15806 | |
| 15807 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15808 | .ops = &snd_hda_bind_sw, |
| 15809 | .values = { |
| 15810 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15811 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15812 | 0 |
| 15813 | }, |
| 15814 | }; |
| 15815 | |
| 15816 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15817 | HDA_BIND_VOL("Master Playback Volume", |
| 15818 | &alc663_asus_two_bind_master_vol), |
| 15819 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15820 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15821 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15823 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15824 | { } /* end */ |
| 15825 | }; |
| 15826 | |
| 15827 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15828 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15829 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15830 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15832 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15833 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15834 | { } /* end */ |
| 15835 | }; |
| 15836 | |
| 15837 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15838 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15839 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15840 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15841 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15842 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15843 | |
| 15844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15846 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15847 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15848 | { } /* end */ |
| 15849 | }; |
| 15850 | |
| 15851 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15852 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15853 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15854 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15855 | |
| 15856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15858 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15859 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15860 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15861 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15862 | { } /* end */ |
| 15863 | }; |
| 15864 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15865 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15866 | { |
| 15867 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15868 | .name = "Channel Mode", |
| 15869 | .info = alc_ch_mode_info, |
| 15870 | .get = alc_ch_mode_get, |
| 15871 | .put = alc_ch_mode_put, |
| 15872 | }, |
| 15873 | { } /* end */ |
| 15874 | }; |
| 15875 | |
| 15876 | static struct hda_verb alc662_init_verbs[] = { |
| 15877 | /* ADC: mute amp left and right */ |
| 15878 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15879 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15880 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15881 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15883 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15884 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15885 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15886 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15887 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15889 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15891 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15893 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15894 | |
| 15895 | /* Front Pin: output 0 (0x0c) */ |
| 15896 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15897 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15898 | |
| 15899 | /* Rear Pin: output 1 (0x0d) */ |
| 15900 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15902 | |
| 15903 | /* CLFE Pin: output 2 (0x0e) */ |
| 15904 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15905 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15906 | |
| 15907 | /* Mic (rear) pin: input vref at 80% */ |
| 15908 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15909 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15910 | /* Front Mic pin: input vref at 80% */ |
| 15911 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15912 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15913 | /* Line In pin: input */ |
| 15914 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15915 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15916 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15917 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15918 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15920 | /* CD pin widget for input */ |
| 15921 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15922 | |
| 15923 | /* FIXME: use matrix-type input source selection */ |
| 15924 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15925 | /* Input mixer */ |
| 15926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15927 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15928 | |
| 15929 | /* always trun on EAPD */ |
| 15930 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15931 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15932 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15933 | { } |
| 15934 | }; |
| 15935 | |
| 15936 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15937 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15938 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15939 | {} |
| 15940 | }; |
| 15941 | |
| 15942 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15943 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15944 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15945 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15946 | }; |
| 15947 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15948 | /* Set Unsolicited Event*/ |
| 15949 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15950 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15951 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15952 | {} |
| 15953 | }; |
| 15954 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15955 | /* |
| 15956 | * generic initialization of ADC, input mixers and output mixers |
| 15957 | */ |
| 15958 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15959 | /* |
| 15960 | * Unmute ADC and set the default input to mic-in |
| 15961 | */ |
| 15962 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15963 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15964 | |
| 15965 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15966 | * mixer widget |
| 15967 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15968 | * panel mic (mic 2) |
| 15969 | */ |
| 15970 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15971 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15972 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15973 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15974 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15975 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15976 | |
| 15977 | /* |
| 15978 | * Set up output mixers (0x0c - 0x0f) |
| 15979 | */ |
| 15980 | /* set vol=0 to output mixers */ |
| 15981 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15982 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15983 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15984 | |
| 15985 | /* set up input amps for analog loopback */ |
| 15986 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15987 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15988 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15989 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15990 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15991 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15992 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15993 | |
| 15994 | |
| 15995 | /* FIXME: use matrix-type input source selection */ |
| 15996 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15997 | /* Input mixer */ |
| 15998 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15999 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16000 | { } |
| 16001 | }; |
| 16002 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16003 | /* additional verbs for ALC663 */ |
| 16004 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16005 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16006 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16007 | { } |
| 16008 | }; |
| 16009 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16010 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16012 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16013 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16014 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16015 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16016 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16017 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16018 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16019 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16020 | {} |
| 16021 | }; |
| 16022 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16023 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16024 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16025 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16026 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16027 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16028 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16029 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16030 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16031 | {} |
| 16032 | }; |
| 16033 | |
| 16034 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16035 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16036 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16037 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16038 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16039 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16041 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16042 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16043 | {} |
| 16044 | }; |
| 16045 | |
| 16046 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16047 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16048 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16049 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16050 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16051 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16052 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16053 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16054 | {} |
| 16055 | }; |
| 16056 | |
| 16057 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16058 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16059 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16060 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16061 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16062 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16063 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16064 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16067 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16068 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16069 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16070 | {} |
| 16071 | }; |
| 16072 | |
| 16073 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16074 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16075 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16076 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16077 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16078 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16079 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16080 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16081 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16082 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16083 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16084 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16085 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16086 | {} |
| 16087 | }; |
| 16088 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16089 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16090 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16091 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16092 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16093 | |
| 16094 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16095 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16096 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16097 | |
| 16098 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16099 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16100 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16101 | {} |
| 16102 | }; |
| 16103 | |
| 16104 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16105 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16106 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16107 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16108 | |
| 16109 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16110 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16111 | {} |
| 16112 | }; |
| 16113 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16114 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16115 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16116 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16117 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16118 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16119 | {} |
| 16120 | }; |
| 16121 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16122 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16123 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16124 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16125 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16126 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16127 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16128 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16129 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16130 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16131 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16132 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16133 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16134 | {} |
| 16135 | }; |
| 16136 | |
| 16137 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16138 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16139 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16140 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16141 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16142 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16143 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16144 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16145 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16146 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16147 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16148 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16149 | {} |
| 16150 | }; |
| 16151 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16152 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16153 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16154 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16155 | { } /* end */ |
| 16156 | }; |
| 16157 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16158 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16159 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16160 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16161 | { } /* end */ |
| 16162 | }; |
| 16163 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16164 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16165 | { |
| 16166 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16167 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16168 | |
| 16169 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16170 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16171 | bits = present ? HDA_AMP_MUTE : 0; |
| 16172 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16173 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16174 | } |
| 16175 | |
| 16176 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16177 | { |
| 16178 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16179 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16180 | |
| 16181 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16182 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16183 | bits = present ? HDA_AMP_MUTE : 0; |
| 16184 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16185 | HDA_AMP_MUTE, bits); |
| 16186 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16187 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16188 | } |
| 16189 | |
| 16190 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16191 | unsigned int res) |
| 16192 | { |
| 16193 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16194 | alc662_lenovo_101e_all_automute(codec); |
| 16195 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16196 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16197 | } |
| 16198 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16199 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16200 | { |
| 16201 | unsigned int present; |
| 16202 | |
| 16203 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16204 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16205 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16206 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16207 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16208 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16209 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16210 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16211 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16212 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16213 | } |
| 16214 | |
| 16215 | /* unsolicited event for HP jack sensing */ |
| 16216 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16217 | unsigned int res) |
| 16218 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16219 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16220 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16221 | else |
| 16222 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16223 | } |
| 16224 | |
| 16225 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16226 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16227 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16228 | alc662_eeepc_mic_automute(codec); |
| 16229 | } |
| 16230 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16231 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 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; |
| 16237 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16238 | } |
| 16239 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16240 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16241 | { |
| 16242 | unsigned int present; |
| 16243 | unsigned char bits; |
| 16244 | |
| 16245 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16246 | AC_VERB_GET_PIN_SENSE, 0) |
| 16247 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16248 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16249 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16250 | AMP_IN_MUTE(0), bits); |
| 16251 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16252 | AMP_IN_MUTE(0), bits); |
| 16253 | } |
| 16254 | |
| 16255 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16256 | { |
| 16257 | unsigned int present; |
| 16258 | unsigned char bits; |
| 16259 | |
| 16260 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16261 | AC_VERB_GET_PIN_SENSE, 0) |
| 16262 | & AC_PINSENSE_PRESENCE; |
| 16263 | bits = present ? HDA_AMP_MUTE : 0; |
| 16264 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16265 | AMP_IN_MUTE(0), bits); |
| 16266 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16267 | AMP_IN_MUTE(0), bits); |
| 16268 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16269 | AMP_IN_MUTE(0), bits); |
| 16270 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16271 | AMP_IN_MUTE(0), bits); |
| 16272 | } |
| 16273 | |
| 16274 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16275 | { |
| 16276 | unsigned int present; |
| 16277 | unsigned char bits; |
| 16278 | |
| 16279 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16280 | AC_VERB_GET_PIN_SENSE, 0) |
| 16281 | & AC_PINSENSE_PRESENCE; |
| 16282 | bits = present ? HDA_AMP_MUTE : 0; |
| 16283 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16284 | AMP_IN_MUTE(0), bits); |
| 16285 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16286 | AMP_IN_MUTE(0), bits); |
| 16287 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16288 | AMP_IN_MUTE(0), bits); |
| 16289 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16290 | AMP_IN_MUTE(0), bits); |
| 16291 | } |
| 16292 | |
| 16293 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16294 | { |
| 16295 | unsigned int present; |
| 16296 | unsigned char bits; |
| 16297 | |
| 16298 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16299 | AC_VERB_GET_PIN_SENSE, 0) |
| 16300 | & AC_PINSENSE_PRESENCE; |
| 16301 | bits = present ? 0 : PIN_OUT; |
| 16302 | snd_hda_codec_write(codec, 0x14, 0, |
| 16303 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16304 | } |
| 16305 | |
| 16306 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16307 | { |
| 16308 | unsigned int present1, present2; |
| 16309 | |
| 16310 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16311 | AC_VERB_GET_PIN_SENSE, 0) |
| 16312 | & AC_PINSENSE_PRESENCE; |
| 16313 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16314 | AC_VERB_GET_PIN_SENSE, 0) |
| 16315 | & AC_PINSENSE_PRESENCE; |
| 16316 | |
| 16317 | if (present1 || present2) { |
| 16318 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16319 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16320 | } else { |
| 16321 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16322 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16323 | } |
| 16324 | } |
| 16325 | |
| 16326 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16327 | { |
| 16328 | unsigned int present1, present2; |
| 16329 | |
| 16330 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16331 | AC_VERB_GET_PIN_SENSE, 0) |
| 16332 | & AC_PINSENSE_PRESENCE; |
| 16333 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16334 | AC_VERB_GET_PIN_SENSE, 0) |
| 16335 | & AC_PINSENSE_PRESENCE; |
| 16336 | |
| 16337 | if (present1 || present2) { |
| 16338 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16339 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16340 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16341 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16342 | } else { |
| 16343 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16344 | AMP_IN_MUTE(0), 0); |
| 16345 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16346 | AMP_IN_MUTE(0), 0); |
| 16347 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16348 | } |
| 16349 | |
| 16350 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16351 | { |
| 16352 | unsigned int present; |
| 16353 | |
| 16354 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16355 | AC_VERB_GET_PIN_SENSE, 0) |
| 16356 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16357 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16358 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16359 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16360 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16361 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16362 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16363 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16364 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16365 | } |
| 16366 | |
| 16367 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16368 | unsigned int res) |
| 16369 | { |
| 16370 | switch (res >> 26) { |
| 16371 | case ALC880_HP_EVENT: |
| 16372 | alc663_m51va_speaker_automute(codec); |
| 16373 | break; |
| 16374 | case ALC880_MIC_EVENT: |
| 16375 | alc663_m51va_mic_automute(codec); |
| 16376 | break; |
| 16377 | } |
| 16378 | } |
| 16379 | |
| 16380 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16381 | { |
| 16382 | alc663_m51va_speaker_automute(codec); |
| 16383 | alc663_m51va_mic_automute(codec); |
| 16384 | } |
| 16385 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16386 | /* ***************** Mode1 ******************************/ |
| 16387 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16388 | unsigned int res) |
| 16389 | { |
| 16390 | switch (res >> 26) { |
| 16391 | case ALC880_HP_EVENT: |
| 16392 | alc663_m51va_speaker_automute(codec); |
| 16393 | break; |
| 16394 | case ALC880_MIC_EVENT: |
| 16395 | alc662_eeepc_mic_automute(codec); |
| 16396 | break; |
| 16397 | } |
| 16398 | } |
| 16399 | |
| 16400 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16401 | { |
| 16402 | alc663_m51va_speaker_automute(codec); |
| 16403 | alc662_eeepc_mic_automute(codec); |
| 16404 | } |
| 16405 | /* ***************** Mode2 ******************************/ |
| 16406 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16407 | unsigned int res) |
| 16408 | { |
| 16409 | switch (res >> 26) { |
| 16410 | case ALC880_HP_EVENT: |
| 16411 | alc662_f5z_speaker_automute(codec); |
| 16412 | break; |
| 16413 | case ALC880_MIC_EVENT: |
| 16414 | alc662_eeepc_mic_automute(codec); |
| 16415 | break; |
| 16416 | } |
| 16417 | } |
| 16418 | |
| 16419 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16420 | { |
| 16421 | alc662_f5z_speaker_automute(codec); |
| 16422 | alc662_eeepc_mic_automute(codec); |
| 16423 | } |
| 16424 | /* ***************** Mode3 ******************************/ |
| 16425 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16426 | unsigned int res) |
| 16427 | { |
| 16428 | switch (res >> 26) { |
| 16429 | case ALC880_HP_EVENT: |
| 16430 | alc663_two_hp_m1_speaker_automute(codec); |
| 16431 | break; |
| 16432 | case ALC880_MIC_EVENT: |
| 16433 | alc662_eeepc_mic_automute(codec); |
| 16434 | break; |
| 16435 | } |
| 16436 | } |
| 16437 | |
| 16438 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16439 | { |
| 16440 | alc663_two_hp_m1_speaker_automute(codec); |
| 16441 | alc662_eeepc_mic_automute(codec); |
| 16442 | } |
| 16443 | /* ***************** Mode4 ******************************/ |
| 16444 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16445 | unsigned int res) |
| 16446 | { |
| 16447 | switch (res >> 26) { |
| 16448 | case ALC880_HP_EVENT: |
| 16449 | alc663_21jd_two_speaker_automute(codec); |
| 16450 | break; |
| 16451 | case ALC880_MIC_EVENT: |
| 16452 | alc662_eeepc_mic_automute(codec); |
| 16453 | break; |
| 16454 | } |
| 16455 | } |
| 16456 | |
| 16457 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16458 | { |
| 16459 | alc663_21jd_two_speaker_automute(codec); |
| 16460 | alc662_eeepc_mic_automute(codec); |
| 16461 | } |
| 16462 | /* ***************** Mode5 ******************************/ |
| 16463 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16464 | unsigned int res) |
| 16465 | { |
| 16466 | switch (res >> 26) { |
| 16467 | case ALC880_HP_EVENT: |
| 16468 | alc663_15jd_two_speaker_automute(codec); |
| 16469 | break; |
| 16470 | case ALC880_MIC_EVENT: |
| 16471 | alc662_eeepc_mic_automute(codec); |
| 16472 | break; |
| 16473 | } |
| 16474 | } |
| 16475 | |
| 16476 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16477 | { |
| 16478 | alc663_15jd_two_speaker_automute(codec); |
| 16479 | alc662_eeepc_mic_automute(codec); |
| 16480 | } |
| 16481 | /* ***************** Mode6 ******************************/ |
| 16482 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16483 | unsigned int res) |
| 16484 | { |
| 16485 | switch (res >> 26) { |
| 16486 | case ALC880_HP_EVENT: |
| 16487 | alc663_two_hp_m2_speaker_automute(codec); |
| 16488 | break; |
| 16489 | case ALC880_MIC_EVENT: |
| 16490 | alc662_eeepc_mic_automute(codec); |
| 16491 | break; |
| 16492 | } |
| 16493 | } |
| 16494 | |
| 16495 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16496 | { |
| 16497 | alc663_two_hp_m2_speaker_automute(codec); |
| 16498 | alc662_eeepc_mic_automute(codec); |
| 16499 | } |
| 16500 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16501 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16502 | { |
| 16503 | unsigned int present; |
| 16504 | unsigned char bits; |
| 16505 | |
| 16506 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16507 | AC_VERB_GET_PIN_SENSE, 0) |
| 16508 | & AC_PINSENSE_PRESENCE; |
| 16509 | bits = present ? HDA_AMP_MUTE : 0; |
| 16510 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16511 | HDA_AMP_MUTE, bits); |
| 16512 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16513 | HDA_AMP_MUTE, bits); |
| 16514 | } |
| 16515 | |
| 16516 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16517 | { |
| 16518 | unsigned int present; |
| 16519 | unsigned char bits; |
| 16520 | |
| 16521 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16522 | AC_VERB_GET_PIN_SENSE, 0) |
| 16523 | & AC_PINSENSE_PRESENCE; |
| 16524 | bits = present ? HDA_AMP_MUTE : 0; |
| 16525 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16526 | HDA_AMP_MUTE, bits); |
| 16527 | } |
| 16528 | |
| 16529 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16530 | unsigned int res) |
| 16531 | { |
| 16532 | switch (res >> 26) { |
| 16533 | case ALC880_HP_EVENT: |
| 16534 | alc663_g71v_hp_automute(codec); |
| 16535 | break; |
| 16536 | case ALC880_FRONT_EVENT: |
| 16537 | alc663_g71v_front_automute(codec); |
| 16538 | break; |
| 16539 | case ALC880_MIC_EVENT: |
| 16540 | alc662_eeepc_mic_automute(codec); |
| 16541 | break; |
| 16542 | } |
| 16543 | } |
| 16544 | |
| 16545 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16546 | { |
| 16547 | alc663_g71v_front_automute(codec); |
| 16548 | alc663_g71v_hp_automute(codec); |
| 16549 | alc662_eeepc_mic_automute(codec); |
| 16550 | } |
| 16551 | |
| 16552 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16553 | unsigned int res) |
| 16554 | { |
| 16555 | switch (res >> 26) { |
| 16556 | case ALC880_HP_EVENT: |
| 16557 | alc663_m51va_speaker_automute(codec); |
| 16558 | break; |
| 16559 | case ALC880_MIC_EVENT: |
| 16560 | alc662_eeepc_mic_automute(codec); |
| 16561 | break; |
| 16562 | } |
| 16563 | } |
| 16564 | |
| 16565 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16566 | { |
| 16567 | alc663_m51va_speaker_automute(codec); |
| 16568 | alc662_eeepc_mic_automute(codec); |
| 16569 | } |
| 16570 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16571 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16572 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16573 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16574 | |
| 16575 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16576 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16577 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16578 | |
| 16579 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16580 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16581 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16582 | { } /* end */ |
| 16583 | }; |
| 16584 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16585 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16586 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16587 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16588 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16589 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16590 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16591 | |
| 16592 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16593 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16594 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16595 | |
| 16596 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16597 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16598 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16599 | { } /* end */ |
| 16600 | }; |
| 16601 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16602 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16603 | #define alc662_loopbacks alc880_loopbacks |
| 16604 | #endif |
| 16605 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16606 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16607 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16608 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16609 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16610 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16611 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16612 | |
| 16613 | /* |
| 16614 | * configuration and preset |
| 16615 | */ |
| 16616 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16617 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16618 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16619 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16620 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16621 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16622 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16623 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16624 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16625 | [ALC663_ASUS_M51VA] = "m51va", |
| 16626 | [ALC663_ASUS_G71V] = "g71v", |
| 16627 | [ALC663_ASUS_H13] = "h13", |
| 16628 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16629 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16630 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16631 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16632 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16633 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16634 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16635 | [ALC272_DELL] = "dell", |
| 16636 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16637 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16638 | [ALC662_AUTO] = "auto", |
| 16639 | }; |
| 16640 | |
| 16641 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16642 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16643 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16644 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16645 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16646 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16647 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16648 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16649 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16650 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16651 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16652 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16653 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16654 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16655 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16656 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16657 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16658 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16659 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16660 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16661 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16662 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16663 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16664 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16665 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16666 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16667 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16668 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16669 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16670 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16671 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16672 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16673 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16674 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16675 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16676 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16677 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16678 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16679 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16680 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16681 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16682 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16683 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16684 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16685 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16686 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16687 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16688 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16689 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16690 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16691 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16692 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16693 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16694 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16695 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16696 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16697 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16698 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16699 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16700 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16701 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16702 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16703 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16704 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16705 | {} |
| 16706 | }; |
| 16707 | |
| 16708 | static struct alc_config_preset alc662_presets[] = { |
| 16709 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16710 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16711 | .init_verbs = { alc662_init_verbs }, |
| 16712 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16713 | .dac_nids = alc662_dac_nids, |
| 16714 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16715 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16716 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16717 | .channel_mode = alc662_3ST_2ch_modes, |
| 16718 | .input_mux = &alc662_capture_source, |
| 16719 | }, |
| 16720 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16721 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16722 | .init_verbs = { alc662_init_verbs }, |
| 16723 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16724 | .dac_nids = alc662_dac_nids, |
| 16725 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16726 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16727 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16728 | .channel_mode = alc662_3ST_6ch_modes, |
| 16729 | .need_dac_fix = 1, |
| 16730 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16731 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16732 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16733 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16734 | .init_verbs = { alc662_init_verbs }, |
| 16735 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16736 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16737 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16738 | .channel_mode = alc662_3ST_6ch_modes, |
| 16739 | .need_dac_fix = 1, |
| 16740 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16741 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16742 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16743 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16744 | .init_verbs = { alc662_init_verbs }, |
| 16745 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16746 | .dac_nids = alc662_dac_nids, |
| 16747 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16748 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16749 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16750 | .channel_mode = alc662_5stack_modes, |
| 16751 | .input_mux = &alc662_capture_source, |
| 16752 | }, |
| 16753 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16754 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16755 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16756 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16757 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16758 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16759 | .channel_mode = alc662_3ST_2ch_modes, |
| 16760 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16761 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16762 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16763 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16764 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16765 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16766 | .init_verbs = { alc662_init_verbs, |
| 16767 | alc662_eeepc_sue_init_verbs }, |
| 16768 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16769 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16770 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16771 | .channel_mode = alc662_3ST_2ch_modes, |
| 16772 | .input_mux = &alc662_eeepc_capture_source, |
| 16773 | .unsol_event = alc662_eeepc_unsol_event, |
| 16774 | .init_hook = alc662_eeepc_inithook, |
| 16775 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16776 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16777 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16778 | alc662_chmode_mixer }, |
| 16779 | .init_verbs = { alc662_init_verbs, |
| 16780 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16781 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16782 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16783 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16784 | .channel_mode = alc662_3ST_6ch_modes, |
| 16785 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16786 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16787 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16788 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16789 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16790 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16791 | .init_verbs = { alc662_init_verbs, |
| 16792 | alc662_ecs_init_verbs }, |
| 16793 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16794 | .dac_nids = alc662_dac_nids, |
| 16795 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16796 | .channel_mode = alc662_3ST_2ch_modes, |
| 16797 | .input_mux = &alc662_eeepc_capture_source, |
| 16798 | .unsol_event = alc662_eeepc_unsol_event, |
| 16799 | .init_hook = alc662_eeepc_inithook, |
| 16800 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16801 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16802 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16803 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16804 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16805 | .dac_nids = alc662_dac_nids, |
| 16806 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16807 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16808 | .channel_mode = alc662_3ST_2ch_modes, |
| 16809 | .input_mux = &alc663_m51va_capture_source, |
| 16810 | .unsol_event = alc663_m51va_unsol_event, |
| 16811 | .init_hook = alc663_m51va_inithook, |
| 16812 | }, |
| 16813 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16814 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16815 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16816 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16817 | .dac_nids = alc662_dac_nids, |
| 16818 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16819 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16820 | .channel_mode = alc662_3ST_2ch_modes, |
| 16821 | .input_mux = &alc662_eeepc_capture_source, |
| 16822 | .unsol_event = alc663_g71v_unsol_event, |
| 16823 | .init_hook = alc663_g71v_inithook, |
| 16824 | }, |
| 16825 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16826 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16827 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16828 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16829 | .dac_nids = alc662_dac_nids, |
| 16830 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16831 | .channel_mode = alc662_3ST_2ch_modes, |
| 16832 | .input_mux = &alc663_m51va_capture_source, |
| 16833 | .unsol_event = alc663_m51va_unsol_event, |
| 16834 | .init_hook = alc663_m51va_inithook, |
| 16835 | }, |
| 16836 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16837 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16838 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16839 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16840 | .dac_nids = alc662_dac_nids, |
| 16841 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16842 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16843 | .channel_mode = alc662_3ST_6ch_modes, |
| 16844 | .input_mux = &alc663_capture_source, |
| 16845 | .unsol_event = alc663_g50v_unsol_event, |
| 16846 | .init_hook = alc663_g50v_inithook, |
| 16847 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16848 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16849 | .mixers = { alc663_m51va_mixer }, |
| 16850 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16851 | .init_verbs = { alc662_init_verbs, |
| 16852 | alc663_21jd_amic_init_verbs }, |
| 16853 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16854 | .hp_nid = 0x03, |
| 16855 | .dac_nids = alc662_dac_nids, |
| 16856 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16857 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16858 | .channel_mode = alc662_3ST_2ch_modes, |
| 16859 | .input_mux = &alc662_eeepc_capture_source, |
| 16860 | .unsol_event = alc663_mode1_unsol_event, |
| 16861 | .init_hook = alc663_mode1_inithook, |
| 16862 | }, |
| 16863 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16864 | .mixers = { alc662_1bjd_mixer }, |
| 16865 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16866 | .init_verbs = { alc662_init_verbs, |
| 16867 | alc662_1bjd_amic_init_verbs }, |
| 16868 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16869 | .dac_nids = alc662_dac_nids, |
| 16870 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16871 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16872 | .channel_mode = alc662_3ST_2ch_modes, |
| 16873 | .input_mux = &alc662_eeepc_capture_source, |
| 16874 | .unsol_event = alc662_mode2_unsol_event, |
| 16875 | .init_hook = alc662_mode2_inithook, |
| 16876 | }, |
| 16877 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16878 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16879 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16880 | .init_verbs = { alc662_init_verbs, |
| 16881 | alc663_two_hp_amic_m1_init_verbs }, |
| 16882 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16883 | .hp_nid = 0x03, |
| 16884 | .dac_nids = alc662_dac_nids, |
| 16885 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16886 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16887 | .channel_mode = alc662_3ST_2ch_modes, |
| 16888 | .input_mux = &alc662_eeepc_capture_source, |
| 16889 | .unsol_event = alc663_mode3_unsol_event, |
| 16890 | .init_hook = alc663_mode3_inithook, |
| 16891 | }, |
| 16892 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16893 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16894 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16895 | .init_verbs = { alc662_init_verbs, |
| 16896 | alc663_21jd_amic_init_verbs}, |
| 16897 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16898 | .hp_nid = 0x03, |
| 16899 | .dac_nids = alc662_dac_nids, |
| 16900 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16901 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16902 | .channel_mode = alc662_3ST_2ch_modes, |
| 16903 | .input_mux = &alc662_eeepc_capture_source, |
| 16904 | .unsol_event = alc663_mode4_unsol_event, |
| 16905 | .init_hook = alc663_mode4_inithook, |
| 16906 | }, |
| 16907 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16908 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16909 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16910 | .init_verbs = { alc662_init_verbs, |
| 16911 | alc663_15jd_amic_init_verbs }, |
| 16912 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16913 | .hp_nid = 0x03, |
| 16914 | .dac_nids = alc662_dac_nids, |
| 16915 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16916 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16917 | .channel_mode = alc662_3ST_2ch_modes, |
| 16918 | .input_mux = &alc662_eeepc_capture_source, |
| 16919 | .unsol_event = alc663_mode5_unsol_event, |
| 16920 | .init_hook = alc663_mode5_inithook, |
| 16921 | }, |
| 16922 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16923 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16924 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16925 | .init_verbs = { alc662_init_verbs, |
| 16926 | alc663_two_hp_amic_m2_init_verbs }, |
| 16927 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16928 | .hp_nid = 0x03, |
| 16929 | .dac_nids = alc662_dac_nids, |
| 16930 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16931 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16932 | .channel_mode = alc662_3ST_2ch_modes, |
| 16933 | .input_mux = &alc662_eeepc_capture_source, |
| 16934 | .unsol_event = alc663_mode6_unsol_event, |
| 16935 | .init_hook = alc663_mode6_inithook, |
| 16936 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16937 | [ALC272_DELL] = { |
| 16938 | .mixers = { alc663_m51va_mixer }, |
| 16939 | .cap_mixer = alc272_auto_capture_mixer, |
| 16940 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16941 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16942 | .dac_nids = alc662_dac_nids, |
| 16943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16944 | .adc_nids = alc272_adc_nids, |
| 16945 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16946 | .capsrc_nids = alc272_capsrc_nids, |
| 16947 | .channel_mode = alc662_3ST_2ch_modes, |
| 16948 | .input_mux = &alc663_m51va_capture_source, |
| 16949 | .unsol_event = alc663_m51va_unsol_event, |
| 16950 | .init_hook = alc663_m51va_inithook, |
| 16951 | }, |
| 16952 | [ALC272_DELL_ZM1] = { |
| 16953 | .mixers = { alc663_m51va_mixer }, |
| 16954 | .cap_mixer = alc662_auto_capture_mixer, |
| 16955 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16956 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16957 | .dac_nids = alc662_dac_nids, |
| 16958 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16959 | .adc_nids = alc662_adc_nids, |
| 16960 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16961 | .capsrc_nids = alc662_capsrc_nids, |
| 16962 | .channel_mode = alc662_3ST_2ch_modes, |
| 16963 | .input_mux = &alc663_m51va_capture_source, |
| 16964 | .unsol_event = alc663_m51va_unsol_event, |
| 16965 | .init_hook = alc663_m51va_inithook, |
| 16966 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16967 | [ALC272_SAMSUNG_NC10] = { |
| 16968 | .mixers = { alc272_nc10_mixer }, |
| 16969 | .init_verbs = { alc662_init_verbs, |
| 16970 | alc663_21jd_amic_init_verbs }, |
| 16971 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16972 | .dac_nids = alc272_dac_nids, |
| 16973 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16974 | .channel_mode = alc662_3ST_2ch_modes, |
| 16975 | .input_mux = &alc272_nc10_capture_source, |
| 16976 | .unsol_event = alc663_mode4_unsol_event, |
| 16977 | .init_hook = alc663_mode4_inithook, |
| 16978 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16979 | }; |
| 16980 | |
| 16981 | |
| 16982 | /* |
| 16983 | * BIOS auto configuration |
| 16984 | */ |
| 16985 | |
| 16986 | /* add playback controls from the parsed DAC table */ |
| 16987 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16988 | const struct auto_pin_cfg *cfg) |
| 16989 | { |
| 16990 | char name[32]; |
| 16991 | static const char *chname[4] = { |
| 16992 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16993 | }; |
| 16994 | hda_nid_t nid; |
| 16995 | int i, err; |
| 16996 | |
| 16997 | for (i = 0; i < cfg->line_outs; i++) { |
| 16998 | if (!spec->multiout.dac_nids[i]) |
| 16999 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17000 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17001 | if (i == 2) { |
| 17002 | /* Center/LFE */ |
| 17003 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17004 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17005 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17006 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17007 | if (err < 0) |
| 17008 | return err; |
| 17009 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17010 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17011 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17012 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17013 | if (err < 0) |
| 17014 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17015 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17016 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17017 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17018 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17019 | if (err < 0) |
| 17020 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17021 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17022 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17023 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17024 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17025 | if (err < 0) |
| 17026 | return err; |
| 17027 | } else { |
| 17028 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17029 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17030 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17031 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17032 | if (err < 0) |
| 17033 | return err; |
| 17034 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17035 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17036 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17037 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17038 | if (err < 0) |
| 17039 | return err; |
| 17040 | } |
| 17041 | } |
| 17042 | return 0; |
| 17043 | } |
| 17044 | |
| 17045 | /* add playback controls for speaker and HP outputs */ |
| 17046 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17047 | const char *pfx) |
| 17048 | { |
| 17049 | hda_nid_t nid; |
| 17050 | int err; |
| 17051 | char name[32]; |
| 17052 | |
| 17053 | if (!pin) |
| 17054 | return 0; |
| 17055 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17056 | if (pin == 0x17) { |
| 17057 | /* ALC663 has a mono output pin on 0x17 */ |
| 17058 | sprintf(name, "%s Playback Switch", pfx); |
| 17059 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17060 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17061 | return err; |
| 17062 | } |
| 17063 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17064 | if (alc880_is_fixed_pin(pin)) { |
| 17065 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17066 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17067 | /* specify the DAC as the extra output */ |
| 17068 | if (!spec->multiout.hp_nid) |
| 17069 | spec->multiout.hp_nid = nid; |
| 17070 | else |
| 17071 | spec->multiout.extra_out_nid[0] = nid; |
| 17072 | /* control HP volume/switch on the output mixer amp */ |
| 17073 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17074 | sprintf(name, "%s Playback Volume", pfx); |
| 17075 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17076 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17077 | if (err < 0) |
| 17078 | return err; |
| 17079 | sprintf(name, "%s Playback Switch", pfx); |
| 17080 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17081 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17082 | if (err < 0) |
| 17083 | return err; |
| 17084 | } else if (alc880_is_multi_pin(pin)) { |
| 17085 | /* set manual connection */ |
| 17086 | /* we have only a switch on HP-out PIN */ |
| 17087 | sprintf(name, "%s Playback Switch", pfx); |
| 17088 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17089 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17090 | if (err < 0) |
| 17091 | return err; |
| 17092 | } |
| 17093 | return 0; |
| 17094 | } |
| 17095 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17096 | /* return the index of the src widget from the connection list of the nid. |
| 17097 | * return -1 if not found |
| 17098 | */ |
| 17099 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 17100 | hda_nid_t src) |
| 17101 | { |
| 17102 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 17103 | int i, conns; |
| 17104 | |
| 17105 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 17106 | ARRAY_SIZE(conn_list)); |
| 17107 | if (conns < 0) |
| 17108 | return -1; |
| 17109 | for (i = 0; i < conns; i++) |
| 17110 | if (conn_list[i] == src) |
| 17111 | return i; |
| 17112 | return -1; |
| 17113 | } |
| 17114 | |
| 17115 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17116 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17117 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17118 | return (pincap & AC_PINCAP_IN) != 0; |
| 17119 | } |
| 17120 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17121 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17122 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17123 | const struct auto_pin_cfg *cfg) |
| 17124 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17125 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17126 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17127 | int i, err, idx; |
| 17128 | |
| 17129 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17130 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 17131 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 17132 | cfg->input_pins[i]); |
| 17133 | if (idx >= 0) { |
| 17134 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17135 | auto_pin_cfg_labels[i], |
| 17136 | idx, 0x0b); |
| 17137 | if (err < 0) |
| 17138 | return err; |
| 17139 | } |
| 17140 | idx = alc662_input_pin_idx(codec, 0x22, |
| 17141 | cfg->input_pins[i]); |
| 17142 | if (idx >= 0) { |
| 17143 | imux->items[imux->num_items].label = |
| 17144 | auto_pin_cfg_labels[i]; |
| 17145 | imux->items[imux->num_items].index = idx; |
| 17146 | imux->num_items++; |
| 17147 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17148 | } |
| 17149 | } |
| 17150 | return 0; |
| 17151 | } |
| 17152 | |
| 17153 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17154 | hda_nid_t nid, int pin_type, |
| 17155 | int dac_idx) |
| 17156 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17157 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17158 | /* need the manual connection? */ |
| 17159 | if (alc880_is_multi_pin(nid)) { |
| 17160 | struct alc_spec *spec = codec->spec; |
| 17161 | int idx = alc880_multi_pin_idx(nid); |
| 17162 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17163 | AC_VERB_SET_CONNECT_SEL, |
| 17164 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17165 | } |
| 17166 | } |
| 17167 | |
| 17168 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17169 | { |
| 17170 | struct alc_spec *spec = codec->spec; |
| 17171 | int i; |
| 17172 | |
| 17173 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17174 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17175 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17176 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17177 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17178 | i); |
| 17179 | } |
| 17180 | } |
| 17181 | |
| 17182 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17183 | { |
| 17184 | struct alc_spec *spec = codec->spec; |
| 17185 | hda_nid_t pin; |
| 17186 | |
| 17187 | pin = spec->autocfg.hp_pins[0]; |
| 17188 | if (pin) /* connect to front */ |
| 17189 | /* use dac 0 */ |
| 17190 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17191 | pin = spec->autocfg.speaker_pins[0]; |
| 17192 | if (pin) |
| 17193 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17194 | } |
| 17195 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17196 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17197 | |
| 17198 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17199 | { |
| 17200 | struct alc_spec *spec = codec->spec; |
| 17201 | int i; |
| 17202 | |
| 17203 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17204 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17205 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17206 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17207 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17208 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17209 | snd_hda_codec_write(codec, nid, 0, |
| 17210 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17211 | AMP_OUT_MUTE); |
| 17212 | } |
| 17213 | } |
| 17214 | } |
| 17215 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17216 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17217 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17218 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17219 | { |
| 17220 | struct alc_spec *spec = codec->spec; |
| 17221 | int err; |
| 17222 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17223 | |
| 17224 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17225 | alc662_ignore); |
| 17226 | if (err < 0) |
| 17227 | return err; |
| 17228 | if (!spec->autocfg.line_outs) |
| 17229 | return 0; /* can't find valid BIOS pin config */ |
| 17230 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17231 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17232 | if (err < 0) |
| 17233 | return err; |
| 17234 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17235 | if (err < 0) |
| 17236 | return err; |
| 17237 | err = alc662_auto_create_extra_out(spec, |
| 17238 | spec->autocfg.speaker_pins[0], |
| 17239 | "Speaker"); |
| 17240 | if (err < 0) |
| 17241 | return err; |
| 17242 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17243 | "Headphone"); |
| 17244 | if (err < 0) |
| 17245 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17246 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17247 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17248 | return err; |
| 17249 | |
| 17250 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17251 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17252 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17253 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17254 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17255 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17256 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17257 | |
| 17258 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17259 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17260 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17261 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17262 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17263 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17264 | |
| 17265 | err = alc_auto_add_mic_boost(codec); |
| 17266 | if (err < 0) |
| 17267 | return err; |
| 17268 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17269 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17270 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17271 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17272 | } |
| 17273 | |
| 17274 | /* additional initialization for auto-configuration model */ |
| 17275 | static void alc662_auto_init(struct hda_codec *codec) |
| 17276 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17277 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17278 | alc662_auto_init_multi_out(codec); |
| 17279 | alc662_auto_init_hp_out(codec); |
| 17280 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17281 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17282 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17283 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17284 | } |
| 17285 | |
| 17286 | static int patch_alc662(struct hda_codec *codec) |
| 17287 | { |
| 17288 | struct alc_spec *spec; |
| 17289 | int err, board_config; |
| 17290 | |
| 17291 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17292 | if (!spec) |
| 17293 | return -ENOMEM; |
| 17294 | |
| 17295 | codec->spec = spec; |
| 17296 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17297 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17298 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17299 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17300 | alc662_models, |
| 17301 | alc662_cfg_tbl); |
| 17302 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17303 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17304 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17305 | board_config = ALC662_AUTO; |
| 17306 | } |
| 17307 | |
| 17308 | if (board_config == ALC662_AUTO) { |
| 17309 | /* automatic parse from the BIOS config */ |
| 17310 | err = alc662_parse_auto_config(codec); |
| 17311 | if (err < 0) { |
| 17312 | alc_free(codec); |
| 17313 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17314 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17315 | printk(KERN_INFO |
| 17316 | "hda_codec: Cannot set up configuration " |
| 17317 | "from BIOS. Using base mode...\n"); |
| 17318 | board_config = ALC662_3ST_2ch_DIG; |
| 17319 | } |
| 17320 | } |
| 17321 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17322 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17323 | if (err < 0) { |
| 17324 | alc_free(codec); |
| 17325 | return err; |
| 17326 | } |
| 17327 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17328 | if (board_config != ALC662_AUTO) |
| 17329 | setup_preset(spec, &alc662_presets[board_config]); |
| 17330 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17331 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17332 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17333 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17334 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17335 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17336 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17337 | spec->adc_nids = alc662_adc_nids; |
| 17338 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17339 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17340 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17341 | if (!spec->cap_mixer) |
| 17342 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17343 | if (codec->vendor_id == 0x10ec0662) |
| 17344 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17345 | else |
| 17346 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17347 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17348 | spec->vmaster_nid = 0x02; |
| 17349 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17350 | codec->patch_ops = alc_patch_ops; |
| 17351 | if (board_config == ALC662_AUTO) |
| 17352 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17353 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17354 | if (!spec->loopback.amplist) |
| 17355 | spec->loopback.amplist = alc662_loopbacks; |
| 17356 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17357 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17358 | |
| 17359 | return 0; |
| 17360 | } |
| 17361 | |
| 17362 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17363 | * patch entries |
| 17364 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17365 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17366 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17367 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17368 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17369 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17370 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17371 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17372 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17373 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17374 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17375 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17376 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17377 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17378 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17379 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17380 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17381 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17382 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17383 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17384 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17385 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17386 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17387 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17388 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17389 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17390 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17391 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17392 | .patch = patch_alc882 }, |
| 17393 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17394 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17395 | {} /* terminator */ |
| 17396 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17397 | |
| 17398 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17399 | |
| 17400 | MODULE_LICENSE("GPL"); |
| 17401 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17402 | |
| 17403 | static struct hda_codec_preset_list realtek_list = { |
| 17404 | .preset = snd_hda_preset_realtek, |
| 17405 | .owner = THIS_MODULE, |
| 17406 | }; |
| 17407 | |
| 17408 | static int __init patch_realtek_init(void) |
| 17409 | { |
| 17410 | return snd_hda_add_codec_preset(&realtek_list); |
| 17411 | } |
| 17412 | |
| 17413 | static void __exit patch_realtek_exit(void) |
| 17414 | { |
| 17415 | snd_hda_delete_codec_preset(&realtek_list); |
| 17416 | } |
| 17417 | |
| 17418 | module_init(patch_realtek_init) |
| 17419 | module_exit(patch_realtek_exit) |