Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
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 | 7cf51e4 | 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 | bab282b | 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, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 238 | ALC888_ASUS_M90V, |
| 239 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 240 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 241 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 242 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 243 | ALC882_AUTO, |
| 244 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 245 | }; |
| 246 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 247 | /* for GPIO Poll */ |
| 248 | #define GPIO_MASK 0x03 |
| 249 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 250 | /* extra amp-initialization sequence types */ |
| 251 | enum { |
| 252 | ALC_INIT_NONE, |
| 253 | ALC_INIT_DEFAULT, |
| 254 | ALC_INIT_GPIO1, |
| 255 | ALC_INIT_GPIO2, |
| 256 | ALC_INIT_GPIO3, |
| 257 | }; |
| 258 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | struct alc_spec { |
| 260 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 261 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 263 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 264 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 266 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 267 | * don't forget NULL |
| 268 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 269 | */ |
| 270 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 272 | char stream_name_analog[16]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | struct hda_pcm_stream *stream_analog_playback; |
| 274 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 275 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 276 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 278 | char stream_name_digital[16]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | struct hda_pcm_stream *stream_digital_playback; |
| 280 | struct hda_pcm_stream *stream_digital_capture; |
| 281 | |
| 282 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 283 | struct hda_multi_out multiout; /* playback set-up |
| 284 | * max_channels, dacs must be set |
| 285 | * dig_out_nid and hp_nid are optional |
| 286 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 287 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 288 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 289 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | |
| 291 | /* capture */ |
| 292 | unsigned int num_adc_nids; |
| 293 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 294 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 295 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
| 297 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 298 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | const struct hda_input_mux *input_mux; |
| 300 | unsigned int cur_mux[3]; |
| 301 | |
| 302 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 303 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 305 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 306 | int const_channel_count; |
| 307 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
| 309 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 310 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 311 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 312 | /* dynamic controls, init_verbs and input_mux */ |
| 313 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 314 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 315 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 316 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 317 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 318 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 319 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 320 | /* hooks */ |
| 321 | void (*init_hook)(struct hda_codec *codec); |
| 322 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 323 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 324 | /* for pin sensing */ |
| 325 | unsigned int sense_updated: 1; |
| 326 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 327 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 328 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 329 | /* other flags */ |
| 330 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 331 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 332 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 333 | /* for virtual master */ |
| 334 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 335 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 336 | struct hda_loopback_check loopback; |
| 337 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 338 | |
| 339 | /* for PLL fix */ |
| 340 | hda_nid_t pll_nid; |
| 341 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 342 | }; |
| 343 | |
| 344 | /* |
| 345 | * configuration template - to be copied to the spec instance |
| 346 | */ |
| 347 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 348 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 349 | * with spec |
| 350 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 351 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 352 | const struct hda_verb *init_verbs[5]; |
| 353 | unsigned int num_dacs; |
| 354 | hda_nid_t *dac_nids; |
| 355 | hda_nid_t dig_out_nid; /* optional */ |
| 356 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 357 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 358 | unsigned int num_adc_nids; |
| 359 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 360 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 361 | hda_nid_t dig_in_nid; |
| 362 | unsigned int num_channel_mode; |
| 363 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 364 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 365 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 366 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 367 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 368 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 369 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 370 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 371 | struct hda_amp_list *loopbacks; |
| 372 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | }; |
| 374 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | |
| 376 | /* |
| 377 | * input MUX handling |
| 378 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 379 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 380 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | { |
| 382 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 383 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 384 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 385 | if (mux_idx >= spec->num_mux_defs) |
| 386 | mux_idx = 0; |
| 387 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | } |
| 389 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 390 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 391 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | { |
| 393 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 394 | struct alc_spec *spec = codec->spec; |
| 395 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 396 | |
| 397 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 398 | return 0; |
| 399 | } |
| 400 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 401 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 402 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | { |
| 404 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 405 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 406 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 408 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 409 | hda_nid_t nid = spec->capsrc_nids ? |
| 410 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 411 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 413 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 414 | imux = &spec->input_mux[mux_idx]; |
| 415 | |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 416 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 417 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 418 | /* Matrix-mixer style (e.g. ALC882) */ |
| 419 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 420 | unsigned int i, idx; |
| 421 | |
| 422 | idx = ucontrol->value.enumerated.item[0]; |
| 423 | if (idx >= imux->num_items) |
| 424 | idx = imux->num_items - 1; |
| 425 | if (*cur_val == idx) |
| 426 | return 0; |
| 427 | for (i = 0; i < imux->num_items; i++) { |
| 428 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 429 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 430 | imux->items[i].index, |
| 431 | HDA_AMP_MUTE, v); |
| 432 | } |
| 433 | *cur_val = idx; |
| 434 | return 1; |
| 435 | } else { |
| 436 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 437 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 438 | &spec->cur_mux[adc_idx]); |
| 439 | } |
| 440 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 441 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | /* |
| 443 | * channel mode setting |
| 444 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 445 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 446 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | { |
| 448 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 449 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 450 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 451 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | } |
| 453 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 454 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 455 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | { |
| 457 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 458 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 459 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 461 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | } |
| 463 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 465 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | { |
| 467 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 468 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 469 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 470 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 471 | &spec->ext_channel_count); |
| 472 | if (err >= 0 && !spec->const_channel_count) { |
| 473 | spec->multiout.max_channels = spec->ext_channel_count; |
| 474 | if (spec->need_dac_fix) |
| 475 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 476 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 477 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 481 | * 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] | 482 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | * being part of a format specifier. Maximum allowed length of a value is |
| 484 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 485 | * |
| 486 | * Note: some retasking pin complexes seem to ignore requests for input |
| 487 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 488 | * are requested. Therefore order this list so that this behaviour will not |
| 489 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 490 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 491 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 492 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 493 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 494 | "Mic 50pc bias", "Mic 80pc bias", |
| 495 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 496 | }; |
| 497 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 498 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 499 | }; |
| 500 | /* 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] | 501 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 502 | * addition, "input" pins may or may not process the mic bias option |
| 503 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 504 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 505 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 506 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 507 | #define ALC_PIN_DIR_IN 0x00 |
| 508 | #define ALC_PIN_DIR_OUT 0x01 |
| 509 | #define ALC_PIN_DIR_INOUT 0x02 |
| 510 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 511 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 513 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | * For each direction the minimum and maximum values are given. |
| 515 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 516 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 518 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 519 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 520 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 521 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | }; |
| 523 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 524 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 525 | #define alc_pin_mode_n_items(_dir) \ |
| 526 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 527 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 528 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 529 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 530 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 531 | unsigned int item_num = uinfo->value.enumerated.item; |
| 532 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 533 | |
| 534 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 535 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 536 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 537 | |
| 538 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 539 | item_num = alc_pin_mode_min(dir); |
| 540 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 541 | return 0; |
| 542 | } |
| 543 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 544 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 545 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 548 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 549 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 550 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 551 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 552 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 553 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 554 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 555 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 556 | /* Find enumerated value for current pinctl setting */ |
| 557 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | 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] | 559 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | *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] | 561 | return 0; |
| 562 | } |
| 563 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 565 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | { |
| 567 | signed int change; |
| 568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 569 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 570 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 571 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 572 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 573 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 574 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 575 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 576 | 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] | 577 | val = alc_pin_mode_min(dir); |
| 578 | |
| 579 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 580 | if (change) { |
| 581 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 582 | snd_hda_codec_write_cache(codec, nid, 0, |
| 583 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 584 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 585 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 586 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | * for the requested pin mode. Enum values of 2 or less are |
| 588 | * input modes. |
| 589 | * |
| 590 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 591 | * reduces noise slightly (particularly on input) so we'll |
| 592 | * do it. However, having both input and output buffers |
| 593 | * enabled simultaneously doesn't seem to be problematic if |
| 594 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 595 | */ |
| 596 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 597 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 598 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 599 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 600 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 601 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 602 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 603 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 604 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 605 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 606 | } |
| 607 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 608 | return change; |
| 609 | } |
| 610 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 611 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 612 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 613 | .info = alc_pin_mode_info, \ |
| 614 | .get = alc_pin_mode_get, \ |
| 615 | .put = alc_pin_mode_put, \ |
| 616 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 617 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 618 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 619 | * together using a mask with more than one bit set. This control is |
| 620 | * currently used only by the ALC260 test model. At this stage they are not |
| 621 | * needed for any "production" models. |
| 622 | */ |
| 623 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 624 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 625 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 627 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 628 | { |
| 629 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 630 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 631 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 632 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 633 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 634 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 635 | |
| 636 | *valp = (val & mask) != 0; |
| 637 | return 0; |
| 638 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 639 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 641 | { |
| 642 | signed int change; |
| 643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 644 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 645 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 646 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 647 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 648 | AC_VERB_GET_GPIO_DATA, |
| 649 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 650 | |
| 651 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 652 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 653 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 654 | gpio_data &= ~mask; |
| 655 | else |
| 656 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 657 | snd_hda_codec_write_cache(codec, nid, 0, |
| 658 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 659 | |
| 660 | return change; |
| 661 | } |
| 662 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 663 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 664 | .info = alc_gpio_data_info, \ |
| 665 | .get = alc_gpio_data_get, \ |
| 666 | .put = alc_gpio_data_put, \ |
| 667 | .private_value = nid | (mask<<16) } |
| 668 | #endif /* CONFIG_SND_DEBUG */ |
| 669 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 670 | /* A switch control to allow the enabling of the digital IO pins on the |
| 671 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 672 | * to provide something in the test model allowing digital outputs to be |
| 673 | * identified if present. If models are found which can utilise these |
| 674 | * outputs a more complete mixer control can be devised for those models if |
| 675 | * necessary. |
| 676 | */ |
| 677 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 678 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 679 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 680 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 681 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 682 | { |
| 683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 684 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 685 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 686 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 687 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 688 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 689 | |
| 690 | *valp = (val & mask) != 0; |
| 691 | return 0; |
| 692 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 694 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 695 | { |
| 696 | signed int change; |
| 697 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 698 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 699 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 700 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 701 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 702 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 704 | |
| 705 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 706 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 707 | if (val==0) |
| 708 | ctrl_data &= ~mask; |
| 709 | else |
| 710 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 711 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 712 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 713 | |
| 714 | return change; |
| 715 | } |
| 716 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 717 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 718 | .info = alc_spdif_ctrl_info, \ |
| 719 | .get = alc_spdif_ctrl_get, \ |
| 720 | .put = alc_spdif_ctrl_put, \ |
| 721 | .private_value = nid | (mask<<16) } |
| 722 | #endif /* CONFIG_SND_DEBUG */ |
| 723 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 724 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 725 | * Again, this is only used in the ALC26x test models to help identify when |
| 726 | * the EAPD line must be asserted for features to work. |
| 727 | */ |
| 728 | #ifdef CONFIG_SND_DEBUG |
| 729 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 730 | |
| 731 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 732 | struct snd_ctl_elem_value *ucontrol) |
| 733 | { |
| 734 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 735 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 736 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 737 | long *valp = ucontrol->value.integer.value; |
| 738 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 739 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 740 | |
| 741 | *valp = (val & mask) != 0; |
| 742 | return 0; |
| 743 | } |
| 744 | |
| 745 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 746 | struct snd_ctl_elem_value *ucontrol) |
| 747 | { |
| 748 | int change; |
| 749 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 750 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 751 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 752 | long val = *ucontrol->value.integer.value; |
| 753 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 754 | AC_VERB_GET_EAPD_BTLENABLE, |
| 755 | 0x00); |
| 756 | |
| 757 | /* Set/unset the masked control bit(s) as needed */ |
| 758 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 759 | if (!val) |
| 760 | ctrl_data &= ~mask; |
| 761 | else |
| 762 | ctrl_data |= mask; |
| 763 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 764 | ctrl_data); |
| 765 | |
| 766 | return change; |
| 767 | } |
| 768 | |
| 769 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 770 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 771 | .info = alc_eapd_ctrl_info, \ |
| 772 | .get = alc_eapd_ctrl_get, \ |
| 773 | .put = alc_eapd_ctrl_put, \ |
| 774 | .private_value = nid | (mask<<16) } |
| 775 | #endif /* CONFIG_SND_DEBUG */ |
| 776 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 777 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 778 | * set up the input pin config (depending on the given auto-pin type) |
| 779 | */ |
| 780 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 781 | int auto_pin_type) |
| 782 | { |
| 783 | unsigned int val = PIN_IN; |
| 784 | |
| 785 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 786 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 787 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 788 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 789 | if (pincap & AC_PINCAP_VREF_80) |
| 790 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 791 | else if (pincap & AC_PINCAP_VREF_50) |
| 792 | val = PIN_VREF50; |
| 793 | else if (pincap & AC_PINCAP_VREF_100) |
| 794 | val = PIN_VREF100; |
| 795 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 796 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 797 | } |
| 798 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 799 | } |
| 800 | |
| 801 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 802 | */ |
| 803 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 804 | { |
| 805 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 806 | return; |
| 807 | spec->mixers[spec->num_mixers++] = mix; |
| 808 | } |
| 809 | |
| 810 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 811 | { |
| 812 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 813 | return; |
| 814 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 815 | } |
| 816 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 817 | #ifdef CONFIG_PROC_FS |
| 818 | /* |
| 819 | * hook for proc |
| 820 | */ |
| 821 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 822 | struct hda_codec *codec, hda_nid_t nid) |
| 823 | { |
| 824 | int coeff; |
| 825 | |
| 826 | if (nid != 0x20) |
| 827 | return; |
| 828 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 829 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 830 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 831 | AC_VERB_GET_COEF_INDEX, 0); |
| 832 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 833 | } |
| 834 | #else |
| 835 | #define print_realtek_coef NULL |
| 836 | #endif |
| 837 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 838 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 839 | * set up from the preset table |
| 840 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 841 | static void setup_preset(struct alc_spec *spec, |
| 842 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 843 | { |
| 844 | int i; |
| 845 | |
| 846 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 847 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 848 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 849 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 850 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 851 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 853 | spec->channel_mode = preset->channel_mode; |
| 854 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 855 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 856 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 857 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 858 | if (preset->const_channel_count) |
| 859 | spec->multiout.max_channels = preset->const_channel_count; |
| 860 | else |
| 861 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 862 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 863 | |
| 864 | spec->multiout.num_dacs = preset->num_dacs; |
| 865 | spec->multiout.dac_nids = preset->dac_nids; |
| 866 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 867 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 868 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 869 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 870 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 871 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 872 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 873 | spec->input_mux = preset->input_mux; |
| 874 | |
| 875 | spec->num_adc_nids = preset->num_adc_nids; |
| 876 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 877 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 878 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 879 | |
| 880 | spec->unsol_event = preset->unsol_event; |
| 881 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 882 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 883 | spec->loopback.amplist = preset->loopbacks; |
| 884 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 885 | } |
| 886 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 887 | /* Enable GPIO mask and set output */ |
| 888 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 889 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 890 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 891 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 892 | { } |
| 893 | }; |
| 894 | |
| 895 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 896 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 897 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 898 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 899 | { } |
| 900 | }; |
| 901 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 902 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 903 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 904 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 905 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 906 | { } |
| 907 | }; |
| 908 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 909 | /* |
| 910 | * Fix hardware PLL issue |
| 911 | * On some codecs, the analog PLL gating control must be off while |
| 912 | * the default value is 1. |
| 913 | */ |
| 914 | static void alc_fix_pll(struct hda_codec *codec) |
| 915 | { |
| 916 | struct alc_spec *spec = codec->spec; |
| 917 | unsigned int val; |
| 918 | |
| 919 | if (!spec->pll_nid) |
| 920 | return; |
| 921 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 922 | spec->pll_coef_idx); |
| 923 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 924 | AC_VERB_GET_PROC_COEF, 0); |
| 925 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 926 | spec->pll_coef_idx); |
| 927 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 928 | val & ~(1 << spec->pll_coef_bit)); |
| 929 | } |
| 930 | |
| 931 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 932 | unsigned int coef_idx, unsigned int coef_bit) |
| 933 | { |
| 934 | struct alc_spec *spec = codec->spec; |
| 935 | spec->pll_nid = nid; |
| 936 | spec->pll_coef_idx = coef_idx; |
| 937 | spec->pll_coef_bit = coef_bit; |
| 938 | alc_fix_pll(codec); |
| 939 | } |
| 940 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 941 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 942 | { |
| 943 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 944 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 945 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 946 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 947 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 948 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 949 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 950 | 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] | 951 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 952 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 953 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 954 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 955 | nid = spec->autocfg.speaker_pins[i]; |
| 956 | if (!nid) |
| 957 | break; |
| 958 | snd_hda_codec_write(codec, nid, 0, |
| 959 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 960 | spec->jack_present ? 0 : PIN_OUT); |
| 961 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | } |
| 963 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 964 | #if 0 /* it's broken in some cases -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 965 | static void alc_mic_automute(struct hda_codec *codec) |
| 966 | { |
| 967 | struct alc_spec *spec = codec->spec; |
| 968 | unsigned int present; |
| 969 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 970 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 971 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 972 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 973 | |
| 974 | capsrc_idx_mic = mic_nid - 0x18; |
| 975 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 976 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 977 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 978 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 979 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 980 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 981 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 982 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 983 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 984 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 985 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 986 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 987 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 988 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 989 | /* unsolicited event for HP jack sensing */ |
| 990 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 991 | { |
| 992 | if (codec->vendor_id == 0x10ec0880) |
| 993 | res >>= 28; |
| 994 | else |
| 995 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 996 | switch (res) { |
| 997 | case ALC880_HP_EVENT: |
| 998 | alc_automute_pin(codec); |
| 999 | break; |
| 1000 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1001 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1002 | break; |
| 1003 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1004 | } |
| 1005 | |
| 1006 | static void alc_inithook(struct hda_codec *codec) |
| 1007 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1008 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1009 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1010 | } |
| 1011 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1012 | /* additional initialization for ALC888 variants */ |
| 1013 | static void alc888_coef_init(struct hda_codec *codec) |
| 1014 | { |
| 1015 | unsigned int tmp; |
| 1016 | |
| 1017 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1018 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1019 | 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] | 1020 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1021 | /* alc888S-VC */ |
| 1022 | snd_hda_codec_read(codec, 0x20, 0, |
| 1023 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1024 | else |
| 1025 | /* alc888-VB */ |
| 1026 | snd_hda_codec_read(codec, 0x20, 0, |
| 1027 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1028 | } |
| 1029 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1030 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1031 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1032 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1033 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1034 | switch (type) { |
| 1035 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1036 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1037 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1038 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1039 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1040 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1041 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1042 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1043 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1044 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1045 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1046 | case 0x10ec0260: |
| 1047 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1048 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1049 | snd_hda_codec_write(codec, 0x10, 0, |
| 1050 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1051 | break; |
| 1052 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1053 | case 0x10ec0267: |
| 1054 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1055 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1056 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1057 | case 0x10ec0660: |
| 1058 | case 0x10ec0662: |
| 1059 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1060 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1061 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1062 | snd_hda_codec_write(codec, 0x14, 0, |
| 1063 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1064 | snd_hda_codec_write(codec, 0x15, 0, |
| 1065 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1066 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1067 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1068 | switch (codec->vendor_id) { |
| 1069 | case 0x10ec0260: |
| 1070 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1071 | AC_VERB_SET_COEF_INDEX, 7); |
| 1072 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1073 | AC_VERB_GET_PROC_COEF, 0); |
| 1074 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1075 | AC_VERB_SET_COEF_INDEX, 7); |
| 1076 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1077 | AC_VERB_SET_PROC_COEF, |
| 1078 | tmp | 0x2010); |
| 1079 | break; |
| 1080 | case 0x10ec0262: |
| 1081 | case 0x10ec0880: |
| 1082 | case 0x10ec0882: |
| 1083 | case 0x10ec0883: |
| 1084 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1085 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1086 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1087 | snd_hda_codec_write(codec, 0x20, 0, |
| 1088 | AC_VERB_SET_COEF_INDEX, 7); |
| 1089 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1090 | AC_VERB_GET_PROC_COEF, 0); |
| 1091 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1092 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1093 | snd_hda_codec_write(codec, 0x20, 0, |
| 1094 | AC_VERB_SET_PROC_COEF, |
| 1095 | tmp | 0x2010); |
| 1096 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1097 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1098 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1099 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1100 | case 0x10ec0267: |
| 1101 | case 0x10ec0268: |
| 1102 | snd_hda_codec_write(codec, 0x20, 0, |
| 1103 | AC_VERB_SET_COEF_INDEX, 7); |
| 1104 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1105 | AC_VERB_GET_PROC_COEF, 0); |
| 1106 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1107 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1108 | snd_hda_codec_write(codec, 0x20, 0, |
| 1109 | AC_VERB_SET_PROC_COEF, |
| 1110 | tmp | 0x3000); |
| 1111 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1112 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1113 | break; |
| 1114 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1115 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1116 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1117 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1118 | { |
| 1119 | struct alc_spec *spec = codec->spec; |
| 1120 | |
| 1121 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1122 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1123 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1124 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1125 | if (spec->autocfg.line_out_pins[0] && |
| 1126 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1128 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1129 | else |
| 1130 | return; |
| 1131 | } |
| 1132 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1133 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1134 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1135 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1136 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1137 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1138 | spec->unsol_event = alc_sku_unsol_event; |
| 1139 | } |
| 1140 | |
| 1141 | /* check subsystem ID and set up device-specific initialization; |
| 1142 | * return 1 if initialized, 0 if invalid SSID |
| 1143 | */ |
| 1144 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1145 | * 31 ~ 16 : Manufacture ID |
| 1146 | * 15 ~ 8 : SKU ID |
| 1147 | * 7 ~ 0 : Assembly ID |
| 1148 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1149 | */ |
| 1150 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1151 | hda_nid_t porta, hda_nid_t porte, |
| 1152 | hda_nid_t portd) |
| 1153 | { |
| 1154 | unsigned int ass, tmp, i; |
| 1155 | unsigned nid; |
| 1156 | struct alc_spec *spec = codec->spec; |
| 1157 | |
| 1158 | ass = codec->subsystem_id & 0xffff; |
| 1159 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1160 | goto do_sku; |
| 1161 | |
| 1162 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1163 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1164 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1165 | * 29~21 : reserve |
| 1166 | * 20 : PCBEEP input |
| 1167 | * 19~16 : Check sum (15:1) |
| 1168 | * 15~1 : Custom |
| 1169 | * 0 : override |
| 1170 | */ |
| 1171 | nid = 0x1d; |
| 1172 | if (codec->vendor_id == 0x10ec0260) |
| 1173 | nid = 0x17; |
| 1174 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1175 | snd_printd("realtek: No valid SSID, " |
| 1176 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1177 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1178 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1179 | return 0; |
| 1180 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1181 | return 0; |
| 1182 | |
| 1183 | /* check sum */ |
| 1184 | tmp = 0; |
| 1185 | for (i = 1; i < 16; i++) { |
| 1186 | if ((ass >> i) & 1) |
| 1187 | tmp++; |
| 1188 | } |
| 1189 | if (((ass >> 16) & 0xf) != tmp) |
| 1190 | return 0; |
| 1191 | do_sku: |
| 1192 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1193 | ass & 0xffff, codec->vendor_id); |
| 1194 | /* |
| 1195 | * 0 : override |
| 1196 | * 1 : Swap Jack |
| 1197 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1198 | * 3~5 : External Amplifier control |
| 1199 | * 7~6 : Reserved |
| 1200 | */ |
| 1201 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1202 | switch (tmp) { |
| 1203 | case 1: |
| 1204 | spec->init_amp = ALC_INIT_GPIO1; |
| 1205 | break; |
| 1206 | case 3: |
| 1207 | spec->init_amp = ALC_INIT_GPIO2; |
| 1208 | break; |
| 1209 | case 7: |
| 1210 | spec->init_amp = ALC_INIT_GPIO3; |
| 1211 | break; |
| 1212 | case 5: |
| 1213 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1214 | break; |
| 1215 | } |
| 1216 | |
| 1217 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1218 | * when the external headphone out jack is plugged" |
| 1219 | */ |
| 1220 | if (!(ass & 0x8000)) |
| 1221 | return 1; |
| 1222 | /* |
| 1223 | * 10~8 : Jack location |
| 1224 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1225 | * 14~13: Resvered |
| 1226 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1227 | * when the external headphone out jack is plugged" |
| 1228 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1229 | if (!spec->autocfg.hp_pins[0]) { |
| 1230 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1231 | if (tmp == 0) |
| 1232 | spec->autocfg.hp_pins[0] = porta; |
| 1233 | else if (tmp == 1) |
| 1234 | spec->autocfg.hp_pins[0] = porte; |
| 1235 | else if (tmp == 2) |
| 1236 | spec->autocfg.hp_pins[0] = portd; |
| 1237 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1238 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1239 | } |
| 1240 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1241 | alc_init_auto_hp(codec); |
| 1242 | return 1; |
| 1243 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1244 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1245 | static void alc_ssid_check(struct hda_codec *codec, |
| 1246 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1247 | { |
| 1248 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1249 | struct alc_spec *spec = codec->spec; |
| 1250 | snd_printd("realtek: " |
| 1251 | "Enable default setup for auto mode as fallback\n"); |
| 1252 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1253 | alc_init_auto_hp(codec); |
| 1254 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1255 | } |
| 1256 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1257 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1258 | * Fix-up pin default configurations |
| 1259 | */ |
| 1260 | |
| 1261 | struct alc_pincfg { |
| 1262 | hda_nid_t nid; |
| 1263 | u32 val; |
| 1264 | }; |
| 1265 | |
| 1266 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1267 | const struct snd_pci_quirk *quirk, |
| 1268 | const struct alc_pincfg **pinfix) |
| 1269 | { |
| 1270 | const struct alc_pincfg *cfg; |
| 1271 | |
| 1272 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1273 | if (!quirk) |
| 1274 | return; |
| 1275 | |
| 1276 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1277 | for (; cfg->nid; cfg++) |
| 1278 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1279 | } |
| 1280 | |
| 1281 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1282 | * ALC888 |
| 1283 | */ |
| 1284 | |
| 1285 | /* |
| 1286 | * 2ch mode |
| 1287 | */ |
| 1288 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1289 | /* Mic-in jack as mic in */ |
| 1290 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1291 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1292 | /* Line-in jack as Line in */ |
| 1293 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1294 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1295 | /* Line-Out as Front */ |
| 1296 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1297 | { } /* end */ |
| 1298 | }; |
| 1299 | |
| 1300 | /* |
| 1301 | * 4ch mode |
| 1302 | */ |
| 1303 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1304 | /* Mic-in jack as mic in */ |
| 1305 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1306 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1307 | /* Line-in jack as Surround */ |
| 1308 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1309 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1310 | /* Line-Out as Front */ |
| 1311 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1312 | { } /* end */ |
| 1313 | }; |
| 1314 | |
| 1315 | /* |
| 1316 | * 6ch mode |
| 1317 | */ |
| 1318 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1319 | /* Mic-in jack as CLFE */ |
| 1320 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1321 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1322 | /* Line-in jack as Surround */ |
| 1323 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1324 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1325 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1326 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1327 | { } /* end */ |
| 1328 | }; |
| 1329 | |
| 1330 | /* |
| 1331 | * 8ch mode |
| 1332 | */ |
| 1333 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1334 | /* Mic-in jack as CLFE */ |
| 1335 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1336 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1337 | /* Line-in jack as Surround */ |
| 1338 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1339 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1340 | /* Line-Out as Side */ |
| 1341 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1342 | { } /* end */ |
| 1343 | }; |
| 1344 | |
| 1345 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1346 | { 2, alc888_4ST_ch2_intel_init }, |
| 1347 | { 4, alc888_4ST_ch4_intel_init }, |
| 1348 | { 6, alc888_4ST_ch6_intel_init }, |
| 1349 | { 8, alc888_4ST_ch8_intel_init }, |
| 1350 | }; |
| 1351 | |
| 1352 | /* |
| 1353 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1354 | */ |
| 1355 | |
| 1356 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1357 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1358 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1359 | /* Connect Internal HP to Front */ |
| 1360 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1361 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1362 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1363 | /* Connect Bass HP to Front */ |
| 1364 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1365 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1366 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1367 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1368 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1369 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1370 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1371 | /* Connect Mic jack to CLFE */ |
| 1372 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1373 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1374 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1375 | /* Connect Line-in jack to Surround */ |
| 1376 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1377 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1378 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1379 | /* Connect HP out jack to Front */ |
| 1380 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1381 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1382 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1383 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1384 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1385 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1386 | {} |
| 1387 | }; |
| 1388 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1389 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1390 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1391 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1392 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1393 | hda_nid_t nid; |
| 1394 | int i; |
| 1395 | |
| 1396 | spec->jack_present = 0; |
| 1397 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1398 | nid = spec->autocfg.hp_pins[i]; |
| 1399 | if (!nid) |
| 1400 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1401 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1402 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1403 | snd_hda_codec_read(codec, nid, 0, |
| 1404 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1405 | val = snd_hda_codec_read(codec, nid, 0, |
| 1406 | AC_VERB_GET_PIN_SENSE, 0); |
| 1407 | if (val & AC_PINSENSE_PRESENCE) { |
| 1408 | spec->jack_present = 1; |
| 1409 | break; |
| 1410 | } |
| 1411 | } |
| 1412 | |
| 1413 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1414 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1415 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1416 | nid = spec->autocfg.speaker_pins[i]; |
| 1417 | if (!nid) |
| 1418 | break; |
| 1419 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1420 | HDA_AMP_MUTE, mute); |
| 1421 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1422 | } |
| 1423 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1424 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1425 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1426 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1427 | if (codec->vendor_id == 0x10ec0880) |
| 1428 | res >>= 28; |
| 1429 | else |
| 1430 | res >>= 26; |
| 1431 | if (res == ALC880_HP_EVENT) |
| 1432 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1433 | } |
| 1434 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1435 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1436 | { |
| 1437 | struct alc_spec *spec = codec->spec; |
| 1438 | |
| 1439 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1440 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1441 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1442 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1443 | alc_automute_amp(codec); |
| 1444 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1445 | |
| 1446 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1447 | * ALC888 Acer Aspire 4930G model |
| 1448 | */ |
| 1449 | |
| 1450 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1451 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1452 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1453 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1454 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1455 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1456 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1457 | /* Connect Internal HP to front */ |
| 1458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1459 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1460 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1461 | /* Connect HP out to front */ |
| 1462 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1463 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1464 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1465 | { } |
| 1466 | }; |
| 1467 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1468 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1469 | * ALC888 Acer Aspire 6530G model |
| 1470 | */ |
| 1471 | |
| 1472 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1473 | /* Bias voltage on for external mic port */ |
| 1474 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1475 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1476 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1477 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1478 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1479 | /* Enable unsolicited event for HP jack */ |
| 1480 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1481 | /* Enable speaker output */ |
| 1482 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1483 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1484 | /* Enable headphone output */ |
| 1485 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1486 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1487 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1488 | { } |
| 1489 | }; |
| 1490 | |
| 1491 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1492 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1493 | */ |
| 1494 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1495 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1496 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1497 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1498 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1499 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1500 | /* Enable unsolicited event for HP jack */ |
| 1501 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1502 | /* Connect Internal Front to Front */ |
| 1503 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1504 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1505 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1506 | /* Connect Internal Rear to Rear */ |
| 1507 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1508 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1509 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1510 | /* Connect Internal CLFE to CLFE */ |
| 1511 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1512 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1513 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1514 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1515 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1516 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1517 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1518 | /* Enable all DACs */ |
| 1519 | /* DAC DISABLE/MUTE 1? */ |
| 1520 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1521 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1522 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1523 | /* DAC DISABLE/MUTE 2? */ |
| 1524 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1525 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1526 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1527 | /* Enable amplifiers */ |
| 1528 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1529 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1530 | /* DMIC fix |
| 1531 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1532 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1533 | * makes the signal become a difference/sum signal instead of standard |
| 1534 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1535 | * codec replicate the sum signal to both channels, turning it into a |
| 1536 | * normal mono mic. |
| 1537 | */ |
| 1538 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1539 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1540 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1541 | { } |
| 1542 | }; |
| 1543 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1544 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1545 | /* Front mic only available on one ADC */ |
| 1546 | { |
| 1547 | .num_items = 4, |
| 1548 | .items = { |
| 1549 | { "Mic", 0x0 }, |
| 1550 | { "Line", 0x2 }, |
| 1551 | { "CD", 0x4 }, |
| 1552 | { "Front Mic", 0xb }, |
| 1553 | }, |
| 1554 | }, |
| 1555 | { |
| 1556 | .num_items = 3, |
| 1557 | .items = { |
| 1558 | { "Mic", 0x0 }, |
| 1559 | { "Line", 0x2 }, |
| 1560 | { "CD", 0x4 }, |
| 1561 | }, |
| 1562 | } |
| 1563 | }; |
| 1564 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1565 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1566 | /* Interal mic only available on one ADC */ |
| 1567 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1568 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1569 | .items = { |
| 1570 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1571 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1572 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1573 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1574 | { "Int Mic", 0xb }, |
| 1575 | }, |
| 1576 | }, |
| 1577 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1578 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1579 | .items = { |
| 1580 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1581 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1582 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1583 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1584 | }, |
| 1585 | } |
| 1586 | }; |
| 1587 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1588 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1589 | /* Digital mic only available on first "ADC" */ |
| 1590 | { |
| 1591 | .num_items = 5, |
| 1592 | .items = { |
| 1593 | { "Mic", 0x0 }, |
| 1594 | { "Line", 0x2 }, |
| 1595 | { "CD", 0x4 }, |
| 1596 | { "Front Mic", 0xb }, |
| 1597 | { "Input Mix", 0xa }, |
| 1598 | }, |
| 1599 | }, |
| 1600 | { |
| 1601 | .num_items = 4, |
| 1602 | .items = { |
| 1603 | { "Mic", 0x0 }, |
| 1604 | { "Line", 0x2 }, |
| 1605 | { "CD", 0x4 }, |
| 1606 | { "Input Mix", 0xa }, |
| 1607 | }, |
| 1608 | }, |
| 1609 | { |
| 1610 | .num_items = 4, |
| 1611 | .items = { |
| 1612 | { "Mic", 0x0 }, |
| 1613 | { "Line", 0x2 }, |
| 1614 | { "CD", 0x4 }, |
| 1615 | { "Input Mix", 0xa }, |
| 1616 | }, |
| 1617 | } |
| 1618 | }; |
| 1619 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1620 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1621 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1622 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1623 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1624 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1625 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1626 | HDA_OUTPUT), |
| 1627 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1628 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1629 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1630 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1631 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1632 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1633 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1634 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1635 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1637 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1638 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1639 | { } /* end */ |
| 1640 | }; |
| 1641 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1642 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1643 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1644 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1645 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1646 | spec->autocfg.hp_pins[0] = 0x15; |
| 1647 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1648 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1649 | } |
| 1650 | |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1651 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) |
| 1652 | { |
| 1653 | struct alc_spec *spec = codec->spec; |
| 1654 | |
| 1655 | spec->autocfg.hp_pins[0] = 0x15; |
| 1656 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1657 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1658 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1659 | alc_automute_amp(codec); |
| 1660 | } |
| 1661 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1662 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1663 | { |
| 1664 | struct alc_spec *spec = codec->spec; |
| 1665 | |
| 1666 | spec->autocfg.hp_pins[0] = 0x15; |
| 1667 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1668 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1669 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1670 | alc_automute_amp(codec); |
| 1671 | } |
| 1672 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1673 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1674 | * ALC880 3-stack model |
| 1675 | * |
| 1676 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1677 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1678 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1679 | */ |
| 1680 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1681 | static hda_nid_t alc880_dac_nids[4] = { |
| 1682 | /* front, rear, clfe, rear_surr */ |
| 1683 | 0x02, 0x05, 0x04, 0x03 |
| 1684 | }; |
| 1685 | |
| 1686 | static hda_nid_t alc880_adc_nids[3] = { |
| 1687 | /* ADC0-2 */ |
| 1688 | 0x07, 0x08, 0x09, |
| 1689 | }; |
| 1690 | |
| 1691 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1692 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1693 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1694 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1695 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1696 | /* ADC1-2 */ |
| 1697 | 0x08, 0x09, |
| 1698 | }; |
| 1699 | |
| 1700 | #define ALC880_DIGOUT_NID 0x06 |
| 1701 | #define ALC880_DIGIN_NID 0x0a |
| 1702 | |
| 1703 | static struct hda_input_mux alc880_capture_source = { |
| 1704 | .num_items = 4, |
| 1705 | .items = { |
| 1706 | { "Mic", 0x0 }, |
| 1707 | { "Front Mic", 0x3 }, |
| 1708 | { "Line", 0x2 }, |
| 1709 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1710 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1711 | }; |
| 1712 | |
| 1713 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1714 | /* 2ch mode */ |
| 1715 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1716 | /* set line-in to input, mute it */ |
| 1717 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1718 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1719 | /* set mic-in to input vref 80%, mute it */ |
| 1720 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1721 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1722 | { } /* end */ |
| 1723 | }; |
| 1724 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1725 | /* 6ch mode */ |
| 1726 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1727 | /* set line-in to output, unmute it */ |
| 1728 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1729 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1730 | /* set mic-in to output, unmute it */ |
| 1731 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1732 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1733 | { } /* end */ |
| 1734 | }; |
| 1735 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1736 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1737 | { 2, alc880_threestack_ch2_init }, |
| 1738 | { 6, alc880_threestack_ch6_init }, |
| 1739 | }; |
| 1740 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1741 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1742 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1743 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1744 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1745 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1746 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1747 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1748 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1749 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1750 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1751 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1752 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1753 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1754 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1755 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1756 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1757 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1758 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1759 | { |
| 1760 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1761 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1762 | .info = alc_ch_mode_info, |
| 1763 | .get = alc_ch_mode_get, |
| 1764 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1765 | }, |
| 1766 | { } /* end */ |
| 1767 | }; |
| 1768 | |
| 1769 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1770 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1771 | struct snd_ctl_elem_info *uinfo) |
| 1772 | { |
| 1773 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1774 | struct alc_spec *spec = codec->spec; |
| 1775 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1776 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1777 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1778 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1779 | HDA_INPUT); |
| 1780 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1781 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1782 | return err; |
| 1783 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1784 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1785 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1786 | unsigned int size, unsigned int __user *tlv) |
| 1787 | { |
| 1788 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1789 | struct alc_spec *spec = codec->spec; |
| 1790 | int err; |
| 1791 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1792 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1793 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1794 | HDA_INPUT); |
| 1795 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1796 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1797 | return err; |
| 1798 | } |
| 1799 | |
| 1800 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1801 | struct snd_ctl_elem_value *ucontrol); |
| 1802 | |
| 1803 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1804 | struct snd_ctl_elem_value *ucontrol, |
| 1805 | getput_call_t func) |
| 1806 | { |
| 1807 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1808 | struct alc_spec *spec = codec->spec; |
| 1809 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1810 | int err; |
| 1811 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1812 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1813 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1814 | 3, 0, HDA_INPUT); |
| 1815 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1816 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1817 | return err; |
| 1818 | } |
| 1819 | |
| 1820 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1821 | struct snd_ctl_elem_value *ucontrol) |
| 1822 | { |
| 1823 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1824 | snd_hda_mixer_amp_volume_get); |
| 1825 | } |
| 1826 | |
| 1827 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1828 | struct snd_ctl_elem_value *ucontrol) |
| 1829 | { |
| 1830 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1831 | snd_hda_mixer_amp_volume_put); |
| 1832 | } |
| 1833 | |
| 1834 | /* capture mixer elements */ |
| 1835 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1836 | |
| 1837 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1838 | struct snd_ctl_elem_value *ucontrol) |
| 1839 | { |
| 1840 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1841 | snd_hda_mixer_amp_switch_get); |
| 1842 | } |
| 1843 | |
| 1844 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1845 | struct snd_ctl_elem_value *ucontrol) |
| 1846 | { |
| 1847 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1848 | snd_hda_mixer_amp_switch_put); |
| 1849 | } |
| 1850 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1851 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1852 | { \ |
| 1853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1854 | .name = "Capture Switch", \ |
| 1855 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1856 | .count = num, \ |
| 1857 | .info = alc_cap_sw_info, \ |
| 1858 | .get = alc_cap_sw_get, \ |
| 1859 | .put = alc_cap_sw_put, \ |
| 1860 | }, \ |
| 1861 | { \ |
| 1862 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1863 | .name = "Capture Volume", \ |
| 1864 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1865 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1866 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1867 | .count = num, \ |
| 1868 | .info = alc_cap_vol_info, \ |
| 1869 | .get = alc_cap_vol_get, \ |
| 1870 | .put = alc_cap_vol_put, \ |
| 1871 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1872 | } |
| 1873 | |
| 1874 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1875 | { \ |
| 1876 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1877 | /* .name = "Capture Source", */ \ |
| 1878 | .name = "Input Source", \ |
| 1879 | .count = num, \ |
| 1880 | .info = alc_mux_enum_info, \ |
| 1881 | .get = alc_mux_enum_get, \ |
| 1882 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1883 | } |
| 1884 | |
| 1885 | #define DEFINE_CAPMIX(num) \ |
| 1886 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1887 | _DEFINE_CAPMIX(num), \ |
| 1888 | _DEFINE_CAPSRC(num), \ |
| 1889 | { } /* end */ \ |
| 1890 | } |
| 1891 | |
| 1892 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1893 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1894 | _DEFINE_CAPMIX(num), \ |
| 1895 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1896 | } |
| 1897 | |
| 1898 | /* up to three ADCs */ |
| 1899 | DEFINE_CAPMIX(1); |
| 1900 | DEFINE_CAPMIX(2); |
| 1901 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1902 | DEFINE_CAPMIX_NOSRC(1); |
| 1903 | DEFINE_CAPMIX_NOSRC(2); |
| 1904 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1905 | |
| 1906 | /* |
| 1907 | * ALC880 5-stack model |
| 1908 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1909 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1910 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1911 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1912 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1913 | */ |
| 1914 | |
| 1915 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1916 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1917 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1918 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1919 | { } /* end */ |
| 1920 | }; |
| 1921 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1922 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1923 | /* 6ch mode */ |
| 1924 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1925 | /* set line-in to input, mute it */ |
| 1926 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1927 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1928 | { } /* end */ |
| 1929 | }; |
| 1930 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1931 | /* 8ch mode */ |
| 1932 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1933 | /* set line-in to output, unmute it */ |
| 1934 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1935 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1936 | { } /* end */ |
| 1937 | }; |
| 1938 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1939 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1940 | { 6, alc880_fivestack_ch6_init }, |
| 1941 | { 8, alc880_fivestack_ch8_init }, |
| 1942 | }; |
| 1943 | |
| 1944 | |
| 1945 | /* |
| 1946 | * ALC880 6-stack model |
| 1947 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1948 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1949 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1950 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1951 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1952 | */ |
| 1953 | |
| 1954 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1955 | /* front, rear, clfe, rear_surr */ |
| 1956 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1957 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1958 | |
| 1959 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1960 | .num_items = 4, |
| 1961 | .items = { |
| 1962 | { "Mic", 0x0 }, |
| 1963 | { "Front Mic", 0x1 }, |
| 1964 | { "Line", 0x2 }, |
| 1965 | { "CD", 0x4 }, |
| 1966 | }, |
| 1967 | }; |
| 1968 | |
| 1969 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1970 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1971 | { 8, NULL }, |
| 1972 | }; |
| 1973 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1974 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1975 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1976 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1977 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1978 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1979 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1980 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1981 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1982 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1983 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1984 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1985 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1986 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1987 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1988 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1991 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1992 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1993 | { |
| 1994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1995 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1996 | .info = alc_ch_mode_info, |
| 1997 | .get = alc_ch_mode_get, |
| 1998 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1999 | }, |
| 2000 | { } /* end */ |
| 2001 | }; |
| 2002 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2003 | |
| 2004 | /* |
| 2005 | * ALC880 W810 model |
| 2006 | * |
| 2007 | * W810 has rear IO for: |
| 2008 | * Front (DAC 02) |
| 2009 | * Surround (DAC 03) |
| 2010 | * Center/LFE (DAC 04) |
| 2011 | * Digital out (06) |
| 2012 | * |
| 2013 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2014 | * 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] | 2015 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2016 | * There is a variable resistor to control the speaker or headphone |
| 2017 | * volume. This is a hardware-only device without a software API. |
| 2018 | * |
| 2019 | * Plugging headphones in will disable the internal speakers. This is |
| 2020 | * implemented in hardware, not via the driver using jack sense. In |
| 2021 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2022 | * disable both the speakers and headphones. |
| 2023 | * |
| 2024 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2025 | * These may not do anything useful with this driver yet, because I |
| 2026 | * haven't setup any initialization verbs for these yet... |
| 2027 | */ |
| 2028 | |
| 2029 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2030 | /* front, rear/surround, clfe */ |
| 2031 | 0x02, 0x03, 0x04 |
| 2032 | }; |
| 2033 | |
| 2034 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2035 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2036 | { 6, NULL } |
| 2037 | }; |
| 2038 | |
| 2039 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2040 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2041 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2042 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2043 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2044 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2046 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2047 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2048 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2049 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2050 | { } /* end */ |
| 2051 | }; |
| 2052 | |
| 2053 | |
| 2054 | /* |
| 2055 | * Z710V model |
| 2056 | * |
| 2057 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2058 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2059 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2060 | */ |
| 2061 | |
| 2062 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2063 | 0x02 |
| 2064 | }; |
| 2065 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2066 | |
| 2067 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2068 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2069 | { 2, NULL } |
| 2070 | }; |
| 2071 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2072 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2073 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2074 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2075 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2076 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2077 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2078 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2081 | { } /* end */ |
| 2082 | }; |
| 2083 | |
| 2084 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2085 | /* |
| 2086 | * ALC880 F1734 model |
| 2087 | * |
| 2088 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2089 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2090 | */ |
| 2091 | |
| 2092 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2093 | 0x03 |
| 2094 | }; |
| 2095 | #define ALC880_F1734_HP_DAC 0x02 |
| 2096 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2097 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2098 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2099 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2100 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2101 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2103 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2105 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2106 | { } /* end */ |
| 2107 | }; |
| 2108 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2109 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2110 | .num_items = 2, |
| 2111 | .items = { |
| 2112 | { "Mic", 0x1 }, |
| 2113 | { "CD", 0x4 }, |
| 2114 | }, |
| 2115 | }; |
| 2116 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2117 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2118 | /* |
| 2119 | * ALC880 ASUS model |
| 2120 | * |
| 2121 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2122 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2123 | * Mic = 0x18, Line = 0x1a |
| 2124 | */ |
| 2125 | |
| 2126 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2127 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2128 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2129 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2130 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2131 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2132 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2133 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2134 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2135 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2136 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2137 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2138 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2139 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2140 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2141 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2142 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2144 | { |
| 2145 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2146 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2147 | .info = alc_ch_mode_info, |
| 2148 | .get = alc_ch_mode_get, |
| 2149 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2150 | }, |
| 2151 | { } /* end */ |
| 2152 | }; |
| 2153 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2154 | /* |
| 2155 | * ALC880 ASUS W1V model |
| 2156 | * |
| 2157 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2158 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2159 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2160 | */ |
| 2161 | |
| 2162 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2163 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2164 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2165 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2166 | { } /* end */ |
| 2167 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2168 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2169 | /* TCL S700 */ |
| 2170 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2171 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2172 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2173 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2174 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2175 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2176 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2177 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2178 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2179 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2180 | { } /* end */ |
| 2181 | }; |
| 2182 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2183 | /* Uniwill */ |
| 2184 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2185 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2186 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2187 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2188 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2189 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2190 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2191 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2192 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2193 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2194 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2195 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2196 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2197 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2198 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2201 | { |
| 2202 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2203 | .name = "Channel Mode", |
| 2204 | .info = alc_ch_mode_info, |
| 2205 | .get = alc_ch_mode_get, |
| 2206 | .put = alc_ch_mode_put, |
| 2207 | }, |
| 2208 | { } /* end */ |
| 2209 | }; |
| 2210 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2211 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2212 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2213 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2214 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2215 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2216 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2217 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2218 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2219 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2220 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2222 | { } /* end */ |
| 2223 | }; |
| 2224 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2225 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2226 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2227 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2228 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2229 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2232 | { } /* end */ |
| 2233 | }; |
| 2234 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2235 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2236 | * virtual master controls |
| 2237 | */ |
| 2238 | |
| 2239 | /* |
| 2240 | * slave controls for virtual master |
| 2241 | */ |
| 2242 | static const char *alc_slave_vols[] = { |
| 2243 | "Front Playback Volume", |
| 2244 | "Surround Playback Volume", |
| 2245 | "Center Playback Volume", |
| 2246 | "LFE Playback Volume", |
| 2247 | "Side Playback Volume", |
| 2248 | "Headphone Playback Volume", |
| 2249 | "Speaker Playback Volume", |
| 2250 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2251 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2252 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2253 | NULL, |
| 2254 | }; |
| 2255 | |
| 2256 | static const char *alc_slave_sws[] = { |
| 2257 | "Front Playback Switch", |
| 2258 | "Surround Playback Switch", |
| 2259 | "Center Playback Switch", |
| 2260 | "LFE Playback Switch", |
| 2261 | "Side Playback Switch", |
| 2262 | "Headphone Playback Switch", |
| 2263 | "Speaker Playback Switch", |
| 2264 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2265 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2266 | NULL, |
| 2267 | }; |
| 2268 | |
| 2269 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2270 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2271 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2272 | |
| 2273 | static void alc_free_kctls(struct hda_codec *codec); |
| 2274 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2275 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2276 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2277 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2278 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2279 | { } /* end */ |
| 2280 | }; |
| 2281 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2282 | static int alc_build_controls(struct hda_codec *codec) |
| 2283 | { |
| 2284 | struct alc_spec *spec = codec->spec; |
| 2285 | int err; |
| 2286 | int i; |
| 2287 | |
| 2288 | for (i = 0; i < spec->num_mixers; i++) { |
| 2289 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2290 | if (err < 0) |
| 2291 | return err; |
| 2292 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2293 | if (spec->cap_mixer) { |
| 2294 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2295 | if (err < 0) |
| 2296 | return err; |
| 2297 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2298 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2299 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2300 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2301 | if (err < 0) |
| 2302 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2303 | if (!spec->no_analog) { |
| 2304 | err = snd_hda_create_spdif_share_sw(codec, |
| 2305 | &spec->multiout); |
| 2306 | if (err < 0) |
| 2307 | return err; |
| 2308 | spec->multiout.share_spdif = 1; |
| 2309 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2310 | } |
| 2311 | if (spec->dig_in_nid) { |
| 2312 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2313 | if (err < 0) |
| 2314 | return err; |
| 2315 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2316 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2317 | /* create beep controls if needed */ |
| 2318 | if (spec->beep_amp) { |
| 2319 | struct snd_kcontrol_new *knew; |
| 2320 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2321 | struct snd_kcontrol *kctl; |
| 2322 | kctl = snd_ctl_new1(knew, codec); |
| 2323 | if (!kctl) |
| 2324 | return -ENOMEM; |
| 2325 | kctl->private_value = spec->beep_amp; |
| 2326 | err = snd_hda_ctl_add(codec, kctl); |
| 2327 | if (err < 0) |
| 2328 | return err; |
| 2329 | } |
| 2330 | } |
| 2331 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2332 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2333 | if (!spec->no_analog && |
| 2334 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2335 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2336 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2337 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2338 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2339 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2340 | if (err < 0) |
| 2341 | return err; |
| 2342 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2343 | if (!spec->no_analog && |
| 2344 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2345 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2346 | NULL, alc_slave_sws); |
| 2347 | if (err < 0) |
| 2348 | return err; |
| 2349 | } |
| 2350 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2351 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2352 | return 0; |
| 2353 | } |
| 2354 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2355 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | /* |
| 2357 | * initialize the codec volumes, etc |
| 2358 | */ |
| 2359 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2360 | /* |
| 2361 | * generic initialization of ADC, input mixers and output mixers |
| 2362 | */ |
| 2363 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2364 | /* |
| 2365 | * Unmute ADC0-2 and set the default input to mic-in |
| 2366 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2367 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2368 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2369 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2370 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2371 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2372 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2374 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2375 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2376 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2377 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2378 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2379 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2381 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2382 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2383 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2384 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2385 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2387 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2388 | /* |
| 2389 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2390 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2391 | /* set vol=0 to output mixers */ |
| 2392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2393 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2394 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2395 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2396 | /* set up input amps for analog loopback */ |
| 2397 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2398 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2399 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2400 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2401 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2402 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2403 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2404 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2405 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2406 | |
| 2407 | { } |
| 2408 | }; |
| 2409 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2410 | /* |
| 2411 | * 3-stack pin configuration: |
| 2412 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2413 | */ |
| 2414 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2415 | /* |
| 2416 | * preset connection lists of input pins |
| 2417 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2418 | */ |
| 2419 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2420 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2421 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2422 | |
| 2423 | /* |
| 2424 | * Set pin mode and muting |
| 2425 | */ |
| 2426 | /* set front pin widgets 0x14 for output */ |
| 2427 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2428 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2429 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2430 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2432 | /* Mic2 (as headphone out) for HP output */ |
| 2433 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2434 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2435 | /* Line In pin widget for input */ |
| 2436 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2437 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2438 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2439 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2440 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2441 | /* CD pin widget for input */ |
| 2442 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2443 | |
| 2444 | { } |
| 2445 | }; |
| 2446 | |
| 2447 | /* |
| 2448 | * 5-stack pin configuration: |
| 2449 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2450 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2451 | */ |
| 2452 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2453 | /* |
| 2454 | * preset connection lists of input pins |
| 2455 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2456 | */ |
| 2457 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2458 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2459 | |
| 2460 | /* |
| 2461 | * Set pin mode and muting |
| 2462 | */ |
| 2463 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2464 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2466 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2467 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2468 | /* unmute pins for output (no gain on this amp) */ |
| 2469 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2470 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2471 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2472 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2473 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2474 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2475 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2476 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2477 | /* Mic2 (as headphone out) for HP output */ |
| 2478 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2479 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2480 | /* Line In pin widget for input */ |
| 2481 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2482 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2483 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2484 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2485 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2486 | /* CD pin widget for input */ |
| 2487 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2488 | |
| 2489 | { } |
| 2490 | }; |
| 2491 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2492 | /* |
| 2493 | * W810 pin configuration: |
| 2494 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2495 | */ |
| 2496 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | /* hphone/speaker input selector: front DAC */ |
| 2498 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2499 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2500 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2502 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2503 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2504 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2505 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2506 | |
| 2507 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2508 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2509 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2510 | { } |
| 2511 | }; |
| 2512 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2513 | /* |
| 2514 | * Z71V pin configuration: |
| 2515 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2516 | */ |
| 2517 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2518 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2519 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2520 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2521 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2522 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2523 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2524 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2525 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2527 | |
| 2528 | { } |
| 2529 | }; |
| 2530 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2531 | /* |
| 2532 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2533 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2534 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2535 | */ |
| 2536 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2537 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2538 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2539 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2540 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2541 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2543 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2545 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2547 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2548 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2549 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2550 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2551 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2552 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2553 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2554 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2555 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2556 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2557 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2558 | { } |
| 2559 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2560 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2561 | /* |
| 2562 | * Uniwill pin configuration: |
| 2563 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2564 | * line = 0x1a |
| 2565 | */ |
| 2566 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2567 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2568 | |
| 2569 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2570 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2571 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2572 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2573 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2574 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2575 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2576 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2578 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2579 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2580 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2581 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2582 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2583 | |
| 2584 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2585 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2586 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2587 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2588 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2589 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2590 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2591 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2592 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2593 | |
| 2594 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2595 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2596 | |
| 2597 | { } |
| 2598 | }; |
| 2599 | |
| 2600 | /* |
| 2601 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2602 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2603 | */ |
| 2604 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2605 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2606 | |
| 2607 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2608 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2609 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2610 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2611 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2612 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2614 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2615 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2616 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2617 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2618 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2619 | |
| 2620 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2621 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2622 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2623 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2625 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2626 | |
| 2627 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2628 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2629 | |
| 2630 | { } |
| 2631 | }; |
| 2632 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2633 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2634 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2635 | { } |
| 2636 | }; |
| 2637 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2638 | /* auto-toggle front mic */ |
| 2639 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2640 | { |
| 2641 | unsigned int present; |
| 2642 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2643 | |
| 2644 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2645 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2646 | bits = present ? HDA_AMP_MUTE : 0; |
| 2647 | 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] | 2648 | } |
| 2649 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2650 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2651 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2652 | struct alc_spec *spec = codec->spec; |
| 2653 | |
| 2654 | spec->autocfg.hp_pins[0] = 0x14; |
| 2655 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2656 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2657 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2658 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2659 | } |
| 2660 | |
| 2661 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2662 | unsigned int res) |
| 2663 | { |
| 2664 | /* Looks like the unsol event is incompatible with the standard |
| 2665 | * definition. 4bit tag is placed at 28 bit! |
| 2666 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2667 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2668 | case ALC880_MIC_EVENT: |
| 2669 | alc880_uniwill_mic_automute(codec); |
| 2670 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2671 | default: |
| 2672 | alc_automute_amp_unsol_event(codec, res); |
| 2673 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2674 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2675 | } |
| 2676 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2677 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2678 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2679 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2680 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2681 | spec->autocfg.hp_pins[0] = 0x14; |
| 2682 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2683 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2684 | } |
| 2685 | |
| 2686 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2687 | { |
| 2688 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2689 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2690 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2691 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2692 | present &= HDA_AMP_VOLMASK; |
| 2693 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2694 | HDA_AMP_VOLMASK, present); |
| 2695 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2696 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2697 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2698 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2699 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2700 | unsigned int res) |
| 2701 | { |
| 2702 | /* Looks like the unsol event is incompatible with the standard |
| 2703 | * definition. 4bit tag is placed at 28 bit! |
| 2704 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2705 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2706 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2707 | else |
| 2708 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2709 | } |
| 2710 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2711 | /* |
| 2712 | * F1734 pin configuration: |
| 2713 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2714 | */ |
| 2715 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2716 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2717 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2718 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2719 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2720 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2721 | |
| 2722 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2723 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2724 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2725 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2726 | |
| 2727 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2728 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2729 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2730 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2731 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2732 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2733 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2734 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2735 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2736 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2737 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2738 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2739 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2740 | { } |
| 2741 | }; |
| 2742 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2743 | /* |
| 2744 | * ASUS pin configuration: |
| 2745 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2746 | */ |
| 2747 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2748 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2749 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2750 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2751 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2752 | |
| 2753 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2754 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2756 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2757 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2759 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2761 | |
| 2762 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2763 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2765 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2766 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2770 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2771 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2772 | { } |
| 2773 | }; |
| 2774 | |
| 2775 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2776 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2777 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2778 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2779 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2780 | /* Clevo m520g init */ |
| 2781 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2782 | /* headphone output */ |
| 2783 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2784 | /* line-out */ |
| 2785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2787 | /* Line-in */ |
| 2788 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2789 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2790 | /* CD */ |
| 2791 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2792 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2793 | /* Mic1 (rear panel) */ |
| 2794 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2795 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2796 | /* Mic2 (front panel) */ |
| 2797 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2798 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2799 | /* headphone */ |
| 2800 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2802 | /* change to EAPD mode */ |
| 2803 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2804 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2805 | |
| 2806 | { } |
| 2807 | }; |
| 2808 | |
| 2809 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2810 | /* change to EAPD mode */ |
| 2811 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2812 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2813 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2814 | /* Headphone output */ |
| 2815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2816 | /* Front output*/ |
| 2817 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2818 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2819 | |
| 2820 | /* Line In pin widget for input */ |
| 2821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2822 | /* CD pin widget for input */ |
| 2823 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2824 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2825 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2826 | |
| 2827 | /* change to EAPD mode */ |
| 2828 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2829 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2830 | |
| 2831 | { } |
| 2832 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2833 | |
| 2834 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2835 | * LG m1 express dual |
| 2836 | * |
| 2837 | * Pin assignment: |
| 2838 | * Rear Line-In/Out (blue): 0x14 |
| 2839 | * Build-in Mic-In: 0x15 |
| 2840 | * Speaker-out: 0x17 |
| 2841 | * HP-Out (green): 0x1b |
| 2842 | * Mic-In/Out (red): 0x19 |
| 2843 | * SPDIF-Out: 0x1e |
| 2844 | */ |
| 2845 | |
| 2846 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2847 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2848 | 0x05, 0x02, 0x03 |
| 2849 | }; |
| 2850 | |
| 2851 | /* seems analog CD is not working */ |
| 2852 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2853 | .num_items = 3, |
| 2854 | .items = { |
| 2855 | { "Mic", 0x1 }, |
| 2856 | { "Line", 0x5 }, |
| 2857 | { "Internal Mic", 0x6 }, |
| 2858 | }, |
| 2859 | }; |
| 2860 | |
| 2861 | /* 2,4,6 channel modes */ |
| 2862 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2863 | /* set line-in and mic-in to input */ |
| 2864 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2865 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2866 | { } |
| 2867 | }; |
| 2868 | |
| 2869 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2870 | /* set line-in to out and mic-in to input */ |
| 2871 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2872 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2873 | { } |
| 2874 | }; |
| 2875 | |
| 2876 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2877 | /* set line-in and mic-in to output */ |
| 2878 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2879 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2880 | { } |
| 2881 | }; |
| 2882 | |
| 2883 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2884 | { 2, alc880_lg_ch2_init }, |
| 2885 | { 4, alc880_lg_ch4_init }, |
| 2886 | { 6, alc880_lg_ch6_init }, |
| 2887 | }; |
| 2888 | |
| 2889 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2890 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2891 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2892 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2893 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2894 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2895 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2896 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2897 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2900 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2901 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2902 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2903 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2904 | { |
| 2905 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2906 | .name = "Channel Mode", |
| 2907 | .info = alc_ch_mode_info, |
| 2908 | .get = alc_ch_mode_get, |
| 2909 | .put = alc_ch_mode_put, |
| 2910 | }, |
| 2911 | { } /* end */ |
| 2912 | }; |
| 2913 | |
| 2914 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2915 | /* set capture source to mic-in */ |
| 2916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2917 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2918 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2919 | /* mute all amp mixer inputs */ |
| 2920 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2921 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2922 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2923 | /* line-in to input */ |
| 2924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2925 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2926 | /* built-in mic */ |
| 2927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2929 | /* speaker-out */ |
| 2930 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2931 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2932 | /* mic-in to input */ |
| 2933 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2935 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2936 | /* HP-out */ |
| 2937 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2939 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2940 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2941 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2942 | { } |
| 2943 | }; |
| 2944 | |
| 2945 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2946 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2947 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2948 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2949 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2950 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2951 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2952 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2953 | } |
| 2954 | |
| 2955 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2956 | * LG LW20 |
| 2957 | * |
| 2958 | * Pin assignment: |
| 2959 | * Speaker-out: 0x14 |
| 2960 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2961 | * Built-in Mic-In: 0x19 |
| 2962 | * Line-In: 0x1b |
| 2963 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2964 | * SPDIF-Out: 0x1e |
| 2965 | */ |
| 2966 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2967 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2968 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2969 | .items = { |
| 2970 | { "Mic", 0x0 }, |
| 2971 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2972 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2973 | }, |
| 2974 | }; |
| 2975 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2976 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2977 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2978 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2981 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2982 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2983 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2984 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2985 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2986 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2987 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2988 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2991 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2992 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2993 | { |
| 2994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2995 | .name = "Channel Mode", |
| 2996 | .info = alc_ch_mode_info, |
| 2997 | .get = alc_ch_mode_get, |
| 2998 | .put = alc_ch_mode_put, |
| 2999 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3000 | { } /* end */ |
| 3001 | }; |
| 3002 | |
| 3003 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3004 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3005 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3006 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3007 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3008 | /* set capture source to mic-in */ |
| 3009 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3010 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3013 | /* speaker-out */ |
| 3014 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3015 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3016 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3017 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3018 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3019 | /* mic-in to input */ |
| 3020 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3021 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3022 | /* built-in mic */ |
| 3023 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3024 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3025 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3026 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3027 | { } |
| 3028 | }; |
| 3029 | |
| 3030 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3031 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3032 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3033 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3034 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3035 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3036 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3037 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3038 | } |
| 3039 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3040 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3041 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3042 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3045 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3046 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3047 | { } /* end */ |
| 3048 | }; |
| 3049 | |
| 3050 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3051 | .num_items = 2, |
| 3052 | .items = { |
| 3053 | { "Mic", 0x0 }, |
| 3054 | { "Internal Mic", 0x1 }, |
| 3055 | }, |
| 3056 | }; |
| 3057 | |
| 3058 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3059 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3060 | |
| 3061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3063 | |
| 3064 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3066 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3067 | /* Mic2 (as headphone out) for HP output */ |
| 3068 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3069 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3070 | /* Internal Speaker */ |
| 3071 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3072 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3073 | |
| 3074 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3075 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3076 | |
| 3077 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3078 | { } |
| 3079 | }; |
| 3080 | |
| 3081 | /* toggle speaker-output according to the hp-jack state */ |
| 3082 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3083 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3084 | struct alc_spec *spec = codec->spec; |
| 3085 | alc_automute_amp(codec); |
| 3086 | /* toggle EAPD */ |
| 3087 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3088 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3089 | else |
| 3090 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3091 | } |
| 3092 | |
| 3093 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3094 | unsigned int res) |
| 3095 | { |
| 3096 | /* Looks like the unsol event is incompatible with the standard |
| 3097 | * definition. 4bit tag is placed at 28 bit! |
| 3098 | */ |
| 3099 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3100 | alc880_medion_rim_automute(codec); |
| 3101 | } |
| 3102 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3103 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3104 | { |
| 3105 | struct alc_spec *spec = codec->spec; |
| 3106 | |
| 3107 | spec->autocfg.hp_pins[0] = 0x14; |
| 3108 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3109 | alc880_medion_rim_automute(codec); |
| 3110 | } |
| 3111 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3112 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3113 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3114 | { 0x0b, HDA_INPUT, 0 }, |
| 3115 | { 0x0b, HDA_INPUT, 1 }, |
| 3116 | { 0x0b, HDA_INPUT, 2 }, |
| 3117 | { 0x0b, HDA_INPUT, 3 }, |
| 3118 | { 0x0b, HDA_INPUT, 4 }, |
| 3119 | { } /* end */ |
| 3120 | }; |
| 3121 | |
| 3122 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3123 | { 0x0b, HDA_INPUT, 1 }, |
| 3124 | { 0x0b, HDA_INPUT, 6 }, |
| 3125 | { 0x0b, HDA_INPUT, 7 }, |
| 3126 | { } /* end */ |
| 3127 | }; |
| 3128 | #endif |
| 3129 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3130 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3131 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3132 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3133 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3134 | static int alc_init(struct hda_codec *codec) |
| 3135 | { |
| 3136 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3137 | unsigned int i; |
| 3138 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3139 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3140 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3141 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3142 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3143 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3144 | |
| 3145 | if (spec->init_hook) |
| 3146 | spec->init_hook(codec); |
| 3147 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3148 | return 0; |
| 3149 | } |
| 3150 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3151 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3152 | { |
| 3153 | struct alc_spec *spec = codec->spec; |
| 3154 | |
| 3155 | if (spec->unsol_event) |
| 3156 | spec->unsol_event(codec, res); |
| 3157 | } |
| 3158 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3159 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3160 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3161 | { |
| 3162 | struct alc_spec *spec = codec->spec; |
| 3163 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3164 | } |
| 3165 | #endif |
| 3166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3167 | /* |
| 3168 | * Analog playback callbacks |
| 3169 | */ |
| 3170 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3171 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3172 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3173 | { |
| 3174 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3175 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3176 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3177 | } |
| 3178 | |
| 3179 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3180 | struct hda_codec *codec, |
| 3181 | unsigned int stream_tag, |
| 3182 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3183 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3184 | { |
| 3185 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3186 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3187 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3188 | } |
| 3189 | |
| 3190 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3191 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3192 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3193 | { |
| 3194 | struct alc_spec *spec = codec->spec; |
| 3195 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3196 | } |
| 3197 | |
| 3198 | /* |
| 3199 | * Digital out |
| 3200 | */ |
| 3201 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3202 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3203 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3204 | { |
| 3205 | struct alc_spec *spec = codec->spec; |
| 3206 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3207 | } |
| 3208 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3209 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3210 | struct hda_codec *codec, |
| 3211 | unsigned int stream_tag, |
| 3212 | unsigned int format, |
| 3213 | struct snd_pcm_substream *substream) |
| 3214 | { |
| 3215 | struct alc_spec *spec = codec->spec; |
| 3216 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3217 | stream_tag, format, substream); |
| 3218 | } |
| 3219 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3220 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3221 | struct hda_codec *codec, |
| 3222 | struct snd_pcm_substream *substream) |
| 3223 | { |
| 3224 | struct alc_spec *spec = codec->spec; |
| 3225 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3226 | } |
| 3227 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3228 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3229 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3230 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3231 | { |
| 3232 | struct alc_spec *spec = codec->spec; |
| 3233 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3234 | } |
| 3235 | |
| 3236 | /* |
| 3237 | * Analog capture |
| 3238 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3239 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3240 | struct hda_codec *codec, |
| 3241 | unsigned int stream_tag, |
| 3242 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3243 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3244 | { |
| 3245 | struct alc_spec *spec = codec->spec; |
| 3246 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3247 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3248 | stream_tag, 0, format); |
| 3249 | return 0; |
| 3250 | } |
| 3251 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3252 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3253 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3254 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3255 | { |
| 3256 | struct alc_spec *spec = codec->spec; |
| 3257 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3258 | snd_hda_codec_cleanup_stream(codec, |
| 3259 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3260 | return 0; |
| 3261 | } |
| 3262 | |
| 3263 | |
| 3264 | /* |
| 3265 | */ |
| 3266 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3267 | .substreams = 1, |
| 3268 | .channels_min = 2, |
| 3269 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3270 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3271 | .ops = { |
| 3272 | .open = alc880_playback_pcm_open, |
| 3273 | .prepare = alc880_playback_pcm_prepare, |
| 3274 | .cleanup = alc880_playback_pcm_cleanup |
| 3275 | }, |
| 3276 | }; |
| 3277 | |
| 3278 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3279 | .substreams = 1, |
| 3280 | .channels_min = 2, |
| 3281 | .channels_max = 2, |
| 3282 | /* NID is set in alc_build_pcms */ |
| 3283 | }; |
| 3284 | |
| 3285 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3286 | .substreams = 1, |
| 3287 | .channels_min = 2, |
| 3288 | .channels_max = 2, |
| 3289 | /* NID is set in alc_build_pcms */ |
| 3290 | }; |
| 3291 | |
| 3292 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3293 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3294 | .channels_min = 2, |
| 3295 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3296 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3297 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3298 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3299 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3300 | }, |
| 3301 | }; |
| 3302 | |
| 3303 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3304 | .substreams = 1, |
| 3305 | .channels_min = 2, |
| 3306 | .channels_max = 2, |
| 3307 | /* NID is set in alc_build_pcms */ |
| 3308 | .ops = { |
| 3309 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3310 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3311 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3312 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3313 | }, |
| 3314 | }; |
| 3315 | |
| 3316 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3317 | .substreams = 1, |
| 3318 | .channels_min = 2, |
| 3319 | .channels_max = 2, |
| 3320 | /* NID is set in alc_build_pcms */ |
| 3321 | }; |
| 3322 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3323 | /* 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] | 3324 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3325 | .substreams = 0, |
| 3326 | .channels_min = 0, |
| 3327 | .channels_max = 0, |
| 3328 | }; |
| 3329 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3330 | static int alc_build_pcms(struct hda_codec *codec) |
| 3331 | { |
| 3332 | struct alc_spec *spec = codec->spec; |
| 3333 | struct hda_pcm *info = spec->pcm_rec; |
| 3334 | int i; |
| 3335 | |
| 3336 | codec->num_pcms = 1; |
| 3337 | codec->pcm_info = info; |
| 3338 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3339 | if (spec->no_analog) |
| 3340 | goto skip_analog; |
| 3341 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3342 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3343 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3344 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3345 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3346 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3347 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3348 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3349 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3350 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3351 | } |
| 3352 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3353 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3354 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3355 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3356 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3357 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3358 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3359 | if (spec->channel_mode) { |
| 3360 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3361 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3362 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3363 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3364 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3365 | } |
| 3366 | } |
| 3367 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3368 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3369 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3370 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3371 | snprintf(spec->stream_name_digital, |
| 3372 | sizeof(spec->stream_name_digital), |
| 3373 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3374 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3375 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3376 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3377 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3378 | if (spec->dig_out_type) |
| 3379 | info->pcm_type = spec->dig_out_type; |
| 3380 | else |
| 3381 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3382 | if (spec->multiout.dig_out_nid && |
| 3383 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3384 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3385 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3386 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3387 | if (spec->dig_in_nid && |
| 3388 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3389 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3390 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3391 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3392 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3393 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3394 | } |
| 3395 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3396 | if (spec->no_analog) |
| 3397 | return 0; |
| 3398 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3399 | /* If the use of more than one ADC is requested for the current |
| 3400 | * model, configure a second analog capture-only PCM. |
| 3401 | */ |
| 3402 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3403 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3404 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3405 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3406 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3407 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3408 | if (spec->alt_dac_nid) { |
| 3409 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3410 | *spec->stream_analog_alt_playback; |
| 3411 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3412 | spec->alt_dac_nid; |
| 3413 | } else { |
| 3414 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3415 | alc_pcm_null_stream; |
| 3416 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3417 | } |
| 3418 | if (spec->num_adc_nids > 1) { |
| 3419 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3420 | *spec->stream_analog_alt_capture; |
| 3421 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3422 | spec->adc_nids[1]; |
| 3423 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3424 | spec->num_adc_nids - 1; |
| 3425 | } else { |
| 3426 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3427 | alc_pcm_null_stream; |
| 3428 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3429 | } |
| 3430 | } |
| 3431 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3432 | return 0; |
| 3433 | } |
| 3434 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3435 | static void alc_free_kctls(struct hda_codec *codec) |
| 3436 | { |
| 3437 | struct alc_spec *spec = codec->spec; |
| 3438 | |
| 3439 | if (spec->kctls.list) { |
| 3440 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3441 | int i; |
| 3442 | for (i = 0; i < spec->kctls.used; i++) |
| 3443 | kfree(kctl[i].name); |
| 3444 | } |
| 3445 | snd_array_free(&spec->kctls); |
| 3446 | } |
| 3447 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3448 | static void alc_free(struct hda_codec *codec) |
| 3449 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3450 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3451 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3452 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3453 | return; |
| 3454 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3455 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3456 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3457 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3458 | } |
| 3459 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3460 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3461 | static int alc_resume(struct hda_codec *codec) |
| 3462 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3463 | codec->patch_ops.init(codec); |
| 3464 | snd_hda_codec_resume_amp(codec); |
| 3465 | snd_hda_codec_resume_cache(codec); |
| 3466 | return 0; |
| 3467 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3468 | #endif |
| 3469 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3470 | /* |
| 3471 | */ |
| 3472 | static struct hda_codec_ops alc_patch_ops = { |
| 3473 | .build_controls = alc_build_controls, |
| 3474 | .build_pcms = alc_build_pcms, |
| 3475 | .init = alc_init, |
| 3476 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3477 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3478 | #ifdef SND_HDA_NEEDS_RESUME |
| 3479 | .resume = alc_resume, |
| 3480 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3481 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3482 | .check_power_status = alc_check_power_status, |
| 3483 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3484 | }; |
| 3485 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3486 | |
| 3487 | /* |
| 3488 | * Test configuration for debugging |
| 3489 | * |
| 3490 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3491 | * enum controls. |
| 3492 | */ |
| 3493 | #ifdef CONFIG_SND_DEBUG |
| 3494 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3495 | 0x02, 0x03, 0x04, 0x05 |
| 3496 | }; |
| 3497 | |
| 3498 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3499 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3500 | .items = { |
| 3501 | { "In-1", 0x0 }, |
| 3502 | { "In-2", 0x1 }, |
| 3503 | { "In-3", 0x2 }, |
| 3504 | { "In-4", 0x3 }, |
| 3505 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3506 | { "Front", 0x5 }, |
| 3507 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3508 | }, |
| 3509 | }; |
| 3510 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3511 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3512 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3513 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3514 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3515 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | }; |
| 3517 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3518 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3519 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3520 | { |
| 3521 | static char *texts[] = { |
| 3522 | "N/A", "Line Out", "HP Out", |
| 3523 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3524 | }; |
| 3525 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3526 | uinfo->count = 1; |
| 3527 | uinfo->value.enumerated.items = 8; |
| 3528 | if (uinfo->value.enumerated.item >= 8) |
| 3529 | uinfo->value.enumerated.item = 7; |
| 3530 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3531 | return 0; |
| 3532 | } |
| 3533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3534 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3535 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3536 | { |
| 3537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3538 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3539 | unsigned int pin_ctl, item = 0; |
| 3540 | |
| 3541 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3542 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3543 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3544 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3545 | item = 2; |
| 3546 | else |
| 3547 | item = 1; |
| 3548 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3549 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3550 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3551 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3552 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3553 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3554 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3555 | } |
| 3556 | } |
| 3557 | ucontrol->value.enumerated.item[0] = item; |
| 3558 | return 0; |
| 3559 | } |
| 3560 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3561 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3562 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3563 | { |
| 3564 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3565 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3566 | static unsigned int ctls[] = { |
| 3567 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3568 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3569 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3570 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3571 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3572 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3573 | }; |
| 3574 | unsigned int old_ctl, new_ctl; |
| 3575 | |
| 3576 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3577 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3578 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3579 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3580 | int val; |
| 3581 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3582 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3583 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3584 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3585 | HDA_AMP_MUTE : 0; |
| 3586 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3587 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3588 | return 1; |
| 3589 | } |
| 3590 | return 0; |
| 3591 | } |
| 3592 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3593 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3594 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3595 | { |
| 3596 | static char *texts[] = { |
| 3597 | "Front", "Surround", "CLFE", "Side" |
| 3598 | }; |
| 3599 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3600 | uinfo->count = 1; |
| 3601 | uinfo->value.enumerated.items = 4; |
| 3602 | if (uinfo->value.enumerated.item >= 4) |
| 3603 | uinfo->value.enumerated.item = 3; |
| 3604 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3605 | return 0; |
| 3606 | } |
| 3607 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3608 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3609 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3610 | { |
| 3611 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3612 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3613 | unsigned int sel; |
| 3614 | |
| 3615 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3616 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3617 | return 0; |
| 3618 | } |
| 3619 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3620 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3621 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3622 | { |
| 3623 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3624 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3625 | unsigned int sel; |
| 3626 | |
| 3627 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3628 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3629 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3630 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3631 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3632 | return 1; |
| 3633 | } |
| 3634 | return 0; |
| 3635 | } |
| 3636 | |
| 3637 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3638 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3639 | .name = xname, \ |
| 3640 | .info = alc_test_pin_ctl_info, \ |
| 3641 | .get = alc_test_pin_ctl_get, \ |
| 3642 | .put = alc_test_pin_ctl_put, \ |
| 3643 | .private_value = nid \ |
| 3644 | } |
| 3645 | |
| 3646 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3647 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3648 | .name = xname, \ |
| 3649 | .info = alc_test_pin_src_info, \ |
| 3650 | .get = alc_test_pin_src_get, \ |
| 3651 | .put = alc_test_pin_src_put, \ |
| 3652 | .private_value = nid \ |
| 3653 | } |
| 3654 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3655 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3656 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3657 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3658 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3659 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3660 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3661 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3662 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3663 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3664 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3665 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3666 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3667 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3668 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3669 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3670 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3671 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3672 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3673 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3674 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3675 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3676 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3677 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3678 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3679 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3680 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3681 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3682 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3683 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3684 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3685 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3686 | { |
| 3687 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3688 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3689 | .info = alc_ch_mode_info, |
| 3690 | .get = alc_ch_mode_get, |
| 3691 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3692 | }, |
| 3693 | { } /* end */ |
| 3694 | }; |
| 3695 | |
| 3696 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3697 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3698 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3699 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3700 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3701 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3702 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3703 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3704 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3705 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3706 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3708 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3709 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3710 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3711 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3712 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3713 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3714 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3715 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3716 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3717 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3718 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3719 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3720 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3721 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3722 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3723 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3724 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3725 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3726 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3727 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3728 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3729 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3730 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3731 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3732 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3733 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3734 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3735 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3736 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3737 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3738 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3739 | /* Analog input/passthru */ |
| 3740 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3745 | { } |
| 3746 | }; |
| 3747 | #endif |
| 3748 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3749 | /* |
| 3750 | */ |
| 3751 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3752 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3753 | [ALC880_3ST] = "3stack", |
| 3754 | [ALC880_TCL_S700] = "tcl", |
| 3755 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3756 | [ALC880_CLEVO] = "clevo", |
| 3757 | [ALC880_5ST] = "5stack", |
| 3758 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3759 | [ALC880_W810] = "w810", |
| 3760 | [ALC880_Z71V] = "z71v", |
| 3761 | [ALC880_6ST] = "6stack", |
| 3762 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3763 | [ALC880_ASUS] = "asus", |
| 3764 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3765 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3766 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3767 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3768 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3769 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3770 | [ALC880_F1734] = "F1734", |
| 3771 | [ALC880_LG] = "lg", |
| 3772 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3773 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3774 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3775 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3776 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3777 | [ALC880_AUTO] = "auto", |
| 3778 | }; |
| 3779 | |
| 3780 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3781 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3782 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3783 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3784 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3785 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3786 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3787 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3788 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3789 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3790 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3791 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3792 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3793 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3794 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3795 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3796 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3797 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3798 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3799 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3800 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3801 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3802 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3803 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3804 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3805 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3806 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3807 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3808 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3809 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3810 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3811 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3812 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3813 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3814 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3815 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3816 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3817 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3818 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3819 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3820 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3821 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3822 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3823 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3824 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3825 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3826 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3827 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3828 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3829 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3830 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3831 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3832 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3833 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3834 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3835 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3836 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3837 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3838 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3839 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3840 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3841 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3842 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3843 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3844 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3845 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3846 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3847 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3848 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3849 | /* default Intel */ |
| 3850 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3851 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3852 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3853 | {} |
| 3854 | }; |
| 3855 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3856 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3857 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3858 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3859 | static struct alc_config_preset alc880_presets[] = { |
| 3860 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3861 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3862 | .init_verbs = { alc880_volume_init_verbs, |
| 3863 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3864 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3865 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3866 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3867 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3868 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3869 | .input_mux = &alc880_capture_source, |
| 3870 | }, |
| 3871 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3872 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3873 | .init_verbs = { alc880_volume_init_verbs, |
| 3874 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3875 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3876 | .dac_nids = alc880_dac_nids, |
| 3877 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3878 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3879 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3880 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3881 | .input_mux = &alc880_capture_source, |
| 3882 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3883 | [ALC880_TCL_S700] = { |
| 3884 | .mixers = { alc880_tcl_s700_mixer }, |
| 3885 | .init_verbs = { alc880_volume_init_verbs, |
| 3886 | alc880_pin_tcl_S700_init_verbs, |
| 3887 | alc880_gpio2_init_verbs }, |
| 3888 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3889 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3890 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3891 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3892 | .hp_nid = 0x03, |
| 3893 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3894 | .channel_mode = alc880_2_jack_modes, |
| 3895 | .input_mux = &alc880_capture_source, |
| 3896 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3897 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3898 | .mixers = { alc880_three_stack_mixer, |
| 3899 | alc880_five_stack_mixer}, |
| 3900 | .init_verbs = { alc880_volume_init_verbs, |
| 3901 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3902 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3903 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3904 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3905 | .channel_mode = alc880_fivestack_modes, |
| 3906 | .input_mux = &alc880_capture_source, |
| 3907 | }, |
| 3908 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3909 | .mixers = { alc880_three_stack_mixer, |
| 3910 | alc880_five_stack_mixer }, |
| 3911 | .init_verbs = { alc880_volume_init_verbs, |
| 3912 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3913 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3914 | .dac_nids = alc880_dac_nids, |
| 3915 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3916 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3917 | .channel_mode = alc880_fivestack_modes, |
| 3918 | .input_mux = &alc880_capture_source, |
| 3919 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3920 | [ALC880_6ST] = { |
| 3921 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3922 | .init_verbs = { alc880_volume_init_verbs, |
| 3923 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3924 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3925 | .dac_nids = alc880_6st_dac_nids, |
| 3926 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3927 | .channel_mode = alc880_sixstack_modes, |
| 3928 | .input_mux = &alc880_6stack_capture_source, |
| 3929 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3930 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3931 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3932 | .init_verbs = { alc880_volume_init_verbs, |
| 3933 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3934 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3935 | .dac_nids = alc880_6st_dac_nids, |
| 3936 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3937 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3938 | .channel_mode = alc880_sixstack_modes, |
| 3939 | .input_mux = &alc880_6stack_capture_source, |
| 3940 | }, |
| 3941 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3942 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3943 | .init_verbs = { alc880_volume_init_verbs, |
| 3944 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3945 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3946 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3947 | .dac_nids = alc880_w810_dac_nids, |
| 3948 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3949 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3950 | .channel_mode = alc880_w810_modes, |
| 3951 | .input_mux = &alc880_capture_source, |
| 3952 | }, |
| 3953 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3954 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3955 | .init_verbs = { alc880_volume_init_verbs, |
| 3956 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3957 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3958 | .dac_nids = alc880_z71v_dac_nids, |
| 3959 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3960 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3961 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3962 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3963 | .input_mux = &alc880_capture_source, |
| 3964 | }, |
| 3965 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3966 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3967 | .init_verbs = { alc880_volume_init_verbs, |
| 3968 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3969 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3970 | .dac_nids = alc880_f1734_dac_nids, |
| 3971 | .hp_nid = 0x02, |
| 3972 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3973 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3974 | .input_mux = &alc880_f1734_capture_source, |
| 3975 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3976 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3977 | }, |
| 3978 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3979 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3980 | .init_verbs = { alc880_volume_init_verbs, |
| 3981 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3982 | alc880_gpio1_init_verbs }, |
| 3983 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3984 | .dac_nids = alc880_asus_dac_nids, |
| 3985 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3986 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3987 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3988 | .input_mux = &alc880_capture_source, |
| 3989 | }, |
| 3990 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3991 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3992 | .init_verbs = { alc880_volume_init_verbs, |
| 3993 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3994 | alc880_gpio1_init_verbs }, |
| 3995 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3996 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3997 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3998 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3999 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4000 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4001 | .input_mux = &alc880_capture_source, |
| 4002 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4003 | [ALC880_ASUS_DIG2] = { |
| 4004 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4005 | .init_verbs = { alc880_volume_init_verbs, |
| 4006 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4007 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4008 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4009 | .dac_nids = alc880_asus_dac_nids, |
| 4010 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4011 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4012 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4013 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4014 | .input_mux = &alc880_capture_source, |
| 4015 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4016 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4017 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4018 | .init_verbs = { alc880_volume_init_verbs, |
| 4019 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4020 | alc880_gpio1_init_verbs }, |
| 4021 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4022 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4023 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4024 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4025 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4026 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4027 | .input_mux = &alc880_capture_source, |
| 4028 | }, |
| 4029 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4030 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4031 | .init_verbs = { alc880_volume_init_verbs, |
| 4032 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4033 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4034 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4035 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4036 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4037 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4038 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4039 | .input_mux = &alc880_capture_source, |
| 4040 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4041 | [ALC880_UNIWILL] = { |
| 4042 | .mixers = { alc880_uniwill_mixer }, |
| 4043 | .init_verbs = { alc880_volume_init_verbs, |
| 4044 | alc880_uniwill_init_verbs }, |
| 4045 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4046 | .dac_nids = alc880_asus_dac_nids, |
| 4047 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4048 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4049 | .channel_mode = alc880_threestack_modes, |
| 4050 | .need_dac_fix = 1, |
| 4051 | .input_mux = &alc880_capture_source, |
| 4052 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4053 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4054 | }, |
| 4055 | [ALC880_UNIWILL_P53] = { |
| 4056 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4057 | .init_verbs = { alc880_volume_init_verbs, |
| 4058 | alc880_uniwill_p53_init_verbs }, |
| 4059 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4060 | .dac_nids = alc880_asus_dac_nids, |
| 4061 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4062 | .channel_mode = alc880_threestack_modes, |
| 4063 | .input_mux = &alc880_capture_source, |
| 4064 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4065 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4066 | }, |
| 4067 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4068 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4069 | .init_verbs = { alc880_volume_init_verbs, |
| 4070 | alc880_uniwill_p53_init_verbs, |
| 4071 | alc880_beep_init_verbs }, |
| 4072 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4073 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4074 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4075 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4076 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4077 | .input_mux = &alc880_capture_source, |
| 4078 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4079 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4080 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4081 | [ALC880_CLEVO] = { |
| 4082 | .mixers = { alc880_three_stack_mixer }, |
| 4083 | .init_verbs = { alc880_volume_init_verbs, |
| 4084 | alc880_pin_clevo_init_verbs }, |
| 4085 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4086 | .dac_nids = alc880_dac_nids, |
| 4087 | .hp_nid = 0x03, |
| 4088 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4089 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4090 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4091 | .input_mux = &alc880_capture_source, |
| 4092 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4093 | [ALC880_LG] = { |
| 4094 | .mixers = { alc880_lg_mixer }, |
| 4095 | .init_verbs = { alc880_volume_init_verbs, |
| 4096 | alc880_lg_init_verbs }, |
| 4097 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4098 | .dac_nids = alc880_lg_dac_nids, |
| 4099 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4100 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4101 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4102 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4103 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4104 | .unsol_event = alc_automute_amp_unsol_event, |
| 4105 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4106 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4107 | .loopbacks = alc880_lg_loopbacks, |
| 4108 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4109 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4110 | [ALC880_LG_LW] = { |
| 4111 | .mixers = { alc880_lg_lw_mixer }, |
| 4112 | .init_verbs = { alc880_volume_init_verbs, |
| 4113 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4114 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4115 | .dac_nids = alc880_dac_nids, |
| 4116 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4117 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4118 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4119 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4120 | .unsol_event = alc_automute_amp_unsol_event, |
| 4121 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4122 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4123 | [ALC880_MEDION_RIM] = { |
| 4124 | .mixers = { alc880_medion_rim_mixer }, |
| 4125 | .init_verbs = { alc880_volume_init_verbs, |
| 4126 | alc880_medion_rim_init_verbs, |
| 4127 | alc_gpio2_init_verbs }, |
| 4128 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4129 | .dac_nids = alc880_dac_nids, |
| 4130 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4131 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4132 | .channel_mode = alc880_2_jack_modes, |
| 4133 | .input_mux = &alc880_medion_rim_capture_source, |
| 4134 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4135 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4136 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4137 | #ifdef CONFIG_SND_DEBUG |
| 4138 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4139 | .mixers = { alc880_test_mixer }, |
| 4140 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4142 | .dac_nids = alc880_test_dac_nids, |
| 4143 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4144 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4145 | .channel_mode = alc880_test_modes, |
| 4146 | .input_mux = &alc880_test_capture_source, |
| 4147 | }, |
| 4148 | #endif |
| 4149 | }; |
| 4150 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4151 | /* |
| 4152 | * Automatic parse of I/O pins from the BIOS configuration |
| 4153 | */ |
| 4154 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | enum { |
| 4156 | ALC_CTL_WIDGET_VOL, |
| 4157 | ALC_CTL_WIDGET_MUTE, |
| 4158 | ALC_CTL_BIND_MUTE, |
| 4159 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4160 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4161 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4162 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4163 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4164 | }; |
| 4165 | |
| 4166 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4167 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4168 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4169 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4170 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4171 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4172 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4173 | knew = snd_array_new(&spec->kctls); |
| 4174 | if (!knew) |
| 4175 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4176 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4177 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4178 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4179 | return -ENOMEM; |
| 4180 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4181 | return 0; |
| 4182 | } |
| 4183 | |
| 4184 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4185 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4186 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4187 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4188 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4189 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4190 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4191 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4192 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4193 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4194 | #define ALC880_PIN_CD_NID 0x1c |
| 4195 | |
| 4196 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4197 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4198 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4199 | { |
| 4200 | hda_nid_t nid; |
| 4201 | int assigned[4]; |
| 4202 | int i, j; |
| 4203 | |
| 4204 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4205 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4206 | |
| 4207 | /* check the pins hardwired to audio widget */ |
| 4208 | for (i = 0; i < cfg->line_outs; i++) { |
| 4209 | nid = cfg->line_out_pins[i]; |
| 4210 | if (alc880_is_fixed_pin(nid)) { |
| 4211 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4212 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4213 | assigned[idx] = 1; |
| 4214 | } |
| 4215 | } |
| 4216 | /* left pins can be connect to any audio widget */ |
| 4217 | for (i = 0; i < cfg->line_outs; i++) { |
| 4218 | nid = cfg->line_out_pins[i]; |
| 4219 | if (alc880_is_fixed_pin(nid)) |
| 4220 | continue; |
| 4221 | /* search for an empty channel */ |
| 4222 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4223 | if (!assigned[j]) { |
| 4224 | spec->multiout.dac_nids[i] = |
| 4225 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4226 | assigned[j] = 1; |
| 4227 | break; |
| 4228 | } |
| 4229 | } |
| 4230 | } |
| 4231 | spec->multiout.num_dacs = cfg->line_outs; |
| 4232 | return 0; |
| 4233 | } |
| 4234 | |
| 4235 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4236 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4237 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4238 | { |
| 4239 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4240 | static const char *chname[4] = { |
| 4241 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4242 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4243 | hda_nid_t nid; |
| 4244 | int i, err; |
| 4245 | |
| 4246 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4247 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4248 | continue; |
| 4249 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4250 | if (i == 2) { |
| 4251 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4252 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4253 | "Center Playback Volume", |
| 4254 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4255 | HDA_OUTPUT)); |
| 4256 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4257 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4258 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4259 | "LFE Playback Volume", |
| 4260 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4261 | HDA_OUTPUT)); |
| 4262 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4263 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4264 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4265 | "Center Playback Switch", |
| 4266 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4267 | HDA_INPUT)); |
| 4268 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4269 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4270 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4271 | "LFE Playback Switch", |
| 4272 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4273 | HDA_INPUT)); |
| 4274 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4275 | return err; |
| 4276 | } else { |
| 4277 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4278 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4279 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4280 | HDA_OUTPUT)); |
| 4281 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4282 | return err; |
| 4283 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4284 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4285 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4286 | HDA_INPUT)); |
| 4287 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4288 | return err; |
| 4289 | } |
| 4290 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4291 | return 0; |
| 4292 | } |
| 4293 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4294 | /* add playback controls for speaker and HP outputs */ |
| 4295 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4296 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4297 | { |
| 4298 | hda_nid_t nid; |
| 4299 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4300 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4301 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4302 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4303 | return 0; |
| 4304 | |
| 4305 | if (alc880_is_fixed_pin(pin)) { |
| 4306 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4307 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4308 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4309 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4310 | else |
| 4311 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4312 | /* control HP volume/switch on the output mixer amp */ |
| 4313 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4314 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4315 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4316 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4317 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4318 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4319 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4320 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4321 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4322 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4323 | return err; |
| 4324 | } else if (alc880_is_multi_pin(pin)) { |
| 4325 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4326 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4327 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4328 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4329 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4330 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4331 | return err; |
| 4332 | } |
| 4333 | return 0; |
| 4334 | } |
| 4335 | |
| 4336 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4337 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4338 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4339 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4340 | { |
| 4341 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4342 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4343 | |
| 4344 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4345 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4346 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4347 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4348 | return err; |
| 4349 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4350 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4351 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4352 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | return err; |
| 4354 | return 0; |
| 4355 | } |
| 4356 | |
| 4357 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4358 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4359 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4360 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4361 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4363 | |
| 4364 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4365 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4366 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4367 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4368 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4369 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4370 | if (err < 0) |
| 4371 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4372 | imux->items[imux->num_items].label = |
| 4373 | auto_pin_cfg_labels[i]; |
| 4374 | imux->items[imux->num_items].index = |
| 4375 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4376 | imux->num_items++; |
| 4377 | } |
| 4378 | } |
| 4379 | return 0; |
| 4380 | } |
| 4381 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4382 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4383 | unsigned int pin_type) |
| 4384 | { |
| 4385 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4386 | pin_type); |
| 4387 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4388 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4389 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4390 | } |
| 4391 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4392 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4393 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4394 | int dac_idx) |
| 4395 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4396 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4397 | /* need the manual connection? */ |
| 4398 | if (alc880_is_multi_pin(nid)) { |
| 4399 | struct alc_spec *spec = codec->spec; |
| 4400 | int idx = alc880_multi_pin_idx(nid); |
| 4401 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4402 | AC_VERB_SET_CONNECT_SEL, |
| 4403 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4404 | } |
| 4405 | } |
| 4406 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4407 | static int get_pin_type(int line_out_type) |
| 4408 | { |
| 4409 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4410 | return PIN_HP; |
| 4411 | else |
| 4412 | return PIN_OUT; |
| 4413 | } |
| 4414 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4415 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4416 | { |
| 4417 | struct alc_spec *spec = codec->spec; |
| 4418 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4419 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4420 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4421 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4422 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4423 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4424 | } |
| 4425 | } |
| 4426 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4427 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4428 | { |
| 4429 | struct alc_spec *spec = codec->spec; |
| 4430 | hda_nid_t pin; |
| 4431 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4432 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4433 | if (pin) /* connect to front */ |
| 4434 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4435 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4436 | if (pin) /* connect to front */ |
| 4437 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4438 | } |
| 4439 | |
| 4440 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4441 | { |
| 4442 | struct alc_spec *spec = codec->spec; |
| 4443 | int i; |
| 4444 | |
| 4445 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4446 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4447 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4448 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4449 | if (nid != ALC880_PIN_CD_NID && |
| 4450 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4451 | snd_hda_codec_write(codec, nid, 0, |
| 4452 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4453 | AMP_OUT_MUTE); |
| 4454 | } |
| 4455 | } |
| 4456 | } |
| 4457 | |
| 4458 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4459 | /* return 1 if successful, 0 if the proper config is not found, |
| 4460 | * or a negative error code |
| 4461 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4462 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4463 | { |
| 4464 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4465 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4466 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4467 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4468 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4469 | alc880_ignore); |
| 4470 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4471 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4472 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4473 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4474 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4475 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4476 | if (err < 0) |
| 4477 | return err; |
| 4478 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4479 | if (err < 0) |
| 4480 | return err; |
| 4481 | err = alc880_auto_create_extra_out(spec, |
| 4482 | spec->autocfg.speaker_pins[0], |
| 4483 | "Speaker"); |
| 4484 | if (err < 0) |
| 4485 | return err; |
| 4486 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4487 | "Headphone"); |
| 4488 | if (err < 0) |
| 4489 | return err; |
| 4490 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4491 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4492 | return err; |
| 4493 | |
| 4494 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4495 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4496 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4497 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4498 | hda_nid_t dig_nid; |
| 4499 | err = snd_hda_get_connections(codec, |
| 4500 | spec->autocfg.dig_out_pins[i], |
| 4501 | &dig_nid, 1); |
| 4502 | if (err < 0) |
| 4503 | continue; |
| 4504 | if (!i) |
| 4505 | spec->multiout.dig_out_nid = dig_nid; |
| 4506 | else { |
| 4507 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4508 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4509 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4510 | break; |
| 4511 | } |
| 4512 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4513 | if (spec->autocfg.dig_in_pin) |
| 4514 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4515 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4516 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4517 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4518 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4519 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4520 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4521 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4522 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4523 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4524 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4525 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4526 | return 1; |
| 4527 | } |
| 4528 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4529 | /* additional initialization for auto-configuration model */ |
| 4530 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4531 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4532 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4533 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4534 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4535 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4536 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4537 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4538 | } |
| 4539 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4540 | static void set_capture_mixer(struct alc_spec *spec) |
| 4541 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4542 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4543 | { alc_capture_mixer_nosrc1, |
| 4544 | alc_capture_mixer_nosrc2, |
| 4545 | alc_capture_mixer_nosrc3 }, |
| 4546 | { alc_capture_mixer1, |
| 4547 | alc_capture_mixer2, |
| 4548 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4549 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4550 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4551 | int mux; |
| 4552 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4553 | mux = 1; |
| 4554 | else |
| 4555 | mux = 0; |
| 4556 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4557 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4558 | } |
| 4559 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4560 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4561 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4562 | |
| 4563 | /* |
| 4564 | * OK, here we have finally the patch for ALC880 |
| 4565 | */ |
| 4566 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4567 | static int patch_alc880(struct hda_codec *codec) |
| 4568 | { |
| 4569 | struct alc_spec *spec; |
| 4570 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4571 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4572 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4573 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4574 | if (spec == NULL) |
| 4575 | return -ENOMEM; |
| 4576 | |
| 4577 | codec->spec = spec; |
| 4578 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4579 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4580 | alc880_models, |
| 4581 | alc880_cfg_tbl); |
| 4582 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 4583 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 4584 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4585 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4586 | } |
| 4587 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4588 | if (board_config == ALC880_AUTO) { |
| 4589 | /* automatic parse from the BIOS config */ |
| 4590 | err = alc880_parse_auto_config(codec); |
| 4591 | if (err < 0) { |
| 4592 | alc_free(codec); |
| 4593 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4594 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4595 | printk(KERN_INFO |
| 4596 | "hda_codec: Cannot set up configuration " |
| 4597 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4598 | board_config = ALC880_3ST; |
| 4599 | } |
| 4600 | } |
| 4601 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4602 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4603 | if (err < 0) { |
| 4604 | alc_free(codec); |
| 4605 | return err; |
| 4606 | } |
| 4607 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4608 | if (board_config != ALC880_AUTO) |
| 4609 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4610 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4611 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4612 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4613 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
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_digital_playback = &alc880_pcm_digital_playback; |
| 4616 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4617 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4618 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4619 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4620 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4621 | /* get type */ |
| 4622 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4623 | if (wcap != AC_WID_AUD_IN) { |
| 4624 | spec->adc_nids = alc880_adc_nids_alt; |
| 4625 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4626 | } else { |
| 4627 | spec->adc_nids = alc880_adc_nids; |
| 4628 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4629 | } |
| 4630 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4631 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4632 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4633 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4634 | spec->vmaster_nid = 0x0c; |
| 4635 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4636 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4637 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4638 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4639 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4640 | if (!spec->loopback.amplist) |
| 4641 | spec->loopback.amplist = alc880_loopbacks; |
| 4642 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4643 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4644 | |
| 4645 | return 0; |
| 4646 | } |
| 4647 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4648 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4649 | /* |
| 4650 | * ALC260 support |
| 4651 | */ |
| 4652 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4653 | static hda_nid_t alc260_dac_nids[1] = { |
| 4654 | /* front */ |
| 4655 | 0x02, |
| 4656 | }; |
| 4657 | |
| 4658 | static hda_nid_t alc260_adc_nids[1] = { |
| 4659 | /* ADC0 */ |
| 4660 | 0x04, |
| 4661 | }; |
| 4662 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4663 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4664 | /* ADC1 */ |
| 4665 | 0x05, |
| 4666 | }; |
| 4667 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4668 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4669 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4670 | */ |
| 4671 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4672 | /* ADC0, ADC1 */ |
| 4673 | 0x04, 0x05 |
| 4674 | }; |
| 4675 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4676 | #define ALC260_DIGOUT_NID 0x03 |
| 4677 | #define ALC260_DIGIN_NID 0x06 |
| 4678 | |
| 4679 | static struct hda_input_mux alc260_capture_source = { |
| 4680 | .num_items = 4, |
| 4681 | .items = { |
| 4682 | { "Mic", 0x0 }, |
| 4683 | { "Front Mic", 0x1 }, |
| 4684 | { "Line", 0x2 }, |
| 4685 | { "CD", 0x4 }, |
| 4686 | }, |
| 4687 | }; |
| 4688 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4689 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4690 | * headphone jack and the internal CD lines since these are the only pins at |
| 4691 | * which audio can appear. For flexibility, also allow the option of |
| 4692 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4693 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4694 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4695 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4696 | { |
| 4697 | .num_items = 3, |
| 4698 | .items = { |
| 4699 | { "Mic/Line", 0x0 }, |
| 4700 | { "CD", 0x4 }, |
| 4701 | { "Headphone", 0x2 }, |
| 4702 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4703 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4704 | { |
| 4705 | .num_items = 4, |
| 4706 | .items = { |
| 4707 | { "Mic/Line", 0x0 }, |
| 4708 | { "CD", 0x4 }, |
| 4709 | { "Headphone", 0x2 }, |
| 4710 | { "Mixer", 0x5 }, |
| 4711 | }, |
| 4712 | }, |
| 4713 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4714 | }; |
| 4715 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4716 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4717 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4718 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4719 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4720 | { |
| 4721 | .num_items = 4, |
| 4722 | .items = { |
| 4723 | { "Mic", 0x0 }, |
| 4724 | { "Line", 0x2 }, |
| 4725 | { "CD", 0x4 }, |
| 4726 | { "Headphone", 0x5 }, |
| 4727 | }, |
| 4728 | }, |
| 4729 | { |
| 4730 | .num_items = 5, |
| 4731 | .items = { |
| 4732 | { "Mic", 0x0 }, |
| 4733 | { "Line", 0x2 }, |
| 4734 | { "CD", 0x4 }, |
| 4735 | { "Headphone", 0x6 }, |
| 4736 | { "Mixer", 0x5 }, |
| 4737 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4738 | }, |
| 4739 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4740 | |
| 4741 | /* Maxdata Favorit 100XS */ |
| 4742 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4743 | { |
| 4744 | .num_items = 2, |
| 4745 | .items = { |
| 4746 | { "Line/Mic", 0x0 }, |
| 4747 | { "CD", 0x4 }, |
| 4748 | }, |
| 4749 | }, |
| 4750 | { |
| 4751 | .num_items = 3, |
| 4752 | .items = { |
| 4753 | { "Line/Mic", 0x0 }, |
| 4754 | { "CD", 0x4 }, |
| 4755 | { "Mixer", 0x5 }, |
| 4756 | }, |
| 4757 | }, |
| 4758 | }; |
| 4759 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4760 | /* |
| 4761 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4762 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4763 | * element which allows changing the channel mode, so the verb list is |
| 4764 | * never used. |
| 4765 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4766 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4767 | { 2, NULL }, |
| 4768 | }; |
| 4769 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4770 | |
| 4771 | /* Mixer combinations |
| 4772 | * |
| 4773 | * basic: base_output + input + pc_beep + capture |
| 4774 | * HP: base_output + input + capture_alt |
| 4775 | * HP_3013: hp_3013 + input + capture |
| 4776 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4777 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4778 | */ |
| 4779 | |
| 4780 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4781 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4782 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4783 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4784 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4785 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4786 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4787 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4788 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4789 | |
| 4790 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4791 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4792 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4793 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4794 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4795 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4797 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4798 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4799 | { } /* end */ |
| 4800 | }; |
| 4801 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4802 | /* update HP, line and mono out pins according to the master switch */ |
| 4803 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4804 | hda_nid_t hp, hda_nid_t line, |
| 4805 | hda_nid_t mono) |
| 4806 | { |
| 4807 | struct alc_spec *spec = codec->spec; |
| 4808 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4809 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4810 | 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] | 4811 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4812 | 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] | 4813 | val); |
| 4814 | /* mono (speaker) depending on the HP jack sense */ |
| 4815 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4816 | 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] | 4817 | val); |
| 4818 | } |
| 4819 | |
| 4820 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4821 | struct snd_ctl_elem_value *ucontrol) |
| 4822 | { |
| 4823 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4824 | struct alc_spec *spec = codec->spec; |
| 4825 | *ucontrol->value.integer.value = spec->master_sw; |
| 4826 | return 0; |
| 4827 | } |
| 4828 | |
| 4829 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4830 | struct snd_ctl_elem_value *ucontrol) |
| 4831 | { |
| 4832 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4833 | struct alc_spec *spec = codec->spec; |
| 4834 | int val = !!*ucontrol->value.integer.value; |
| 4835 | hda_nid_t hp, line, mono; |
| 4836 | |
| 4837 | if (val == spec->master_sw) |
| 4838 | return 0; |
| 4839 | spec->master_sw = val; |
| 4840 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4841 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4842 | mono = kcontrol->private_value & 0xff; |
| 4843 | alc260_hp_master_update(codec, hp, line, mono); |
| 4844 | return 1; |
| 4845 | } |
| 4846 | |
| 4847 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4848 | { |
| 4849 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4850 | .name = "Master Playback Switch", |
| 4851 | .info = snd_ctl_boolean_mono_info, |
| 4852 | .get = alc260_hp_master_sw_get, |
| 4853 | .put = alc260_hp_master_sw_put, |
| 4854 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4855 | }, |
| 4856 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4857 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4858 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4859 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4860 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4861 | HDA_OUTPUT), |
| 4862 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4863 | { } /* end */ |
| 4864 | }; |
| 4865 | |
| 4866 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4867 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4868 | {}, |
| 4869 | }; |
| 4870 | |
| 4871 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4872 | { |
| 4873 | struct alc_spec *spec = codec->spec; |
| 4874 | unsigned int present; |
| 4875 | |
| 4876 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4877 | AC_VERB_GET_PIN_SENSE, 0); |
| 4878 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4879 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4880 | } |
| 4881 | |
| 4882 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4883 | { |
| 4884 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4885 | alc260_hp_automute(codec); |
| 4886 | } |
| 4887 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4888 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4889 | { |
| 4890 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4891 | .name = "Master Playback Switch", |
| 4892 | .info = snd_ctl_boolean_mono_info, |
| 4893 | .get = alc260_hp_master_sw_get, |
| 4894 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4895 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4896 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4897 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4898 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4899 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4900 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4901 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4902 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4903 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4904 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4905 | { } /* end */ |
| 4906 | }; |
| 4907 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4908 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4909 | .ops = &snd_hda_bind_vol, |
| 4910 | .values = { |
| 4911 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4912 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4913 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4914 | 0 |
| 4915 | }, |
| 4916 | }; |
| 4917 | |
| 4918 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4919 | .ops = &snd_hda_bind_sw, |
| 4920 | .values = { |
| 4921 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4922 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4923 | 0 |
| 4924 | }, |
| 4925 | }; |
| 4926 | |
| 4927 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4928 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4929 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4930 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4931 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4932 | { } /* end */ |
| 4933 | }; |
| 4934 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4935 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4936 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4937 | {}, |
| 4938 | }; |
| 4939 | |
| 4940 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4941 | { |
| 4942 | struct alc_spec *spec = codec->spec; |
| 4943 | unsigned int present; |
| 4944 | |
| 4945 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4946 | AC_VERB_GET_PIN_SENSE, 0); |
| 4947 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4948 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4949 | } |
| 4950 | |
| 4951 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4952 | unsigned int res) |
| 4953 | { |
| 4954 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4955 | alc260_hp_3013_automute(codec); |
| 4956 | } |
| 4957 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4958 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4959 | { |
| 4960 | unsigned int present, bits; |
| 4961 | |
| 4962 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4963 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4964 | |
| 4965 | bits = present ? 0 : PIN_OUT; |
| 4966 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4967 | bits); |
| 4968 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4969 | bits); |
| 4970 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4971 | bits); |
| 4972 | } |
| 4973 | |
| 4974 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4975 | unsigned int res) |
| 4976 | { |
| 4977 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4978 | alc260_hp_3012_automute(codec); |
| 4979 | } |
| 4980 | |
| 4981 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4982 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4983 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4984 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4985 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4986 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4987 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4988 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4989 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4990 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4991 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4992 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4993 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4994 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4995 | { } /* end */ |
| 4996 | }; |
| 4997 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4998 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4999 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5000 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5001 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5002 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5003 | * revisions available in early 2006. Therefore for now allow the |
| 5004 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5005 | * that the lack of mic bias for this NID is intentional we could change the |
| 5006 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5007 | * |
| 5008 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5009 | * don't appear to make the mic bias available from the "line" jack, even |
| 5010 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5011 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5012 | * and the output jack. If this turns out to be the case for all such |
| 5013 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5014 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5015 | * |
| 5016 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5017 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5018 | * controls for such models. On models without a "mono speaker" the control |
| 5019 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5020 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5021 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5022 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5023 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5024 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5025 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5026 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5027 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5028 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5029 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5030 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5031 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5032 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5033 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5034 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5035 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5036 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5037 | { } /* end */ |
| 5038 | }; |
| 5039 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5040 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5041 | */ |
| 5042 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5043 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5044 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5045 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5046 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5047 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5048 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5049 | { } /* end */ |
| 5050 | }; |
| 5051 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5052 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5053 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5054 | */ |
| 5055 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5056 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5057 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5059 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5060 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5061 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5062 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5063 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5064 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5065 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5066 | { } /* end */ |
| 5067 | }; |
| 5068 | |
| 5069 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5070 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5071 | */ |
| 5072 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5073 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5074 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5075 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5076 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5077 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5078 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5079 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5080 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5081 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5082 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5083 | { } /* end */ |
| 5084 | }; |
| 5085 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5086 | /* |
| 5087 | * initialization verbs |
| 5088 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5089 | static struct hda_verb alc260_init_verbs[] = { |
| 5090 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5091 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5092 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5093 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5094 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5095 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5096 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5097 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5098 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5099 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5100 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5101 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5102 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5103 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5104 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5105 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5106 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5107 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5108 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5109 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5110 | /* set connection select to line in (default select for this ADC) */ |
| 5111 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5112 | /* mute capture amp left and right */ |
| 5113 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5114 | /* set connection select to line in (default select for this ADC) */ |
| 5115 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5116 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5117 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5118 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5119 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5120 | /* set vol=0 HP mixer amp left and right */ |
| 5121 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5122 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5123 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5124 | /* set vol=0 Mono mixer amp left and right */ |
| 5125 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5126 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5127 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5128 | /* unmute LINE-2 out pin */ |
| 5129 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5130 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5131 | * Line In 2 = 0x03 |
| 5132 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5133 | /* mute analog inputs */ |
| 5134 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5135 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5136 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5137 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5138 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5139 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5140 | /* mute Front out path */ |
| 5141 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5142 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5143 | /* mute Headphone out path */ |
| 5144 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5146 | /* mute Mono out path */ |
| 5147 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5148 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5149 | { } |
| 5150 | }; |
| 5151 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5152 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5153 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5154 | /* Headphone and output */ |
| 5155 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5156 | /* mono output */ |
| 5157 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5158 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5159 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5160 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5161 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5162 | /* Line In pin widget for input */ |
| 5163 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5164 | /* Line-2 pin widget for output */ |
| 5165 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5166 | /* CD pin widget for input */ |
| 5167 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5168 | /* unmute amp left and right */ |
| 5169 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5170 | /* set connection select to line in (default select for this ADC) */ |
| 5171 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5172 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5173 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5174 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5176 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5177 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5178 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5179 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5180 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5181 | * Line In 2 = 0x03 |
| 5182 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5183 | /* mute analog inputs */ |
| 5184 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5185 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5186 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5187 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5188 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5189 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5190 | /* Unmute Front out path */ |
| 5191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5192 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5193 | /* Unmute Headphone out path */ |
| 5194 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5195 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5196 | /* Unmute Mono out path */ |
| 5197 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5198 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5199 | { } |
| 5200 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5201 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5202 | |
| 5203 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5204 | /* Line out and output */ |
| 5205 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5206 | /* mono output */ |
| 5207 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5208 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5209 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5210 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5211 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5212 | /* Line In pin widget for input */ |
| 5213 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5214 | /* Headphone pin widget for output */ |
| 5215 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5216 | /* CD pin widget for input */ |
| 5217 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5218 | /* unmute amp left and right */ |
| 5219 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5220 | /* set connection select to line in (default select for this ADC) */ |
| 5221 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5222 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5223 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5224 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5225 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5226 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5227 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5228 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5229 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5230 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5231 | * Line In 2 = 0x03 |
| 5232 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5233 | /* mute analog inputs */ |
| 5234 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5235 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5236 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5237 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5239 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5240 | /* Unmute Front out path */ |
| 5241 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5243 | /* Unmute Headphone out path */ |
| 5244 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5245 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5246 | /* Unmute Mono out path */ |
| 5247 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5248 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5249 | { } |
| 5250 | }; |
| 5251 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5252 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5253 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5254 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5255 | */ |
| 5256 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5257 | /* Disable all GPIOs */ |
| 5258 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5259 | /* Internal speaker is connected to headphone pin */ |
| 5260 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5261 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5262 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5263 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5264 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5265 | /* Ensure all other unused pins are disabled and muted. */ |
| 5266 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5267 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5268 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5269 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5270 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5271 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5272 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5273 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5274 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5275 | /* Disable digital (SPDIF) pins */ |
| 5276 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5277 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5278 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5279 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5280 | * when acting as an output. |
| 5281 | */ |
| 5282 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5283 | |
| 5284 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5285 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5286 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5287 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5288 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5289 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5290 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5291 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5292 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5293 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5294 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5295 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5296 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5297 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5298 | * If the pin mode is changed by the user the pin mode control will |
| 5299 | * take care of enabling the pin's input/output buffers as needed. |
| 5300 | * Therefore there's no need to enable the input buffer at this |
| 5301 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5302 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5303 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5304 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5305 | * mixer ctrl) |
| 5306 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5307 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5308 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5309 | /* Mute capture amp left and right */ |
| 5310 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5311 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5312 | * in (on mic1 pin) |
| 5313 | */ |
| 5314 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5315 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5316 | /* Do the same for the second ADC: mute capture input amp and |
| 5317 | * set ADC connection to line in (on mic1 pin) |
| 5318 | */ |
| 5319 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5320 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5321 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5322 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5324 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5325 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5330 | {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] | 5331 | |
| 5332 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5333 | }; |
| 5334 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5335 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5336 | * similar laptops (adapted from Fujitsu init verbs). |
| 5337 | */ |
| 5338 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5339 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5340 | * the headphone jack. Turn this on and rely on the standard mute |
| 5341 | * methods whenever the user wants to turn these outputs off. |
| 5342 | */ |
| 5343 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5344 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5345 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5346 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5347 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5348 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5349 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5350 | /* Line In jack is connected to Line1 pin */ |
| 5351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5352 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5353 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5354 | /* Ensure all other unused pins are disabled and muted. */ |
| 5355 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5356 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5357 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5358 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5359 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5360 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5361 | /* Disable digital (SPDIF) pins */ |
| 5362 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5363 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5364 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5365 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5366 | * bus when acting as outputs. |
| 5367 | */ |
| 5368 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5369 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5370 | |
| 5371 | /* Start with output sum widgets muted and their output gains at min */ |
| 5372 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5377 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5378 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5379 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5380 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5381 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5382 | /* Unmute Line-out pin widget amp left and right |
| 5383 | * (no equiv mixer ctrl) |
| 5384 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5385 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5386 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5387 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5388 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5389 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5390 | * will take care of enabling the pin's input/output buffers as needed. |
| 5391 | * Therefore there's no need to enable the input buffer at this |
| 5392 | * stage. |
| 5393 | */ |
| 5394 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5395 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5396 | |
| 5397 | /* Mute capture amp left and right */ |
| 5398 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5399 | /* Set ADC connection select to match default mixer setting - mic |
| 5400 | * (on mic1 pin) |
| 5401 | */ |
| 5402 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5403 | |
| 5404 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5405 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5406 | */ |
| 5407 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5408 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5409 | |
| 5410 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5411 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5412 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5413 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5414 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5416 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5417 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5418 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5419 | |
| 5420 | { } |
| 5421 | }; |
| 5422 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5423 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5424 | * (adapted from Acer init verbs). |
| 5425 | */ |
| 5426 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5427 | /* GPIO 0 enables the output jack. |
| 5428 | * Turn this on and rely on the standard mute |
| 5429 | * methods whenever the user wants to turn these outputs off. |
| 5430 | */ |
| 5431 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5432 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5433 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5434 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5435 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5436 | /* Ensure all other unused pins are disabled and muted. */ |
| 5437 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5438 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5439 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5440 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5441 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5442 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5443 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5445 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5446 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5447 | /* Disable digital (SPDIF) pins */ |
| 5448 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5449 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5450 | |
| 5451 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5452 | * bus when acting as outputs. |
| 5453 | */ |
| 5454 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5455 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5456 | |
| 5457 | /* Start with output sum widgets muted and their output gains at min */ |
| 5458 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5459 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5460 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5461 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5462 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5463 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5464 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5465 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5466 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5467 | |
| 5468 | /* Unmute Line-out pin widget amp left and right |
| 5469 | * (no equiv mixer ctrl) |
| 5470 | */ |
| 5471 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5472 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5473 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5474 | * will take care of enabling the pin's input/output buffers as needed. |
| 5475 | * Therefore there's no need to enable the input buffer at this |
| 5476 | * stage. |
| 5477 | */ |
| 5478 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5479 | |
| 5480 | /* Mute capture amp left and right */ |
| 5481 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5482 | /* Set ADC connection select to match default mixer setting - mic |
| 5483 | * (on mic1 pin) |
| 5484 | */ |
| 5485 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5486 | |
| 5487 | /* Do similar with the second ADC: mute capture input amp and |
| 5488 | * set ADC connection to mic to match ALSA's default state. |
| 5489 | */ |
| 5490 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5491 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5492 | |
| 5493 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5494 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5495 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5496 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5497 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5502 | |
| 5503 | { } |
| 5504 | }; |
| 5505 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5506 | static struct hda_verb alc260_will_verbs[] = { |
| 5507 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5508 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5509 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5510 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5511 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5512 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5513 | {} |
| 5514 | }; |
| 5515 | |
| 5516 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5517 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5518 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5519 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5520 | |
| 5521 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5522 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5523 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5524 | |
| 5525 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5526 | {} |
| 5527 | }; |
| 5528 | |
| 5529 | /* toggle speaker-output according to the hp-jack state */ |
| 5530 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5531 | { |
| 5532 | unsigned int present; |
| 5533 | |
| 5534 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5535 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5536 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5537 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5538 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5539 | AC_VERB_SET_GPIO_DATA, 1); |
| 5540 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5541 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5542 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5543 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5544 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5545 | AC_VERB_SET_GPIO_DATA, 0); |
| 5546 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5547 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5548 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5549 | } |
| 5550 | } |
| 5551 | |
| 5552 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5553 | unsigned int res) |
| 5554 | { |
| 5555 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5556 | alc260_replacer_672v_automute(codec); |
| 5557 | } |
| 5558 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5559 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5560 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5561 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5562 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5563 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5564 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5565 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5566 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5567 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5568 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5569 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5570 | {} |
| 5571 | }; |
| 5572 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5573 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5574 | * configuration. |
| 5575 | */ |
| 5576 | #ifdef CONFIG_SND_DEBUG |
| 5577 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5578 | 0x02, |
| 5579 | }; |
| 5580 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5581 | 0x04, 0x05, |
| 5582 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5583 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5584 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5585 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5586 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5587 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5588 | { |
| 5589 | .num_items = 7, |
| 5590 | .items = { |
| 5591 | { "MIC1 pin", 0x0 }, |
| 5592 | { "MIC2 pin", 0x1 }, |
| 5593 | { "LINE1 pin", 0x2 }, |
| 5594 | { "LINE2 pin", 0x3 }, |
| 5595 | { "CD pin", 0x4 }, |
| 5596 | { "LINE-OUT pin", 0x5 }, |
| 5597 | { "HP-OUT pin", 0x6 }, |
| 5598 | }, |
| 5599 | }, |
| 5600 | { |
| 5601 | .num_items = 8, |
| 5602 | .items = { |
| 5603 | { "MIC1 pin", 0x0 }, |
| 5604 | { "MIC2 pin", 0x1 }, |
| 5605 | { "LINE1 pin", 0x2 }, |
| 5606 | { "LINE2 pin", 0x3 }, |
| 5607 | { "CD pin", 0x4 }, |
| 5608 | { "Mixer", 0x5 }, |
| 5609 | { "LINE-OUT pin", 0x6 }, |
| 5610 | { "HP-OUT pin", 0x7 }, |
| 5611 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5612 | }, |
| 5613 | }; |
| 5614 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5615 | /* Output driver widgets */ |
| 5616 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5617 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5618 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5619 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5620 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5621 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5622 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5623 | /* Modes for retasking pin widgets |
| 5624 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5625 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5626 | * mention this restriction. At this stage it's not clear whether |
| 5627 | * this behaviour is intentional or is a hardware bug in chip |
| 5628 | * revisions available at least up until early 2006. Therefore for |
| 5629 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5630 | * choices, but if it turns out that the lack of mic bias for these |
| 5631 | * NIDs is intentional we could change their modes from |
| 5632 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5633 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5634 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5635 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5636 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5637 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5638 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5639 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5640 | |
| 5641 | /* Loopback mixer controls */ |
| 5642 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5643 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5644 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5645 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5646 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5647 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5648 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5649 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5650 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5651 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5652 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5653 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5654 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5655 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5656 | |
| 5657 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5658 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5659 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5660 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5661 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5662 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5663 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5664 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5665 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5666 | */ |
| 5667 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5668 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5669 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5670 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5671 | * this output to turn on an external amplifier. |
| 5672 | */ |
| 5673 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5674 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5675 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5676 | { } /* end */ |
| 5677 | }; |
| 5678 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5679 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5680 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5681 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5682 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5683 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5684 | /* Enable retasking pins as output, initially without power amp */ |
| 5685 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5686 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5689 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5690 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5691 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5692 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5693 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5694 | * payload also sets the generation to 0, output to be in "consumer" |
| 5695 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5696 | * control. |
| 5697 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5698 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5699 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5700 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5701 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5702 | * OUT1 sum bus when acting as an output. |
| 5703 | */ |
| 5704 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5705 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5706 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5707 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5708 | |
| 5709 | /* Start with output sum widgets muted and their output gains at min */ |
| 5710 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5711 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5712 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5713 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5714 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5715 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5716 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5717 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5718 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5719 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5720 | /* Unmute retasking pin widget output buffers since the default |
| 5721 | * state appears to be output. As the pin mode is changed by the |
| 5722 | * user the pin mode control will take care of enabling the pin's |
| 5723 | * input/output buffers as needed. |
| 5724 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5725 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5726 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5727 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5728 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5729 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5730 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5731 | /* Also unmute the mono-out pin widget */ |
| 5732 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5733 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5734 | /* Mute capture amp left and right */ |
| 5735 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5736 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5737 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5738 | */ |
| 5739 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5740 | |
| 5741 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5742 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5743 | */ |
| 5744 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5745 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5746 | |
| 5747 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5748 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5749 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5750 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5751 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5752 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5755 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5756 | |
| 5757 | { } |
| 5758 | }; |
| 5759 | #endif |
| 5760 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5761 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5762 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5763 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5764 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5765 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5766 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5767 | /* |
| 5768 | * for BIOS auto-configuration |
| 5769 | */ |
| 5770 | |
| 5771 | 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] | 5772 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5773 | { |
| 5774 | hda_nid_t nid_vol; |
| 5775 | unsigned long vol_val, sw_val; |
| 5776 | char name[32]; |
| 5777 | int err; |
| 5778 | |
| 5779 | if (nid >= 0x0f && nid < 0x11) { |
| 5780 | nid_vol = nid - 0x7; |
| 5781 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5782 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5783 | } else if (nid == 0x11) { |
| 5784 | nid_vol = nid - 0x7; |
| 5785 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5786 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5787 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5788 | nid_vol = 0x08; |
| 5789 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5790 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5791 | } else |
| 5792 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5793 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5794 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5795 | /* first control for the volume widget */ |
| 5796 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5797 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5798 | if (err < 0) |
| 5799 | return err; |
| 5800 | *vol_bits |= (1 << nid_vol); |
| 5801 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5802 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5803 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5804 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5805 | return err; |
| 5806 | return 1; |
| 5807 | } |
| 5808 | |
| 5809 | /* add playback controls from the parsed DAC table */ |
| 5810 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5811 | const struct auto_pin_cfg *cfg) |
| 5812 | { |
| 5813 | hda_nid_t nid; |
| 5814 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5815 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5816 | |
| 5817 | spec->multiout.num_dacs = 1; |
| 5818 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5819 | spec->multiout.dac_nids[0] = 0x02; |
| 5820 | |
| 5821 | nid = cfg->line_out_pins[0]; |
| 5822 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5823 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5824 | if (err < 0) |
| 5825 | return err; |
| 5826 | } |
| 5827 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5828 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5829 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5830 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5831 | if (err < 0) |
| 5832 | return err; |
| 5833 | } |
| 5834 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5835 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5836 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5837 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5838 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5839 | if (err < 0) |
| 5840 | return err; |
| 5841 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5842 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5843 | } |
| 5844 | |
| 5845 | /* create playback/capture controls for input pins */ |
| 5846 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5847 | const struct auto_pin_cfg *cfg) |
| 5848 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5849 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5850 | int i, err, idx; |
| 5851 | |
| 5852 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5853 | if (cfg->input_pins[i] >= 0x12) { |
| 5854 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5855 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5856 | auto_pin_cfg_labels[i], idx, |
| 5857 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5858 | if (err < 0) |
| 5859 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5860 | imux->items[imux->num_items].label = |
| 5861 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | imux->items[imux->num_items].index = idx; |
| 5863 | imux->num_items++; |
| 5864 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5865 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5867 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5868 | auto_pin_cfg_labels[i], idx, |
| 5869 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | if (err < 0) |
| 5871 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5872 | imux->items[imux->num_items].label = |
| 5873 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5874 | imux->items[imux->num_items].index = idx; |
| 5875 | imux->num_items++; |
| 5876 | } |
| 5877 | } |
| 5878 | return 0; |
| 5879 | } |
| 5880 | |
| 5881 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5882 | hda_nid_t nid, int pin_type, |
| 5883 | int sel_idx) |
| 5884 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5885 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5886 | /* need the manual connection? */ |
| 5887 | if (nid >= 0x12) { |
| 5888 | int idx = nid - 0x12; |
| 5889 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5890 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5891 | } |
| 5892 | } |
| 5893 | |
| 5894 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5895 | { |
| 5896 | struct alc_spec *spec = codec->spec; |
| 5897 | hda_nid_t nid; |
| 5898 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5899 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5900 | if (nid) { |
| 5901 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5902 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5903 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5904 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5905 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5906 | if (nid) |
| 5907 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5908 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5909 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5910 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5911 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5912 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5913 | |
| 5914 | #define ALC260_PIN_CD_NID 0x16 |
| 5915 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5916 | { |
| 5917 | struct alc_spec *spec = codec->spec; |
| 5918 | int i; |
| 5919 | |
| 5920 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5921 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5922 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5923 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5924 | if (nid != ALC260_PIN_CD_NID && |
| 5925 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5926 | snd_hda_codec_write(codec, nid, 0, |
| 5927 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5928 | AMP_OUT_MUTE); |
| 5929 | } |
| 5930 | } |
| 5931 | } |
| 5932 | |
| 5933 | /* |
| 5934 | * generic initialization of ADC, input mixers and output mixers |
| 5935 | */ |
| 5936 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5937 | /* |
| 5938 | * Unmute ADC0-1 and set the default input to mic-in |
| 5939 | */ |
| 5940 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5941 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5942 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5943 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5944 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5945 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5946 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5947 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5948 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5949 | */ |
| 5950 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5951 | /* mute analog inputs */ |
| 5952 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5953 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5954 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5957 | |
| 5958 | /* |
| 5959 | * Set up output mixers (0x08 - 0x0a) |
| 5960 | */ |
| 5961 | /* set vol=0 to output mixers */ |
| 5962 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5963 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5964 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5965 | /* set up input amps for analog loopback */ |
| 5966 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5967 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5968 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5969 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5970 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5971 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5972 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5973 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5974 | { } |
| 5975 | }; |
| 5976 | |
| 5977 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5978 | { |
| 5979 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5980 | int err; |
| 5981 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5982 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5983 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5984 | alc260_ignore); |
| 5985 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5986 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5987 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5988 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5989 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5990 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5991 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5992 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5993 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5994 | return err; |
| 5995 | |
| 5996 | spec->multiout.max_channels = 2; |
| 5997 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 5998 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5999 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6000 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6001 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6002 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6003 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6004 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6005 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6006 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6007 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6008 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6009 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6010 | return 1; |
| 6011 | } |
| 6012 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6013 | /* additional initialization for auto-configuration model */ |
| 6014 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6015 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6016 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6017 | alc260_auto_init_multi_out(codec); |
| 6018 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6019 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6020 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6021 | } |
| 6022 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6023 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6024 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6025 | { 0x07, HDA_INPUT, 0 }, |
| 6026 | { 0x07, HDA_INPUT, 1 }, |
| 6027 | { 0x07, HDA_INPUT, 2 }, |
| 6028 | { 0x07, HDA_INPUT, 3 }, |
| 6029 | { 0x07, HDA_INPUT, 4 }, |
| 6030 | { } /* end */ |
| 6031 | }; |
| 6032 | #endif |
| 6033 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6034 | /* |
| 6035 | * ALC260 configurations |
| 6036 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6037 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6038 | [ALC260_BASIC] = "basic", |
| 6039 | [ALC260_HP] = "hp", |
| 6040 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6041 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6042 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6043 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6044 | [ALC260_WILL] = "will", |
| 6045 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6046 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6047 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6048 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6049 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6050 | [ALC260_AUTO] = "auto", |
| 6051 | }; |
| 6052 | |
| 6053 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6054 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6055 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6056 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6057 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6058 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6059 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6060 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6061 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6062 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6063 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6064 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6065 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6066 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6067 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6068 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6069 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6070 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6071 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6072 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6073 | {} |
| 6074 | }; |
| 6075 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6076 | static struct alc_config_preset alc260_presets[] = { |
| 6077 | [ALC260_BASIC] = { |
| 6078 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6079 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6080 | .init_verbs = { alc260_init_verbs }, |
| 6081 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6082 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6083 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6084 | .adc_nids = alc260_adc_nids, |
| 6085 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6086 | .channel_mode = alc260_modes, |
| 6087 | .input_mux = &alc260_capture_source, |
| 6088 | }, |
| 6089 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6090 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6091 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6092 | .init_verbs = { alc260_init_verbs, |
| 6093 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6094 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6095 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6096 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6097 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6099 | .channel_mode = alc260_modes, |
| 6100 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6101 | .unsol_event = alc260_hp_unsol_event, |
| 6102 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6103 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6104 | [ALC260_HP_DC7600] = { |
| 6105 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6106 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6107 | .init_verbs = { alc260_init_verbs, |
| 6108 | alc260_hp_dc7600_verbs }, |
| 6109 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6110 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6111 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6112 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6113 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6114 | .channel_mode = alc260_modes, |
| 6115 | .input_mux = &alc260_capture_source, |
| 6116 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6117 | .init_hook = alc260_hp_3012_automute, |
| 6118 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6119 | [ALC260_HP_3013] = { |
| 6120 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6121 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6122 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6123 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6124 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6125 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6126 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6127 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6128 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6129 | .channel_mode = alc260_modes, |
| 6130 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6131 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6132 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6133 | }, |
| 6134 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6135 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6136 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6137 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6138 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6139 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6140 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6141 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6142 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6143 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6144 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6145 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6146 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6147 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6148 | .init_verbs = { alc260_acer_init_verbs }, |
| 6149 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6150 | .dac_nids = alc260_dac_nids, |
| 6151 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6152 | .adc_nids = alc260_dual_adc_nids, |
| 6153 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6154 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6155 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6156 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6157 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6158 | [ALC260_FAVORIT100] = { |
| 6159 | .mixers = { alc260_favorit100_mixer }, |
| 6160 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6161 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6162 | .dac_nids = alc260_dac_nids, |
| 6163 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6164 | .adc_nids = alc260_dual_adc_nids, |
| 6165 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6166 | .channel_mode = alc260_modes, |
| 6167 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6168 | .input_mux = alc260_favorit100_capture_sources, |
| 6169 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6170 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6171 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6172 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6173 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6174 | .dac_nids = alc260_dac_nids, |
| 6175 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6176 | .adc_nids = alc260_adc_nids, |
| 6177 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6178 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6179 | .channel_mode = alc260_modes, |
| 6180 | .input_mux = &alc260_capture_source, |
| 6181 | }, |
| 6182 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6183 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6184 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6185 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6186 | .dac_nids = alc260_dac_nids, |
| 6187 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6188 | .adc_nids = alc260_adc_nids, |
| 6189 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6190 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6191 | .channel_mode = alc260_modes, |
| 6192 | .input_mux = &alc260_capture_source, |
| 6193 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6194 | .init_hook = alc260_replacer_672v_automute, |
| 6195 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6196 | #ifdef CONFIG_SND_DEBUG |
| 6197 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6198 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6199 | .init_verbs = { alc260_test_init_verbs }, |
| 6200 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6201 | .dac_nids = alc260_test_dac_nids, |
| 6202 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6203 | .adc_nids = alc260_test_adc_nids, |
| 6204 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6205 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6206 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6207 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6208 | }, |
| 6209 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6210 | }; |
| 6211 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6212 | static int patch_alc260(struct hda_codec *codec) |
| 6213 | { |
| 6214 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6215 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6216 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6217 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6218 | if (spec == NULL) |
| 6219 | return -ENOMEM; |
| 6220 | |
| 6221 | codec->spec = spec; |
| 6222 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6223 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6224 | alc260_models, |
| 6225 | alc260_cfg_tbl); |
| 6226 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6227 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " |
| 6228 | "trying auto-probe from BIOS...\n", |
| 6229 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6230 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6231 | } |
| 6232 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | if (board_config == ALC260_AUTO) { |
| 6234 | /* automatic parse from the BIOS config */ |
| 6235 | err = alc260_parse_auto_config(codec); |
| 6236 | if (err < 0) { |
| 6237 | alc_free(codec); |
| 6238 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6239 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6240 | printk(KERN_INFO |
| 6241 | "hda_codec: Cannot set up configuration " |
| 6242 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6243 | board_config = ALC260_BASIC; |
| 6244 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6245 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6246 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6247 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6248 | if (err < 0) { |
| 6249 | alc_free(codec); |
| 6250 | return err; |
| 6251 | } |
| 6252 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6253 | if (board_config != ALC260_AUTO) |
| 6254 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6255 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6256 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6257 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6258 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6259 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6260 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6261 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6262 | if (!spec->adc_nids && spec->input_mux) { |
| 6263 | /* check whether NID 0x04 is valid */ |
| 6264 | unsigned int wcap = get_wcaps(codec, 0x04); |
| 6265 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 6266 | /* get type */ |
| 6267 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6268 | spec->adc_nids = alc260_adc_nids_alt; |
| 6269 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6270 | } else { |
| 6271 | spec->adc_nids = alc260_adc_nids; |
| 6272 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6273 | } |
| 6274 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6275 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6276 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6277 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6278 | spec->vmaster_nid = 0x08; |
| 6279 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6280 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6281 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6282 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6283 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6284 | if (!spec->loopback.amplist) |
| 6285 | spec->loopback.amplist = alc260_loopbacks; |
| 6286 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6287 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6288 | |
| 6289 | return 0; |
| 6290 | } |
| 6291 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6292 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6293 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6294 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6295 | * |
| 6296 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6297 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6298 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6299 | * 6-channel independent captures. |
| 6300 | * |
| 6301 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6302 | * driver yet). |
| 6303 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6304 | #define ALC882_DIGOUT_NID 0x06 |
| 6305 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6306 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6307 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6308 | #define ALC1200_DIGOUT_NID 0x10 |
| 6309 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6310 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6311 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6312 | { 8, NULL } |
| 6313 | }; |
| 6314 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6315 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6316 | static hda_nid_t alc882_dac_nids[4] = { |
| 6317 | /* front, rear, clfe, rear_surr */ |
| 6318 | 0x02, 0x03, 0x04, 0x05 |
| 6319 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6320 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6321 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6322 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6323 | #define alc882_adc_nids alc880_adc_nids |
| 6324 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6325 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6326 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6327 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6328 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6329 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6330 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6331 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6332 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6333 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6334 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6335 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6336 | /* input MUX */ |
| 6337 | /* FIXME: should be a matrix-type input source selection */ |
| 6338 | |
| 6339 | static struct hda_input_mux alc882_capture_source = { |
| 6340 | .num_items = 4, |
| 6341 | .items = { |
| 6342 | { "Mic", 0x0 }, |
| 6343 | { "Front Mic", 0x1 }, |
| 6344 | { "Line", 0x2 }, |
| 6345 | { "CD", 0x4 }, |
| 6346 | }, |
| 6347 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6348 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6349 | #define alc883_capture_source alc882_capture_source |
| 6350 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6351 | static struct hda_input_mux mb5_capture_source = { |
| 6352 | .num_items = 3, |
| 6353 | .items = { |
| 6354 | { "Mic", 0x1 }, |
| 6355 | { "Line", 0x2 }, |
| 6356 | { "CD", 0x4 }, |
| 6357 | }, |
| 6358 | }; |
| 6359 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6360 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6361 | .num_items = 4, |
| 6362 | .items = { |
| 6363 | { "Mic", 0x1 }, |
| 6364 | { "Front Mic", 0x0 }, |
| 6365 | { "Line", 0x2 }, |
| 6366 | { "CD", 0x4 }, |
| 6367 | }, |
| 6368 | }; |
| 6369 | |
| 6370 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6371 | .num_items = 2, |
| 6372 | .items = { |
| 6373 | { "Mic", 0x1 }, |
| 6374 | { "Line", 0x2 }, |
| 6375 | }, |
| 6376 | }; |
| 6377 | |
| 6378 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6379 | .num_items = 4, |
| 6380 | .items = { |
| 6381 | { "Mic", 0x0 }, |
| 6382 | { "iMic", 0x1 }, |
| 6383 | { "Line", 0x2 }, |
| 6384 | { "CD", 0x4 }, |
| 6385 | }, |
| 6386 | }; |
| 6387 | |
| 6388 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6389 | .num_items = 2, |
| 6390 | .items = { |
| 6391 | { "Mic", 0x0 }, |
| 6392 | { "Int Mic", 0x1 }, |
| 6393 | }, |
| 6394 | }; |
| 6395 | |
| 6396 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6397 | .num_items = 3, |
| 6398 | .items = { |
| 6399 | { "Mic", 0x0 }, |
| 6400 | { "Front Mic", 0x1 }, |
| 6401 | { "Line", 0x4 }, |
| 6402 | }, |
| 6403 | }; |
| 6404 | |
| 6405 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6406 | .num_items = 2, |
| 6407 | .items = { |
| 6408 | { "Mic", 0x0 }, |
| 6409 | { "Line", 0x2 }, |
| 6410 | }, |
| 6411 | }; |
| 6412 | |
| 6413 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6414 | .num_items = 2, |
| 6415 | .items = { |
| 6416 | { "Mic", 0x0 }, |
| 6417 | /* Front Mic (0x01) unused */ |
| 6418 | { "Line", 0x2 }, |
| 6419 | /* Line 2 (0x03) unused */ |
| 6420 | /* CD (0x04) unsused? */ |
| 6421 | }, |
| 6422 | }; |
| 6423 | |
| 6424 | /* |
| 6425 | * 2ch mode |
| 6426 | */ |
| 6427 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6428 | { 2, NULL } |
| 6429 | }; |
| 6430 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6431 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6432 | * 2ch mode |
| 6433 | */ |
| 6434 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6435 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6436 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6437 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6438 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6439 | { } /* end */ |
| 6440 | }; |
| 6441 | |
| 6442 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6443 | * 4ch mode |
| 6444 | */ |
| 6445 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6446 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6447 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6448 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6449 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6450 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6451 | { } /* end */ |
| 6452 | }; |
| 6453 | |
| 6454 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6455 | * 6ch mode |
| 6456 | */ |
| 6457 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6458 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6459 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6460 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6461 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6462 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6463 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6464 | { } /* end */ |
| 6465 | }; |
| 6466 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6467 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6468 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6469 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6470 | { 6, alc882_3ST_ch6_init }, |
| 6471 | }; |
| 6472 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6473 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6474 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6475 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6476 | * 6ch mode |
| 6477 | */ |
| 6478 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6479 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6480 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6481 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6482 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6483 | { } /* end */ |
| 6484 | }; |
| 6485 | |
| 6486 | /* |
| 6487 | * 8ch mode |
| 6488 | */ |
| 6489 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6490 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6491 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6492 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6493 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6494 | { } /* end */ |
| 6495 | }; |
| 6496 | |
| 6497 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6498 | { 6, alc882_sixstack_ch6_init }, |
| 6499 | { 8, alc882_sixstack_ch8_init }, |
| 6500 | }; |
| 6501 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6502 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6503 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6504 | */ |
| 6505 | |
| 6506 | /* |
| 6507 | * 2ch mode |
| 6508 | */ |
| 6509 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6510 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6511 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6512 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6513 | { } /* end */ |
| 6514 | }; |
| 6515 | |
| 6516 | /* |
| 6517 | * 6ch mode |
| 6518 | */ |
| 6519 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6520 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6521 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6522 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6523 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6524 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6525 | { } /* end */ |
| 6526 | }; |
| 6527 | |
| 6528 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6529 | { 2, alc885_mbp_ch2_init }, |
| 6530 | { 6, alc885_mbp_ch6_init }, |
| 6531 | }; |
| 6532 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6533 | /* |
| 6534 | * 2ch |
| 6535 | * Speakers/Woofer/HP = Front |
| 6536 | * LineIn = Input |
| 6537 | */ |
| 6538 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6539 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6540 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6541 | { } /* end */ |
| 6542 | }; |
| 6543 | |
| 6544 | /* |
| 6545 | * 6ch mode |
| 6546 | * Speakers/HP = Front |
| 6547 | * Woofer = LFE |
| 6548 | * LineIn = Surround |
| 6549 | */ |
| 6550 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6553 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6554 | { } /* end */ |
| 6555 | }; |
| 6556 | |
| 6557 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6558 | { 2, alc885_mb5_ch2_init }, |
| 6559 | { 6, alc885_mb5_ch6_init }, |
| 6560 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6561 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6562 | |
| 6563 | /* |
| 6564 | * 2ch mode |
| 6565 | */ |
| 6566 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6567 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6568 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6569 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6570 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6571 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6572 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6573 | { } /* end */ |
| 6574 | }; |
| 6575 | |
| 6576 | /* |
| 6577 | * 4ch mode |
| 6578 | */ |
| 6579 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6580 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6581 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6582 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6583 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6584 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6585 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6586 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6587 | { } /* end */ |
| 6588 | }; |
| 6589 | |
| 6590 | /* |
| 6591 | * 6ch mode |
| 6592 | */ |
| 6593 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6594 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6595 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6596 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6597 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6598 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6599 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6600 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6601 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6602 | { } /* end */ |
| 6603 | }; |
| 6604 | |
| 6605 | /* |
| 6606 | * 8ch mode |
| 6607 | */ |
| 6608 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6609 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6610 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6611 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6612 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6613 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6614 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6615 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6616 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6617 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6618 | { } /* end */ |
| 6619 | }; |
| 6620 | |
| 6621 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6622 | { 2, alc883_4ST_ch2_init }, |
| 6623 | { 4, alc883_4ST_ch4_init }, |
| 6624 | { 6, alc883_4ST_ch6_init }, |
| 6625 | { 8, alc883_4ST_ch8_init }, |
| 6626 | }; |
| 6627 | |
| 6628 | |
| 6629 | /* |
| 6630 | * 2ch mode |
| 6631 | */ |
| 6632 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6633 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6634 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6635 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6636 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6637 | { } /* end */ |
| 6638 | }; |
| 6639 | |
| 6640 | /* |
| 6641 | * 4ch mode |
| 6642 | */ |
| 6643 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6644 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6645 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6646 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6647 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6648 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6649 | { } /* end */ |
| 6650 | }; |
| 6651 | |
| 6652 | /* |
| 6653 | * 6ch mode |
| 6654 | */ |
| 6655 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6656 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6657 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6658 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6659 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6660 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6661 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6662 | { } /* end */ |
| 6663 | }; |
| 6664 | |
| 6665 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6666 | { 2, alc883_3ST_ch2_intel_init }, |
| 6667 | { 4, alc883_3ST_ch4_intel_init }, |
| 6668 | { 6, alc883_3ST_ch6_intel_init }, |
| 6669 | }; |
| 6670 | |
| 6671 | /* |
| 6672 | * 6ch mode |
| 6673 | */ |
| 6674 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6675 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6676 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6677 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6678 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6679 | { } /* end */ |
| 6680 | }; |
| 6681 | |
| 6682 | /* |
| 6683 | * 8ch mode |
| 6684 | */ |
| 6685 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6686 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6687 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6688 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6689 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6690 | { } /* end */ |
| 6691 | }; |
| 6692 | |
| 6693 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6694 | { 6, alc883_sixstack_ch6_init }, |
| 6695 | { 8, alc883_sixstack_ch8_init }, |
| 6696 | }; |
| 6697 | |
| 6698 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6699 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6700 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6701 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6702 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6703 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6704 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6705 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6706 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6707 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6708 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6709 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6710 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6711 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6712 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6714 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6715 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6716 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6717 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6718 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6719 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6720 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6721 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6722 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6723 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6724 | { } /* end */ |
| 6725 | }; |
| 6726 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6727 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6728 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6729 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6730 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6731 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6732 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6733 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6734 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6735 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6736 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6737 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6738 | { } /* end */ |
| 6739 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6740 | |
| 6741 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6742 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6743 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6744 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6745 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6746 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6747 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6748 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6749 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6750 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6751 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6752 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6753 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6754 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6755 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6756 | { } /* end */ |
| 6757 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6758 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6759 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6760 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6761 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6762 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6763 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6764 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6765 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6767 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6769 | { } /* end */ |
| 6770 | }; |
| 6771 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6772 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6773 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6774 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6775 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6776 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6777 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6778 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6779 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6780 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6782 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6783 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6784 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6785 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6786 | { } /* end */ |
| 6787 | }; |
| 6788 | |
| 6789 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6790 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6791 | */ |
| 6792 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6793 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6794 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6796 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6797 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6798 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6802 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6803 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6805 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6806 | { } /* end */ |
| 6807 | }; |
| 6808 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6809 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6810 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6811 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6812 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6813 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6814 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6815 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6816 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6817 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6818 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6820 | { } /* end */ |
| 6821 | }; |
| 6822 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6823 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6824 | { |
| 6825 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6826 | .name = "Channel Mode", |
| 6827 | .info = alc_ch_mode_info, |
| 6828 | .get = alc_ch_mode_get, |
| 6829 | .put = alc_ch_mode_put, |
| 6830 | }, |
| 6831 | { } /* end */ |
| 6832 | }; |
| 6833 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6834 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6835 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6836 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6837 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6838 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6839 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6840 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6841 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6842 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6843 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6844 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6845 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6846 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6847 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6848 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6849 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6850 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6851 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 6852 | /* mute analog input loopbacks */ |
| 6853 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6854 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6856 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6857 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6858 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6859 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6860 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6861 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6862 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6863 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6866 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6867 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6868 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6869 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6870 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6871 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6872 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6873 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6874 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6875 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6876 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6877 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6878 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6879 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6880 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6881 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6882 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6883 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6884 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6885 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6886 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6887 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6888 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6889 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6890 | |
| 6891 | /* FIXME: use matrix-type input source selection */ |
| 6892 | /* 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] | 6893 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6894 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6895 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6896 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6897 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6898 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6899 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6900 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6903 | /* ADC2: mute amp left and right */ |
| 6904 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6905 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6906 | /* ADC3: mute amp left and right */ |
| 6907 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6908 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6909 | |
| 6910 | { } |
| 6911 | }; |
| 6912 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6913 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 6914 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6915 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6916 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6917 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6918 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6919 | /* ADC1: mute amp left and right */ |
| 6920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6921 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6922 | { } |
| 6923 | }; |
| 6924 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6925 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6926 | /* change to EAPD mode */ |
| 6927 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6928 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6929 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6930 | }; |
| 6931 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6932 | #define alc883_init_verbs alc882_base_init_verbs |
| 6933 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6934 | /* Mac Pro test */ |
| 6935 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 6936 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6937 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6938 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 6939 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6941 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6942 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6943 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6944 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6945 | { } /* end */ |
| 6946 | }; |
| 6947 | |
| 6948 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 6949 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6951 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6952 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6953 | /* Front Pin: output 0 (0x0c) */ |
| 6954 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6955 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6956 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6957 | /* Front Mic pin: input vref at 80% */ |
| 6958 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6959 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6960 | /* Speaker: output */ |
| 6961 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6962 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6963 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 6964 | /* Headphone output (output 0 - 0x0c) */ |
| 6965 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6966 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6967 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6968 | |
| 6969 | /* FIXME: use matrix-type input source selection */ |
| 6970 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6971 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6972 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6976 | /* Input mixer2 */ |
| 6977 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6981 | /* Input mixer3 */ |
| 6982 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6983 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6985 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6986 | /* ADC1: mute amp left and right */ |
| 6987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6988 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6989 | /* ADC2: mute amp left and right */ |
| 6990 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6991 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6992 | /* ADC3: mute amp left and right */ |
| 6993 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6994 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6995 | |
| 6996 | { } |
| 6997 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6998 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6999 | /* Macbook 5,1 */ |
| 7000 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7001 | /* DACs */ |
| 7002 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7003 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7004 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7005 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7006 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7007 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7008 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7009 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7010 | /* Surround mixer */ |
| 7011 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7012 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7013 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7014 | /* LFE mixer */ |
| 7015 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7016 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7017 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7018 | /* HP mixer */ |
| 7019 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7020 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7021 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7022 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7023 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7024 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7025 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7026 | /* LFE Pin (0x0e) */ |
| 7027 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7028 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7029 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7030 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7031 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7032 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7033 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7034 | /* Front Mic pin: input vref at 80% */ |
| 7035 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7036 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7037 | /* Line In pin */ |
| 7038 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7039 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7040 | |
| 7041 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7042 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7043 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7044 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7045 | { } |
| 7046 | }; |
| 7047 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7048 | /* Macbook Pro rev3 */ |
| 7049 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7050 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7052 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7054 | /* Rear mixer */ |
| 7055 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7056 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7057 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7058 | /* Front Pin: output 0 (0x0c) */ |
| 7059 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7060 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7061 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7062 | /* HP Pin: output 0 (0x0d) */ |
| 7063 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7064 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7066 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7067 | /* Mic (rear) pin: input vref at 80% */ |
| 7068 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7069 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7070 | /* Front Mic pin: input vref at 80% */ |
| 7071 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7072 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7073 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7074 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7075 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7076 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7077 | |
| 7078 | /* FIXME: use matrix-type input source selection */ |
| 7079 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7080 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7081 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7082 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7083 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7084 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7085 | /* Input mixer2 */ |
| 7086 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7087 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7088 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7089 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7090 | /* Input mixer3 */ |
| 7091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7092 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7093 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7094 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7095 | /* ADC1: mute amp left and right */ |
| 7096 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7097 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7098 | /* ADC2: mute amp left and right */ |
| 7099 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7100 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7101 | /* ADC3: mute amp left and right */ |
| 7102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7104 | |
| 7105 | { } |
| 7106 | }; |
| 7107 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7108 | /* iMac 24 mixer. */ |
| 7109 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7110 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7111 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7112 | { } /* end */ |
| 7113 | }; |
| 7114 | |
| 7115 | /* iMac 24 init verbs. */ |
| 7116 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7117 | /* Internal speakers: output 0 (0x0c) */ |
| 7118 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7119 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7120 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7121 | /* Internal speakers: output 0 (0x0c) */ |
| 7122 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7123 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7124 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7125 | /* Headphone: output 0 (0x0c) */ |
| 7126 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7127 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7128 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7129 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7130 | /* Front Mic: input vref at 80% */ |
| 7131 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7132 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7133 | { } |
| 7134 | }; |
| 7135 | |
| 7136 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7137 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7138 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7139 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7140 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7141 | spec->autocfg.hp_pins[0] = 0x14; |
| 7142 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7143 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 7144 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7145 | } |
| 7146 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7147 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7148 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7149 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7150 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7151 | spec->autocfg.hp_pins[0] = 0x15; |
| 7152 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7153 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7154 | } |
| 7155 | |
| 7156 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7157 | static struct hda_verb alc882_targa_verbs[] = { |
| 7158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7159 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7160 | |
| 7161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7162 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7163 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7164 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7165 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7166 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7167 | |
| 7168 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7169 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7170 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7171 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 7172 | { } /* end */ |
| 7173 | }; |
| 7174 | |
| 7175 | /* toggle speaker-output according to the hp-jack state */ |
| 7176 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7177 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7178 | struct alc_spec *spec = codec->spec; |
| 7179 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7180 | 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] | 7181 | spec->jack_present ? 1 : 3); |
| 7182 | } |
| 7183 | |
| 7184 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 7185 | { |
| 7186 | struct alc_spec *spec = codec->spec; |
| 7187 | |
| 7188 | spec->autocfg.hp_pins[0] = 0x14; |
| 7189 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 7190 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7191 | } |
| 7192 | |
| 7193 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7194 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7195 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7196 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7197 | } |
| 7198 | |
| 7199 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7202 | |
| 7203 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7204 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7205 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7206 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7207 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7208 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7209 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7210 | |
| 7211 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7212 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7213 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7214 | { } /* end */ |
| 7215 | }; |
| 7216 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7217 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7220 | |
| 7221 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7222 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7223 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7224 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7225 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7226 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7227 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7228 | |
| 7229 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7230 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7231 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7232 | { } /* end */ |
| 7233 | }; |
| 7234 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7235 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7236 | { |
| 7237 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7238 | |
| 7239 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7240 | AC_VERB_GET_GPIO_DATA, 0); |
| 7241 | |
| 7242 | if (!muted) |
| 7243 | gpiostate |= (1 << pin); |
| 7244 | else |
| 7245 | gpiostate &= ~(1 << pin); |
| 7246 | |
| 7247 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7248 | AC_VERB_GET_GPIO_MASK, 0); |
| 7249 | gpiomask |= (1 << pin); |
| 7250 | |
| 7251 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7252 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7253 | gpiodir |= (1 << pin); |
| 7254 | |
| 7255 | |
| 7256 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7257 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7258 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7259 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7260 | |
| 7261 | msleep(1); |
| 7262 | |
| 7263 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7264 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7265 | } |
| 7266 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7267 | /* set up GPIO at initialization */ |
| 7268 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7269 | { |
| 7270 | alc882_gpio_mute(codec, 0, 0); |
| 7271 | alc882_gpio_mute(codec, 1, 0); |
| 7272 | } |
| 7273 | |
| 7274 | /* set up GPIO and update auto-muting at initialization */ |
| 7275 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7276 | { |
| 7277 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7278 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7279 | } |
| 7280 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7281 | /* |
| 7282 | * generic initialization of ADC, input mixers and output mixers |
| 7283 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7284 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7285 | /* |
| 7286 | * Unmute ADC0-2 and set the default input to mic-in |
| 7287 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7288 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7290 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7291 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7292 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7293 | /* 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] | 7294 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7295 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7296 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7297 | */ |
| 7298 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7299 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7300 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7301 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7302 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7303 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7304 | |
| 7305 | /* |
| 7306 | * Set up output mixers (0x0c - 0x0f) |
| 7307 | */ |
| 7308 | /* set vol=0 to output mixers */ |
| 7309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7310 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7311 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7312 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7313 | /* set up input amps for analog loopback */ |
| 7314 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7315 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7317 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7318 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7319 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7320 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7321 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7322 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7323 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7324 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7325 | |
| 7326 | /* FIXME: use matrix-type input source selection */ |
| 7327 | /* 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] | 7328 | /* Input mixer2 */ |
| 7329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7330 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7331 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7332 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7333 | /* Input mixer3 */ |
| 7334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7335 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7336 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7337 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7338 | |
| 7339 | { } |
| 7340 | }; |
| 7341 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7342 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7343 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7344 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7345 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7346 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7347 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7348 | { } /* end */ |
| 7349 | }; |
| 7350 | |
| 7351 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7352 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7353 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7354 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7355 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7356 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7357 | { } /* end */ |
| 7358 | }; |
| 7359 | |
| 7360 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7361 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7362 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7363 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7364 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7365 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7366 | { } /* end */ |
| 7367 | }; |
| 7368 | |
| 7369 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7370 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7371 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7372 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7373 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7374 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7375 | { } /* end */ |
| 7376 | }; |
| 7377 | |
| 7378 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7379 | { 2, alc889A_mb31_ch2_init }, |
| 7380 | { 4, alc889A_mb31_ch4_init }, |
| 7381 | { 5, alc889A_mb31_ch5_init }, |
| 7382 | { 6, alc889A_mb31_ch6_init }, |
| 7383 | }; |
| 7384 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7385 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7386 | /* eanable EAPD on medion laptop */ |
| 7387 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7388 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7389 | { } |
| 7390 | }; |
| 7391 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7392 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7393 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7394 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7395 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7396 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7397 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7398 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7399 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7400 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7401 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7403 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7405 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7406 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7407 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7408 | { } /* end */ |
| 7409 | }; |
| 7410 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7411 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7412 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7413 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7414 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7415 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7416 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7417 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7418 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7419 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7420 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7421 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7422 | { } /* end */ |
| 7423 | }; |
| 7424 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7425 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7426 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7427 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7428 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7429 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7431 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7433 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7434 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7435 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7436 | { } /* end */ |
| 7437 | }; |
| 7438 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7439 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7440 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7441 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7442 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7443 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7444 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7445 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7446 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7447 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7448 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7449 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7450 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7451 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7452 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7453 | { } /* end */ |
| 7454 | }; |
| 7455 | |
| 7456 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7457 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7458 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7459 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7460 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7461 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7462 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7463 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7464 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7465 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7467 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7468 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7469 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7471 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7473 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7474 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7475 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7476 | { } /* end */ |
| 7477 | }; |
| 7478 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7479 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7480 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7481 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7482 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7483 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7484 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7485 | HDA_OUTPUT), |
| 7486 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7487 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7488 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7489 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7490 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7491 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7492 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7493 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7494 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7495 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7496 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7497 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7498 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7499 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7500 | { } /* end */ |
| 7501 | }; |
| 7502 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7503 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7504 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7505 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7506 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7507 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7508 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7509 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7510 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7511 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7512 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7513 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7514 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7515 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7516 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7517 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7518 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7519 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7520 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7521 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7522 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7523 | { } /* end */ |
| 7524 | }; |
| 7525 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7526 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7527 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7529 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7530 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7531 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7532 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7533 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7534 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7535 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7536 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7537 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7538 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7539 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7540 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7541 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7542 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7543 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7544 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7545 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7546 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7549 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7550 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7551 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7552 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7553 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7554 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7555 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7556 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7557 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7558 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7559 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7560 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7561 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7562 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7563 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7564 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7565 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7566 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7568 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7569 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7570 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7571 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7572 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7573 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7574 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7575 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7577 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7578 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7579 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7581 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7582 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7583 | { } /* end */ |
| 7584 | }; |
| 7585 | |
| 7586 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7587 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7588 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7589 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7590 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7591 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7594 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7595 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7596 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7597 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7598 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7599 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7600 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7601 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7602 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7603 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7604 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7605 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7606 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7607 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7608 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7609 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7610 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7611 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 7612 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7613 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7614 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7615 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 7616 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7617 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7621 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7622 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7623 | { } /* end */ |
| 7624 | }; |
| 7625 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7626 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7627 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7628 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7629 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7630 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7631 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7632 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7633 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7634 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7635 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7636 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7637 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7638 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7639 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7640 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7641 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7643 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7644 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7645 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7646 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7647 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7648 | { } /* end */ |
| 7649 | }; |
| 7650 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7651 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 7652 | /* Output mixers */ |
| 7653 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7654 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7655 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7656 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7657 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 7658 | HDA_OUTPUT), |
| 7659 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 7660 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 7661 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 7662 | /* Output switches */ |
| 7663 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 7664 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 7665 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 7666 | /* Boost mixers */ |
| 7667 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7668 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 7669 | /* Input mixers */ |
| 7670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7673 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7674 | { } /* end */ |
| 7675 | }; |
| 7676 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 7677 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 7678 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7679 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7680 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7682 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7683 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7684 | { } /* end */ |
| 7685 | }; |
| 7686 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7687 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7688 | .ops = &snd_hda_bind_vol, |
| 7689 | .values = { |
| 7690 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7691 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7692 | 0 |
| 7693 | }, |
| 7694 | }; |
| 7695 | |
| 7696 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7697 | .ops = &snd_hda_bind_sw, |
| 7698 | .values = { |
| 7699 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7700 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7701 | 0 |
| 7702 | }, |
| 7703 | }; |
| 7704 | |
| 7705 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7706 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7707 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7708 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7709 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7710 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7711 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7712 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7713 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7714 | { } /* end */ |
| 7715 | }; |
| 7716 | |
| 7717 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7718 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7719 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7720 | { |
| 7721 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7722 | /* .name = "Capture Source", */ |
| 7723 | .name = "Input Source", |
| 7724 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7725 | .info = alc_mux_enum_info, |
| 7726 | .get = alc_mux_enum_get, |
| 7727 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7728 | }, |
| 7729 | { } /* end */ |
| 7730 | }; |
| 7731 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7732 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7733 | { |
| 7734 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7735 | .name = "Channel Mode", |
| 7736 | .info = alc_ch_mode_info, |
| 7737 | .get = alc_ch_mode_get, |
| 7738 | .put = alc_ch_mode_put, |
| 7739 | }, |
| 7740 | { } /* end */ |
| 7741 | }; |
| 7742 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7743 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7744 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7745 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7746 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7747 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7748 | spec->autocfg.hp_pins[0] = 0x15; |
| 7749 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7750 | spec->autocfg.speaker_pins[1] = 0x17; |
| 7751 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7752 | } |
| 7753 | |
| 7754 | /* auto-toggle front mic */ |
| 7755 | /* |
| 7756 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7757 | { |
| 7758 | unsigned int present; |
| 7759 | unsigned char bits; |
| 7760 | |
| 7761 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7762 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7763 | bits = present ? HDA_AMP_MUTE : 0; |
| 7764 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7765 | } |
| 7766 | */ |
| 7767 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7768 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7769 | /* HP */ |
| 7770 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7771 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7772 | /* Subwoofer */ |
| 7773 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7774 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7775 | |
| 7776 | /* enable unsolicited event */ |
| 7777 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7778 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7779 | |
| 7780 | { } /* end */ |
| 7781 | }; |
| 7782 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7783 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7784 | /* HP */ |
| 7785 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7786 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7787 | /* Int speaker */ |
| 7788 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7790 | |
| 7791 | /* enable unsolicited event */ |
| 7792 | {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] | 7793 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7794 | |
| 7795 | { } /* end */ |
| 7796 | }; |
| 7797 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7798 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7799 | /* HP */ |
| 7800 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7801 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7802 | /* Subwoofer */ |
| 7803 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7805 | |
| 7806 | /* enable unsolicited event */ |
| 7807 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7808 | |
| 7809 | { } /* end */ |
| 7810 | }; |
| 7811 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7812 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7814 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7815 | |
| 7816 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7817 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7818 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7819 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 7820 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7821 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7822 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7823 | /* Connect Mic jack to CLFE */ |
| 7824 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7825 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7826 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7827 | /* Connect Line-in jack to Surround */ |
| 7828 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7829 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7830 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7831 | /* Connect HP out jack to Front */ |
| 7832 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7833 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7834 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7835 | |
| 7836 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7837 | |
| 7838 | { } /* end */ |
| 7839 | }; |
| 7840 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7841 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7842 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7843 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7844 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7845 | { } /* end */ |
| 7846 | }; |
| 7847 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7848 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7849 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7850 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7851 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7852 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7853 | { } /* end */ |
| 7854 | }; |
| 7855 | |
| 7856 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7857 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7858 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7859 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7860 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7861 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7862 | { } /* end */ |
| 7863 | }; |
| 7864 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7865 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7866 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7867 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7868 | |
| 7869 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7870 | |
| 7871 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7872 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7873 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7874 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7875 | { } /* end */ |
| 7876 | }; |
| 7877 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7878 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 7879 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7880 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7881 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7882 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7883 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7884 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7885 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7886 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7887 | { } /* end */ |
| 7888 | }; |
| 7889 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 7890 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 7891 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7892 | { } |
| 7893 | }; |
| 7894 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 7895 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 7896 | /* HP */ |
| 7897 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7898 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7899 | |
| 7900 | /* enable unsolicited event */ |
| 7901 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7902 | |
| 7903 | { } /* end */ |
| 7904 | }; |
| 7905 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7906 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 7907 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7908 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 7909 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7910 | spec->autocfg.hp_pins[0] = 0x1b; |
| 7911 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7912 | spec->autocfg.speaker_pins[1] = 0x16; |
| 7913 | spec->autocfg.speaker_pins[2] = 0x18; |
| 7914 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 7915 | } |
| 7916 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7917 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7918 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7919 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7920 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7921 | {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] | 7922 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7923 | }; |
| 7924 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 7925 | /* |
| 7926 | * 2ch mode |
| 7927 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7928 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7929 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7930 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7931 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7932 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 7933 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7934 | }; |
| 7935 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 7936 | /* |
| 7937 | * 4ch mode |
| 7938 | */ |
| 7939 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 7940 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7941 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7942 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7943 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7944 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7945 | { } /* end */ |
| 7946 | }; |
| 7947 | |
| 7948 | /* |
| 7949 | * 6ch mode |
| 7950 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7951 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7952 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7953 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 7954 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7955 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7956 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 7957 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7958 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7959 | }; |
| 7960 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 7961 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7962 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 7963 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7964 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7965 | }; |
| 7966 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7967 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7968 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7969 | { |
| 7970 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7971 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7972 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7973 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7974 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7975 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7976 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7977 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7978 | } |
| 7979 | |
| 7980 | /* toggle RCA according to the front-jack state */ |
| 7981 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7982 | { |
| 7983 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7984 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7985 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7986 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7987 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7988 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7989 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7990 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7991 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7992 | unsigned int res) |
| 7993 | { |
| 7994 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7995 | alc888_lenovo_ms7195_front_automute(codec); |
| 7996 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7997 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7998 | } |
| 7999 | |
| 8000 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8001 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8002 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8003 | |
| 8004 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8005 | |
| 8006 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8007 | { } /* end */ |
| 8008 | }; |
| 8009 | |
| 8010 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8011 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8012 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8013 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8014 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8015 | spec->autocfg.hp_pins[0] = 0x14; |
| 8016 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8017 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8018 | } |
| 8019 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8020 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8021 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8022 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8023 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8024 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8025 | { |
| 8026 | unsigned int present; |
| 8027 | |
| 8028 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8029 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8030 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8031 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8032 | } |
| 8033 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8034 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8035 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8036 | struct alc_spec *spec = codec->spec; |
| 8037 | |
| 8038 | spec->autocfg.hp_pins[0] = 0x15; |
| 8039 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8040 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8041 | alc883_clevo_m720_mic_automute(codec); |
| 8042 | } |
| 8043 | |
| 8044 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8045 | unsigned int res) |
| 8046 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8047 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8048 | case ALC880_MIC_EVENT: |
| 8049 | alc883_clevo_m720_mic_automute(codec); |
| 8050 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8051 | default: |
| 8052 | alc_automute_amp_unsol_event(codec, res); |
| 8053 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8054 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8055 | } |
| 8056 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8057 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8058 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8059 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8060 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8061 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8062 | spec->autocfg.hp_pins[0] = 0x14; |
| 8063 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8064 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8065 | } |
| 8066 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8067 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8068 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8069 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8070 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8071 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8072 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8073 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8074 | } |
| 8075 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8076 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8077 | { |
| 8078 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8079 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8080 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8081 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8082 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8083 | bits = present ? HDA_AMP_MUTE : 0; |
| 8084 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8085 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8086 | } |
| 8087 | |
| 8088 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8089 | { |
| 8090 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8091 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8092 | |
| 8093 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8094 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8095 | bits = present ? HDA_AMP_MUTE : 0; |
| 8096 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8097 | HDA_AMP_MUTE, bits); |
| 8098 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8099 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8100 | } |
| 8101 | |
| 8102 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8103 | unsigned int res) |
| 8104 | { |
| 8105 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8106 | alc883_lenovo_101e_all_automute(codec); |
| 8107 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8108 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8109 | } |
| 8110 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8111 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8112 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8113 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8114 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8115 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8116 | spec->autocfg.hp_pins[0] = 0x14; |
| 8117 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8118 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8119 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8120 | } |
| 8121 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8122 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8123 | /* HP Pin: output 0 (0x0c) */ |
| 8124 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8125 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8126 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8127 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8128 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8129 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8130 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8131 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8132 | /* eanable EAPD on medion laptop */ |
| 8133 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8134 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8135 | /* enable unsolicited event */ |
| 8136 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8137 | { } |
| 8138 | }; |
| 8139 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8140 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8141 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8142 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8143 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8144 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8145 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8146 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8147 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8148 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8149 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8150 | } |
| 8151 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8152 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8153 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8154 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8155 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8156 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8157 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8158 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8159 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8160 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8161 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8162 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8163 | } |
| 8164 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8165 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8166 | { |
| 8167 | struct alc_spec *spec = codec->spec; |
| 8168 | |
| 8169 | spec->autocfg.hp_pins[0] = 0x15; |
| 8170 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8171 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8172 | alc_automute_amp(codec); |
| 8173 | } |
| 8174 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8175 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8176 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8178 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8179 | /* enable unsolicited event */ |
| 8180 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8181 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8182 | { } /* end */ |
| 8183 | }; |
| 8184 | |
| 8185 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8186 | { |
| 8187 | unsigned int present; |
| 8188 | |
| 8189 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8190 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8191 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8192 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8193 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8194 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8195 | } |
| 8196 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8197 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8198 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8199 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8200 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8201 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8202 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8203 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8204 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8205 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8206 | } |
| 8207 | |
| 8208 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8209 | unsigned int res) |
| 8210 | { |
| 8211 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8212 | case ALC880_MIC_EVENT: |
| 8213 | alc883_nb_mic_automute(codec); |
| 8214 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8215 | default: |
| 8216 | alc_sku_unsol_event(codec, res); |
| 8217 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8218 | } |
| 8219 | } |
| 8220 | |
| 8221 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8222 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8223 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8224 | alc883_nb_mic_automute(codec); |
| 8225 | } |
| 8226 | |
| 8227 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8228 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8229 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8230 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8231 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8232 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8233 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8234 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8235 | /* enable unsolicited event */ |
| 8236 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8237 | { } /* end */ |
| 8238 | }; |
| 8239 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8240 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8241 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8242 | struct alc_spec *spec = codec->spec; |
| 8243 | |
| 8244 | spec->autocfg.hp_pins[0] = 0x14; |
| 8245 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8246 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8247 | } |
| 8248 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8249 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8250 | /* Init rear pin (used as headphone output) */ |
| 8251 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8252 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8253 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8254 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8255 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8256 | /* Init line 2 pin (used as headphone out by default) */ |
| 8257 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8258 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8259 | { } /* end */ |
| 8260 | }; |
| 8261 | |
| 8262 | /* Mute speakers according to the headphone jack state */ |
| 8263 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8264 | { |
| 8265 | unsigned int present; |
| 8266 | |
| 8267 | /* Mute only in 2ch or 4ch mode */ |
| 8268 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8269 | == 0x00) { |
| 8270 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8271 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8272 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8273 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8274 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8275 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8276 | } |
| 8277 | } |
| 8278 | |
| 8279 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8280 | { |
| 8281 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8282 | alc889A_mb31_automute(codec); |
| 8283 | } |
| 8284 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8285 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8286 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8287 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8288 | #endif |
| 8289 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8290 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8291 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8292 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8293 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8294 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8295 | |
| 8296 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8297 | ALC1200_DIGOUT_NID, 0, |
| 8298 | }; |
| 8299 | |
| 8300 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8301 | ALC883_DIGOUT_NID, 0, |
| 8302 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8303 | |
| 8304 | /* |
| 8305 | * configuration and preset |
| 8306 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8307 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8308 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8309 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8310 | [ALC882_ARIMA] = "arima", |
| 8311 | [ALC882_W2JC] = "w2jc", |
| 8312 | [ALC882_TARGA] = "targa", |
| 8313 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8314 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8315 | [ALC885_MACPRO] = "macpro", |
| 8316 | [ALC885_MB5] = "mb5", |
| 8317 | [ALC885_MBP3] = "mbp3", |
| 8318 | [ALC885_IMAC24] = "imac24", |
| 8319 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8320 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8321 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8322 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8323 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8324 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8325 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8326 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8327 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8328 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8329 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8330 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8331 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8332 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8333 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8334 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8335 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8336 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8337 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8338 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8339 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8340 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8341 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8342 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8343 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8344 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8345 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8346 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8347 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8348 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8349 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8350 | }; |
| 8351 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8352 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8353 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8354 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8355 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8356 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8357 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8358 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8359 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8360 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8361 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8362 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8363 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8364 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8365 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8366 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8367 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8368 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8369 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8370 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8371 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8372 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8373 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8374 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8375 | /* default Acer -- disabled as it causes more problems. |
| 8376 | * model=auto should work fine now |
| 8377 | */ |
| 8378 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8379 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8380 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8381 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8382 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8383 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8384 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8385 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8386 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8387 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8388 | |
| 8389 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8390 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8391 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8392 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8393 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8394 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8395 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8396 | 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] | 8397 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8398 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8399 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8400 | |
| 8401 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8402 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8403 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8404 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8405 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8406 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8407 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8408 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8409 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8410 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8411 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8412 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8413 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8414 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8415 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8416 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8417 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8418 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8419 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8420 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8421 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8422 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8423 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8424 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame^] | 8425 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8426 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8427 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8428 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8429 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8430 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8431 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8432 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8433 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8434 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8435 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8436 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8437 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8438 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame^] | 8439 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8440 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8441 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8442 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8443 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8444 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8445 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8446 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8447 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8448 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8449 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8450 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8451 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8452 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8453 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8454 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8455 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8456 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8457 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8458 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8459 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8460 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8461 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8462 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8463 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8464 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Wu Fengguang | 4b55899 | 2009-01-12 09:18:58 +0800 | [diff] [blame] | 8465 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8466 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8467 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8468 | {} |
| 8469 | }; |
| 8470 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8471 | /* codec SSID table for Intel Mac */ |
| 8472 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8473 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8474 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8475 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8476 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8477 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8478 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8479 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8480 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8481 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8482 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8483 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8484 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8485 | * no perfect solution yet |
| 8486 | */ |
| 8487 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8488 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8489 | }; |
| 8490 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8491 | static struct alc_config_preset alc882_presets[] = { |
| 8492 | [ALC882_3ST_DIG] = { |
| 8493 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8494 | .init_verbs = { alc882_base_init_verbs, |
| 8495 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8496 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8497 | .dac_nids = alc882_dac_nids, |
| 8498 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8499 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8500 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8501 | .channel_mode = alc882_ch_modes, |
| 8502 | .need_dac_fix = 1, |
| 8503 | .input_mux = &alc882_capture_source, |
| 8504 | }, |
| 8505 | [ALC882_6ST_DIG] = { |
| 8506 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8507 | .init_verbs = { alc882_base_init_verbs, |
| 8508 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8509 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8510 | .dac_nids = alc882_dac_nids, |
| 8511 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8512 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8513 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8514 | .channel_mode = alc882_sixstack_modes, |
| 8515 | .input_mux = &alc882_capture_source, |
| 8516 | }, |
| 8517 | [ALC882_ARIMA] = { |
| 8518 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8519 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8520 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8521 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8522 | .dac_nids = alc882_dac_nids, |
| 8523 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8524 | .channel_mode = alc882_sixstack_modes, |
| 8525 | .input_mux = &alc882_capture_source, |
| 8526 | }, |
| 8527 | [ALC882_W2JC] = { |
| 8528 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8529 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8530 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8531 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8532 | .dac_nids = alc882_dac_nids, |
| 8533 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8534 | .channel_mode = alc880_threestack_modes, |
| 8535 | .need_dac_fix = 1, |
| 8536 | .input_mux = &alc882_capture_source, |
| 8537 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8538 | }, |
| 8539 | [ALC885_MBP3] = { |
| 8540 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8541 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8542 | alc880_gpio1_init_verbs }, |
| 8543 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8544 | .dac_nids = alc882_dac_nids, |
| 8545 | .channel_mode = alc885_mbp_6ch_modes, |
| 8546 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 8547 | .input_mux = &alc882_capture_source, |
| 8548 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8549 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8550 | .unsol_event = alc_automute_amp_unsol_event, |
| 8551 | .init_hook = alc885_mbp3_init_hook, |
| 8552 | }, |
| 8553 | [ALC885_MB5] = { |
| 8554 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8555 | .init_verbs = { alc885_mb5_init_verbs, |
| 8556 | alc880_gpio1_init_verbs }, |
| 8557 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8558 | .dac_nids = alc882_dac_nids, |
| 8559 | .channel_mode = alc885_mb5_6ch_modes, |
| 8560 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8561 | .input_mux = &mb5_capture_source, |
| 8562 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8563 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8564 | }, |
| 8565 | [ALC885_MACPRO] = { |
| 8566 | .mixers = { alc882_macpro_mixer }, |
| 8567 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8568 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8569 | .dac_nids = alc882_dac_nids, |
| 8570 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8571 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8572 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8573 | .channel_mode = alc882_ch_modes, |
| 8574 | .input_mux = &alc882_capture_source, |
| 8575 | .init_hook = alc885_macpro_init_hook, |
| 8576 | }, |
| 8577 | [ALC885_IMAC24] = { |
| 8578 | .mixers = { alc885_imac24_mixer }, |
| 8579 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8580 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8581 | .dac_nids = alc882_dac_nids, |
| 8582 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8583 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8584 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8585 | .channel_mode = alc882_ch_modes, |
| 8586 | .input_mux = &alc882_capture_source, |
| 8587 | .unsol_event = alc_automute_amp_unsol_event, |
| 8588 | .init_hook = alc885_imac24_init_hook, |
| 8589 | }, |
| 8590 | [ALC882_TARGA] = { |
| 8591 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8592 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8593 | alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8594 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8595 | .dac_nids = alc882_dac_nids, |
| 8596 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8597 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8598 | .adc_nids = alc882_adc_nids, |
| 8599 | .capsrc_nids = alc882_capsrc_nids, |
| 8600 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8601 | .channel_mode = alc882_3ST_6ch_modes, |
| 8602 | .need_dac_fix = 1, |
| 8603 | .input_mux = &alc882_capture_source, |
| 8604 | .unsol_event = alc882_targa_unsol_event, |
| 8605 | .init_hook = alc882_targa_init_hook, |
| 8606 | }, |
| 8607 | [ALC882_ASUS_A7J] = { |
| 8608 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8609 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8610 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8611 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8612 | .dac_nids = alc882_dac_nids, |
| 8613 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8614 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8615 | .adc_nids = alc882_adc_nids, |
| 8616 | .capsrc_nids = alc882_capsrc_nids, |
| 8617 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8618 | .channel_mode = alc882_3ST_6ch_modes, |
| 8619 | .need_dac_fix = 1, |
| 8620 | .input_mux = &alc882_capture_source, |
| 8621 | }, |
| 8622 | [ALC882_ASUS_A7M] = { |
| 8623 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8624 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8625 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8626 | alc882_asus_a7m_verbs }, |
| 8627 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8628 | .dac_nids = alc882_dac_nids, |
| 8629 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8630 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8631 | .channel_mode = alc880_threestack_modes, |
| 8632 | .need_dac_fix = 1, |
| 8633 | .input_mux = &alc882_capture_source, |
| 8634 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8635 | [ALC883_3ST_2ch_DIG] = { |
| 8636 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8637 | .init_verbs = { alc883_init_verbs }, |
| 8638 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8639 | .dac_nids = alc883_dac_nids, |
| 8640 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8641 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8642 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8643 | .channel_mode = alc883_3ST_2ch_modes, |
| 8644 | .input_mux = &alc883_capture_source, |
| 8645 | }, |
| 8646 | [ALC883_3ST_6ch_DIG] = { |
| 8647 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8648 | .init_verbs = { alc883_init_verbs }, |
| 8649 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8650 | .dac_nids = alc883_dac_nids, |
| 8651 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8652 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8653 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8654 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8655 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8656 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8657 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8658 | [ALC883_3ST_6ch] = { |
| 8659 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8660 | .init_verbs = { alc883_init_verbs }, |
| 8661 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8662 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8663 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8664 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8665 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8666 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8667 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8668 | [ALC883_3ST_6ch_INTEL] = { |
| 8669 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8670 | .init_verbs = { alc883_init_verbs }, |
| 8671 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8672 | .dac_nids = alc883_dac_nids, |
| 8673 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8674 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8675 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8676 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8677 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8678 | .need_dac_fix = 1, |
| 8679 | .input_mux = &alc883_3stack_6ch_intel, |
| 8680 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8681 | [ALC883_6ST_DIG] = { |
| 8682 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8683 | .init_verbs = { alc883_init_verbs }, |
| 8684 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8685 | .dac_nids = alc883_dac_nids, |
| 8686 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8687 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8688 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8689 | .channel_mode = alc883_sixstack_modes, |
| 8690 | .input_mux = &alc883_capture_source, |
| 8691 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8692 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8693 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
| 8694 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8695 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8696 | .dac_nids = alc883_dac_nids, |
| 8697 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8698 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8699 | .channel_mode = alc883_3ST_6ch_modes, |
| 8700 | .need_dac_fix = 1, |
| 8701 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8702 | .unsol_event = alc883_targa_unsol_event, |
| 8703 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8704 | }, |
| 8705 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8706 | .mixers = { alc883_targa_2ch_mixer}, |
| 8707 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8708 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8709 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8710 | .adc_nids = alc883_adc_nids_alt, |
| 8711 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8712 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8713 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8714 | .channel_mode = alc883_3ST_2ch_modes, |
| 8715 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8716 | .unsol_event = alc883_targa_unsol_event, |
| 8717 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8718 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8719 | [ALC883_TARGA_8ch_DIG] = { |
| 8720 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8721 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8722 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8723 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8724 | .dac_nids = alc883_dac_nids, |
| 8725 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8726 | .adc_nids = alc883_adc_nids_rev, |
| 8727 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8728 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8729 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8730 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 8731 | .channel_mode = alc883_4ST_8ch_modes, |
| 8732 | .need_dac_fix = 1, |
| 8733 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8734 | .unsol_event = alc883_targa_unsol_event, |
| 8735 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8736 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8737 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8738 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8739 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8740 | * and the headphone jack. Turn this on and rely on the |
| 8741 | * standard mute methods whenever the user wants to turn |
| 8742 | * these outputs off. |
| 8743 | */ |
| 8744 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8745 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8746 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8747 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8748 | .channel_mode = alc883_3ST_2ch_modes, |
| 8749 | .input_mux = &alc883_capture_source, |
| 8750 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8751 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8752 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8753 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8754 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8755 | .dac_nids = alc883_dac_nids, |
| 8756 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8757 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8758 | .channel_mode = alc883_3ST_2ch_modes, |
| 8759 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8760 | .unsol_event = alc_automute_amp_unsol_event, |
| 8761 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8762 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8763 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8764 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8765 | alc883_chmode_mixer }, |
| 8766 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8767 | alc888_acer_aspire_4930g_verbs }, |
| 8768 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8769 | .dac_nids = alc883_dac_nids, |
| 8770 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8771 | .adc_nids = alc883_adc_nids_rev, |
| 8772 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8773 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8774 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8775 | .channel_mode = alc883_3ST_6ch_modes, |
| 8776 | .need_dac_fix = 1, |
| 8777 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8778 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8779 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8780 | .unsol_event = alc_automute_amp_unsol_event, |
| 8781 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8782 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8783 | [ALC888_ACER_ASPIRE_6530G] = { |
| 8784 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 8785 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8786 | alc888_acer_aspire_6530g_verbs }, |
| 8787 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8788 | .dac_nids = alc883_dac_nids, |
| 8789 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8790 | .adc_nids = alc883_adc_nids_rev, |
| 8791 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8792 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8793 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8794 | .channel_mode = alc883_3ST_2ch_modes, |
| 8795 | .num_mux_defs = |
| 8796 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8797 | .input_mux = alc888_acer_aspire_6530_sources, |
| 8798 | .unsol_event = alc_automute_amp_unsol_event, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 8799 | .init_hook = alc888_acer_aspire_6530g_init_hook, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8800 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8801 | [ALC888_ACER_ASPIRE_8930G] = { |
| 8802 | .mixers = { alc888_base_mixer, |
| 8803 | alc883_chmode_mixer }, |
| 8804 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 8805 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8806 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8807 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 8808 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 8809 | .adc_nids = alc889_adc_nids, |
| 8810 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8811 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8813 | .channel_mode = alc883_3ST_6ch_modes, |
| 8814 | .need_dac_fix = 1, |
| 8815 | .const_channel_count = 6, |
| 8816 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 8817 | ARRAY_SIZE(alc889_capture_sources), |
| 8818 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8819 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 8820 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8821 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8822 | [ALC883_MEDION] = { |
| 8823 | .mixers = { alc883_fivestack_mixer, |
| 8824 | alc883_chmode_mixer }, |
| 8825 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8826 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8827 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8828 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8829 | .adc_nids = alc883_adc_nids_alt, |
| 8830 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8831 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8832 | .channel_mode = alc883_sixstack_modes, |
| 8833 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8834 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8835 | [ALC883_MEDION_MD2] = { |
| 8836 | .mixers = { alc883_medion_md2_mixer}, |
| 8837 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8838 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8839 | .dac_nids = alc883_dac_nids, |
| 8840 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8841 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8842 | .channel_mode = alc883_3ST_2ch_modes, |
| 8843 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8844 | .unsol_event = alc_automute_amp_unsol_event, |
| 8845 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8846 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8847 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8848 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8849 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8850 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8851 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8852 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8853 | .channel_mode = alc883_3ST_2ch_modes, |
| 8854 | .input_mux = &alc883_capture_source, |
| 8855 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8856 | [ALC883_CLEVO_M720] = { |
| 8857 | .mixers = { alc883_clevo_m720_mixer }, |
| 8858 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8859 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8860 | .dac_nids = alc883_dac_nids, |
| 8861 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8862 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8863 | .channel_mode = alc883_3ST_2ch_modes, |
| 8864 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8865 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8866 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8867 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8868 | [ALC883_LENOVO_101E_2ch] = { |
| 8869 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8870 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8871 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8872 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8873 | .adc_nids = alc883_adc_nids_alt, |
| 8874 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8875 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8876 | .channel_mode = alc883_3ST_2ch_modes, |
| 8877 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8878 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8879 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8880 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8881 | [ALC883_LENOVO_NB0763] = { |
| 8882 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8883 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8884 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8885 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8886 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8887 | .channel_mode = alc883_3ST_2ch_modes, |
| 8888 | .need_dac_fix = 1, |
| 8889 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8890 | .unsol_event = alc_automute_amp_unsol_event, |
| 8891 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8892 | }, |
| 8893 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8894 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8895 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8896 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8897 | .dac_nids = alc883_dac_nids, |
| 8898 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8899 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8900 | .channel_mode = alc883_3ST_6ch_modes, |
| 8901 | .need_dac_fix = 1, |
| 8902 | .input_mux = &alc883_capture_source, |
| 8903 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8904 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8905 | }, |
| 8906 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8907 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8908 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8909 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8910 | .dac_nids = alc883_dac_nids, |
| 8911 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8912 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8913 | .channel_mode = alc883_3ST_2ch_modes, |
| 8914 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8915 | .unsol_event = alc_automute_amp_unsol_event, |
| 8916 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8917 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8918 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8919 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8920 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8921 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8922 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8923 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8924 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8925 | .need_dac_fix = 1, |
| 8926 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8927 | .unsol_event = alc_automute_amp_unsol_event, |
| 8928 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8929 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8930 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8931 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8932 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8933 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8934 | .dac_nids = alc883_dac_nids, |
| 8935 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8936 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8937 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8938 | .channel_mode = alc883_sixstack_modes, |
| 8939 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8940 | .unsol_event = alc_automute_amp_unsol_event, |
| 8941 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8942 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8943 | [ALC883_MITAC] = { |
| 8944 | .mixers = { alc883_mitac_mixer }, |
| 8945 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8946 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8947 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8948 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8949 | .channel_mode = alc883_3ST_2ch_modes, |
| 8950 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8951 | .unsol_event = alc_automute_amp_unsol_event, |
| 8952 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8953 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8954 | [ALC883_FUJITSU_PI2515] = { |
| 8955 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8956 | .init_verbs = { alc883_init_verbs, |
| 8957 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8958 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8959 | .dac_nids = alc883_dac_nids, |
| 8960 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8961 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8962 | .channel_mode = alc883_3ST_2ch_modes, |
| 8963 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8964 | .unsol_event = alc_automute_amp_unsol_event, |
| 8965 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8966 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8967 | [ALC888_FUJITSU_XA3530] = { |
| 8968 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 8969 | .init_verbs = { alc883_init_verbs, |
| 8970 | alc888_fujitsu_xa3530_verbs }, |
| 8971 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8972 | .dac_nids = alc883_dac_nids, |
| 8973 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8974 | .adc_nids = alc883_adc_nids_rev, |
| 8975 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8976 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8977 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 8978 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 8979 | .num_mux_defs = |
| 8980 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8981 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8982 | .unsol_event = alc_automute_amp_unsol_event, |
| 8983 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8984 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8985 | [ALC888_LENOVO_SKY] = { |
| 8986 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 8987 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 8988 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8989 | .dac_nids = alc883_dac_nids, |
| 8990 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8991 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8992 | .channel_mode = alc883_sixstack_modes, |
| 8993 | .need_dac_fix = 1, |
| 8994 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8995 | .unsol_event = alc_automute_amp_unsol_event, |
| 8996 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8997 | }, |
| 8998 | [ALC888_ASUS_M90V] = { |
| 8999 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9000 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9001 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9002 | .dac_nids = alc883_dac_nids, |
| 9003 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9004 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9005 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9006 | .channel_mode = alc883_3ST_6ch_modes, |
| 9007 | .need_dac_fix = 1, |
| 9008 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9009 | .unsol_event = alc883_mode2_unsol_event, |
| 9010 | .init_hook = alc883_mode2_inithook, |
| 9011 | }, |
| 9012 | [ALC888_ASUS_EEE1601] = { |
| 9013 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9014 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9015 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9016 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9017 | .dac_nids = alc883_dac_nids, |
| 9018 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9019 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9020 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9021 | .channel_mode = alc883_3ST_2ch_modes, |
| 9022 | .need_dac_fix = 1, |
| 9023 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9024 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9025 | .init_hook = alc883_eee1601_inithook, |
| 9026 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9027 | [ALC1200_ASUS_P5Q] = { |
| 9028 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9029 | .init_verbs = { alc883_init_verbs }, |
| 9030 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9031 | .dac_nids = alc883_dac_nids, |
| 9032 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9033 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9034 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9035 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9036 | .channel_mode = alc883_sixstack_modes, |
| 9037 | .input_mux = &alc883_capture_source, |
| 9038 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9039 | [ALC889A_MB31] = { |
| 9040 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9041 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9042 | alc880_gpio1_init_verbs }, |
| 9043 | .adc_nids = alc883_adc_nids, |
| 9044 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9045 | .dac_nids = alc883_dac_nids, |
| 9046 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9047 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9048 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9049 | .input_mux = &alc889A_mb31_capture_source, |
| 9050 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9051 | .unsol_event = alc889A_mb31_unsol_event, |
| 9052 | .init_hook = alc889A_mb31_automute, |
| 9053 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9054 | [ALC883_SONY_VAIO_TT] = { |
| 9055 | .mixers = { alc883_vaiott_mixer }, |
| 9056 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9057 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9058 | .dac_nids = alc883_dac_nids, |
| 9059 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9060 | .channel_mode = alc883_3ST_2ch_modes, |
| 9061 | .input_mux = &alc883_capture_source, |
| 9062 | .unsol_event = alc_automute_amp_unsol_event, |
| 9063 | .init_hook = alc883_vaiott_init_hook, |
| 9064 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9065 | }; |
| 9066 | |
| 9067 | |
| 9068 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9069 | * Pin config fixes |
| 9070 | */ |
| 9071 | enum { |
| 9072 | PINFIX_ABIT_AW9D_MAX |
| 9073 | }; |
| 9074 | |
| 9075 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9076 | { 0x15, 0x01080104 }, /* side */ |
| 9077 | { 0x16, 0x01011012 }, /* rear */ |
| 9078 | { 0x17, 0x01016011 }, /* clfe */ |
| 9079 | { } |
| 9080 | }; |
| 9081 | |
| 9082 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9083 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9084 | }; |
| 9085 | |
| 9086 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9087 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9088 | {} |
| 9089 | }; |
| 9090 | |
| 9091 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9092 | * BIOS auto configuration |
| 9093 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9094 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9095 | hda_nid_t nid, int pin_type, |
| 9096 | int dac_idx) |
| 9097 | { |
| 9098 | /* set as output */ |
| 9099 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9100 | int idx; |
| 9101 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9102 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9103 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9104 | idx = 4; |
| 9105 | else |
| 9106 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9107 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9108 | |
| 9109 | } |
| 9110 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9111 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9112 | { |
| 9113 | struct alc_spec *spec = codec->spec; |
| 9114 | int i; |
| 9115 | |
| 9116 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9117 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9118 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9119 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9120 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9121 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9122 | } |
| 9123 | } |
| 9124 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9125 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9126 | { |
| 9127 | struct alc_spec *spec = codec->spec; |
| 9128 | hda_nid_t pin; |
| 9129 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9130 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9131 | if (pin) /* connect to front */ |
| 9132 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9133 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9134 | pin = spec->autocfg.speaker_pins[0]; |
| 9135 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9136 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9137 | } |
| 9138 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9139 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9140 | { |
| 9141 | struct alc_spec *spec = codec->spec; |
| 9142 | int i; |
| 9143 | |
| 9144 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9145 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9146 | if (!nid) |
| 9147 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9148 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9149 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9150 | snd_hda_codec_write(codec, nid, 0, |
| 9151 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9152 | AMP_OUT_MUTE); |
| 9153 | } |
| 9154 | } |
| 9155 | |
| 9156 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9157 | { |
| 9158 | struct alc_spec *spec = codec->spec; |
| 9159 | int c; |
| 9160 | |
| 9161 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9162 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9163 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9164 | unsigned int mux_idx; |
| 9165 | const struct hda_input_mux *imux; |
| 9166 | int conns, mute, idx, item; |
| 9167 | |
| 9168 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9169 | ARRAY_SIZE(conn_list)); |
| 9170 | if (conns < 0) |
| 9171 | continue; |
| 9172 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9173 | imux = &spec->input_mux[mux_idx]; |
| 9174 | for (idx = 0; idx < conns; idx++) { |
| 9175 | /* if the current connection is the selected one, |
| 9176 | * unmute it as default - otherwise mute it |
| 9177 | */ |
| 9178 | mute = AMP_IN_MUTE(idx); |
| 9179 | for (item = 0; item < imux->num_items; item++) { |
| 9180 | if (imux->items[item].index == idx) { |
| 9181 | if (spec->cur_mux[c] == item) |
| 9182 | mute = AMP_IN_UNMUTE(idx); |
| 9183 | break; |
| 9184 | } |
| 9185 | } |
| 9186 | /* check if we have a selector or mixer |
| 9187 | * we could check for the widget type instead, but |
| 9188 | * just check for Amp-In presence (in case of mixer |
| 9189 | * without amp-in there is something wrong, this |
| 9190 | * function shouldn't be used or capsrc nid is wrong) |
| 9191 | */ |
| 9192 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9193 | snd_hda_codec_write(codec, nid, 0, |
| 9194 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9195 | mute); |
| 9196 | else if (mute != AMP_IN_MUTE(idx)) |
| 9197 | snd_hda_codec_write(codec, nid, 0, |
| 9198 | AC_VERB_SET_CONNECT_SEL, |
| 9199 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9200 | } |
| 9201 | } |
| 9202 | } |
| 9203 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9204 | /* add mic boosts if needed */ |
| 9205 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9206 | { |
| 9207 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9208 | int err; |
| 9209 | hda_nid_t nid; |
| 9210 | |
| 9211 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9212 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9213 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9214 | "Mic Boost", |
| 9215 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9216 | if (err < 0) |
| 9217 | return err; |
| 9218 | } |
| 9219 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9220 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9221 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9222 | "Front Mic Boost", |
| 9223 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9224 | if (err < 0) |
| 9225 | return err; |
| 9226 | } |
| 9227 | return 0; |
| 9228 | } |
| 9229 | |
| 9230 | /* almost identical with ALC880 parser... */ |
| 9231 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9232 | { |
| 9233 | struct alc_spec *spec = codec->spec; |
| 9234 | struct auto_pin_cfg *autocfg = &spec->autocfg; |
| 9235 | unsigned int wcap; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9236 | int i; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9237 | int err = alc880_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9238 | |
| 9239 | if (err < 0) |
| 9240 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9241 | else if (!err) |
| 9242 | return 0; /* no config found */ |
| 9243 | |
| 9244 | err = alc_auto_add_mic_boost(codec); |
| 9245 | if (err < 0) |
| 9246 | return err; |
| 9247 | |
| 9248 | /* hack - override the init verbs */ |
| 9249 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9250 | /* if ADC 0x07 is available, initialize it, too */ |
| 9251 | wcap = get_wcaps(codec, 0x07); |
| 9252 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 9253 | if (wcap == AC_WID_AUD_IN) |
| 9254 | add_verb(spec, alc882_adc1_init_verbs); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9255 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9256 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9257 | * because it's under 0x18 |
| 9258 | */ |
| 9259 | if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9260 | autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9261 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9262 | for (i = 1; i < 3; i++) |
| 9263 | memcpy(&spec->private_imux[i], |
| 9264 | &spec->private_imux[0], |
| 9265 | sizeof(spec->private_imux[0])); |
| 9266 | imux->items[imux->num_items].label = "Int DMic"; |
| 9267 | imux->items[imux->num_items].index = 0x0b; |
| 9268 | imux->num_items++; |
| 9269 | spec->num_mux_defs = 3; |
| 9270 | spec->input_mux = spec->private_imux; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9271 | } |
| 9272 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9273 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9274 | } |
| 9275 | |
| 9276 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9277 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9278 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9279 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9280 | alc882_auto_init_multi_out(codec); |
| 9281 | alc882_auto_init_hp_out(codec); |
| 9282 | alc882_auto_init_analog_input(codec); |
| 9283 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9284 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9285 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9286 | } |
| 9287 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9288 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9289 | { |
| 9290 | struct alc_spec *spec; |
| 9291 | int err, board_config; |
| 9292 | |
| 9293 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9294 | if (spec == NULL) |
| 9295 | return -ENOMEM; |
| 9296 | |
| 9297 | codec->spec = spec; |
| 9298 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9299 | switch (codec->vendor_id) { |
| 9300 | case 0x10ec0882: |
| 9301 | case 0x10ec0885: |
| 9302 | break; |
| 9303 | default: |
| 9304 | /* ALC883 and variants */ |
| 9305 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9306 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9307 | } |
| 9308 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9309 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9310 | alc882_models, |
| 9311 | alc882_cfg_tbl); |
| 9312 | |
| 9313 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9314 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9315 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9316 | |
| 9317 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
| 9318 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 9319 | "trying auto-probe from BIOS...\n", |
| 9320 | codec->chip_name); |
| 9321 | board_config = ALC882_AUTO; |
| 9322 | } |
| 9323 | |
| 9324 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9325 | |
| 9326 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9327 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9328 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9329 | if (err < 0) { |
| 9330 | alc_free(codec); |
| 9331 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9332 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9333 | printk(KERN_INFO |
| 9334 | "hda_codec: Cannot set up configuration " |
| 9335 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9336 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9337 | } |
| 9338 | } |
| 9339 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9340 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9341 | if (err < 0) { |
| 9342 | alc_free(codec); |
| 9343 | return err; |
| 9344 | } |
| 9345 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9346 | if (board_config != ALC882_AUTO) |
| 9347 | setup_preset(spec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9348 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9349 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9350 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9351 | /* FIXME: setup DAC5 */ |
| 9352 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9353 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9354 | |
| 9355 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9356 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9357 | |
| 9358 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9359 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9360 | |
| 9361 | if (!spec->adc_nids && spec->input_mux) { |
| 9362 | int i; |
| 9363 | spec->num_adc_nids = 0; |
| 9364 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9365 | hda_nid_t cap; |
| 9366 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9367 | unsigned int wcap = get_wcaps(codec, nid); |
| 9368 | /* get type */ |
| 9369 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 9370 | if (wcap != AC_WID_AUD_IN) |
| 9371 | continue; |
| 9372 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9373 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9374 | if (err < 0) |
| 9375 | continue; |
| 9376 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9377 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9378 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9379 | spec->adc_nids = spec->private_adc_nids; |
| 9380 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9381 | } |
| 9382 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9383 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9384 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9385 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9386 | spec->vmaster_nid = 0x0c; |
| 9387 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9388 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9389 | if (board_config == ALC882_AUTO) |
| 9390 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9391 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9392 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9393 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9394 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9395 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9396 | |
| 9397 | return 0; |
| 9398 | } |
| 9399 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9400 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9401 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9402 | * ALC262 support |
| 9403 | */ |
| 9404 | |
| 9405 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9406 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9407 | |
| 9408 | #define alc262_dac_nids alc260_dac_nids |
| 9409 | #define alc262_adc_nids alc882_adc_nids |
| 9410 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9411 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9412 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9413 | |
| 9414 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9415 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9416 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9417 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9418 | /* ADC0 */ |
| 9419 | 0x09 |
| 9420 | }; |
| 9421 | |
| 9422 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9423 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9424 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9425 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9426 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9427 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9428 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9429 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9430 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9431 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9433 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9434 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9436 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9437 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9438 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9439 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9440 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9441 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9442 | }; |
| 9443 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9444 | /* update HP, line and mono-out pins according to the master switch */ |
| 9445 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9446 | { |
| 9447 | struct alc_spec *spec = codec->spec; |
| 9448 | int val = spec->master_sw; |
| 9449 | |
| 9450 | /* HP & line-out */ |
| 9451 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9452 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9453 | val ? PIN_HP : 0); |
| 9454 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9455 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9456 | val ? PIN_HP : 0); |
| 9457 | /* mono (speaker) depending on the HP jack sense */ |
| 9458 | val = val && !spec->jack_present; |
| 9459 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9460 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9461 | val ? PIN_OUT : 0); |
| 9462 | } |
| 9463 | |
| 9464 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9465 | { |
| 9466 | struct alc_spec *spec = codec->spec; |
| 9467 | unsigned int presence; |
| 9468 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9469 | AC_VERB_GET_PIN_SENSE, 0); |
| 9470 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9471 | alc262_hp_master_update(codec); |
| 9472 | } |
| 9473 | |
| 9474 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9475 | { |
| 9476 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9477 | return; |
| 9478 | alc262_hp_bpc_automute(codec); |
| 9479 | } |
| 9480 | |
| 9481 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9482 | { |
| 9483 | struct alc_spec *spec = codec->spec; |
| 9484 | unsigned int presence; |
| 9485 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9486 | AC_VERB_GET_PIN_SENSE, 0); |
| 9487 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9488 | alc262_hp_master_update(codec); |
| 9489 | } |
| 9490 | |
| 9491 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9492 | unsigned int res) |
| 9493 | { |
| 9494 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9495 | return; |
| 9496 | alc262_hp_wildwest_automute(codec); |
| 9497 | } |
| 9498 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9499 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9500 | |
| 9501 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9502 | struct snd_ctl_elem_value *ucontrol) |
| 9503 | { |
| 9504 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9505 | struct alc_spec *spec = codec->spec; |
| 9506 | int val = !!*ucontrol->value.integer.value; |
| 9507 | |
| 9508 | if (val == spec->master_sw) |
| 9509 | return 0; |
| 9510 | spec->master_sw = val; |
| 9511 | alc262_hp_master_update(codec); |
| 9512 | return 1; |
| 9513 | } |
| 9514 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9515 | #define ALC262_HP_MASTER_SWITCH \ |
| 9516 | { \ |
| 9517 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9518 | .name = "Master Playback Switch", \ |
| 9519 | .info = snd_ctl_boolean_mono_info, \ |
| 9520 | .get = alc262_hp_master_sw_get, \ |
| 9521 | .put = alc262_hp_master_sw_put, \ |
| 9522 | } |
| 9523 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9524 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9525 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9526 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9527 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9529 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9530 | HDA_OUTPUT), |
| 9531 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9532 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9535 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9536 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9537 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9538 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9539 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9540 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9541 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9542 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9543 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9544 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9545 | { } /* end */ |
| 9546 | }; |
| 9547 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9548 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9549 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9550 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9551 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9552 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9553 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9554 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9555 | HDA_OUTPUT), |
| 9556 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9557 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9558 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9559 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9560 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9561 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9562 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9563 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9564 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9565 | { } /* end */ |
| 9566 | }; |
| 9567 | |
| 9568 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9569 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9570 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9571 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9572 | { } /* end */ |
| 9573 | }; |
| 9574 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9575 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9576 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9577 | { |
| 9578 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9579 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9580 | spec->autocfg.hp_pins[0] = 0x15; |
| 9581 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 9582 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9583 | } |
| 9584 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9585 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9586 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9587 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9588 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9589 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9590 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9591 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9592 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9593 | { } /* end */ |
| 9594 | }; |
| 9595 | |
| 9596 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9597 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9598 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9599 | |
| 9600 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9601 | { } |
| 9602 | }; |
| 9603 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9604 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9605 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9606 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9607 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9608 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9609 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9610 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9611 | { } /* end */ |
| 9612 | }; |
| 9613 | |
| 9614 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9615 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9616 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9617 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9618 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9619 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9620 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9622 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9623 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9624 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9625 | {} |
| 9626 | }; |
| 9627 | |
| 9628 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9629 | .num_items = 1, |
| 9630 | .items = { |
| 9631 | { "Line", 0x1 }, |
| 9632 | }, |
| 9633 | }; |
| 9634 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9635 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 9636 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 9637 | { |
| 9638 | struct alc_spec *spec = codec->spec; |
| 9639 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9640 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9641 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9642 | unsigned int mute; |
| 9643 | |
| 9644 | /* HP */ |
| 9645 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 9646 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 9647 | HDA_AMP_MUTE, mute); |
| 9648 | /* mute internal speaker per jack sense */ |
| 9649 | if (spec->jack_present) |
| 9650 | mute = HDA_AMP_MUTE; |
| 9651 | if (line_nid) |
| 9652 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 9653 | HDA_AMP_MUTE, mute); |
| 9654 | if (speaker_nid && speaker_nid != line_nid) |
| 9655 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 9656 | HDA_AMP_MUTE, mute); |
| 9657 | } |
| 9658 | |
| 9659 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 9660 | |
| 9661 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9662 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9663 | { |
| 9664 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9665 | struct alc_spec *spec = codec->spec; |
| 9666 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9667 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9668 | if (val == spec->master_sw) |
| 9669 | return 0; |
| 9670 | spec->master_sw = val; |
| 9671 | alc262_hippo_master_update(codec); |
| 9672 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9673 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9674 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9675 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 9676 | { \ |
| 9677 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9678 | .name = "Master Playback Switch", \ |
| 9679 | .info = snd_ctl_boolean_mono_info, \ |
| 9680 | .get = alc262_hippo_master_sw_get, \ |
| 9681 | .put = alc262_hippo_master_sw_put, \ |
| 9682 | } |
| 9683 | |
| 9684 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 9685 | ALC262_HIPPO_MASTER_SWITCH, |
| 9686 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9687 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9688 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9693 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9694 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9695 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9696 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9697 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9698 | { } /* end */ |
| 9699 | }; |
| 9700 | |
| 9701 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9702 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9703 | ALC262_HIPPO_MASTER_SWITCH, |
| 9704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9706 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9707 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9708 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9710 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9711 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9712 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9713 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9714 | { } /* end */ |
| 9715 | }; |
| 9716 | |
| 9717 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9718 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 9719 | { |
| 9720 | struct alc_spec *spec = codec->spec; |
| 9721 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9722 | unsigned int present; |
| 9723 | |
| 9724 | /* need to execute and sync at first */ |
| 9725 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9726 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 9727 | AC_VERB_GET_PIN_SENSE, 0); |
| 9728 | spec->jack_present = (present & 0x80000000) != 0; |
| 9729 | alc262_hippo_master_update(codec); |
| 9730 | } |
| 9731 | |
| 9732 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9733 | { |
| 9734 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9735 | return; |
| 9736 | alc262_hippo_automute(codec); |
| 9737 | } |
| 9738 | |
| 9739 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 9740 | { |
| 9741 | struct alc_spec *spec = codec->spec; |
| 9742 | |
| 9743 | spec->autocfg.hp_pins[0] = 0x15; |
| 9744 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9745 | alc262_hippo_automute(codec); |
| 9746 | } |
| 9747 | |
| 9748 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 9749 | { |
| 9750 | struct alc_spec *spec = codec->spec; |
| 9751 | |
| 9752 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9753 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9754 | alc262_hippo_automute(codec); |
| 9755 | } |
| 9756 | |
| 9757 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9758 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9759 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9760 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9761 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9762 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9763 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9764 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9765 | { } /* end */ |
| 9766 | }; |
| 9767 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9768 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9769 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9770 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9774 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9775 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9776 | { } /* end */ |
| 9777 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9778 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9779 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9780 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9781 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9782 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9783 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9784 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9785 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9786 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9787 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9788 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9789 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9790 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9791 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9792 | { } /* end */ |
| 9793 | }; |
| 9794 | |
| 9795 | static struct hda_verb alc262_tyan_verbs[] = { |
| 9796 | /* Headphone automute */ |
| 9797 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9798 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9799 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9800 | |
| 9801 | /* P11 AUX_IN, white 4-pin connector */ |
| 9802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9803 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 9804 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 9805 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 9806 | |
| 9807 | {} |
| 9808 | }; |
| 9809 | |
| 9810 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9811 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9812 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9813 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9814 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9815 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9816 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9817 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9818 | } |
| 9819 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9821 | #define alc262_capture_mixer alc882_capture_mixer |
| 9822 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 9823 | |
| 9824 | /* |
| 9825 | * generic initialization of ADC, input mixers and output mixers |
| 9826 | */ |
| 9827 | static struct hda_verb alc262_init_verbs[] = { |
| 9828 | /* |
| 9829 | * Unmute ADC0-2 and set the default input to mic-in |
| 9830 | */ |
| 9831 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9832 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9833 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9835 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9836 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9837 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9838 | /* 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] | 9839 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9840 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9841 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9842 | */ |
| 9843 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9844 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9845 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9849 | |
| 9850 | /* |
| 9851 | * Set up output mixers (0x0c - 0x0e) |
| 9852 | */ |
| 9853 | /* set vol=0 to output mixers */ |
| 9854 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9855 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9857 | /* set up input amps for analog loopback */ |
| 9858 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9859 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9860 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9861 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9862 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9863 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9864 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9865 | |
| 9866 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9867 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9868 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9869 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9870 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9871 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9872 | |
| 9873 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9875 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9876 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9877 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9879 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9880 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9881 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9882 | /* FIXME: use matrix-type input source selection */ |
| 9883 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9884 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9885 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9886 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9887 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9888 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9889 | /* Input mixer2 */ |
| 9890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9891 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9892 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9893 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9894 | /* Input mixer3 */ |
| 9895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9896 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9897 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9898 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9899 | |
| 9900 | { } |
| 9901 | }; |
| 9902 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9903 | static struct hda_verb alc262_eapd_verbs[] = { |
| 9904 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9905 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9906 | { } |
| 9907 | }; |
| 9908 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9909 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 9910 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9911 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9912 | {} |
| 9913 | }; |
| 9914 | |
| 9915 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 9916 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9917 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9918 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 9919 | |
| 9920 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9921 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9922 | {} |
| 9923 | }; |
| 9924 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9925 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 9926 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9927 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9928 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 9929 | |
| 9930 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9931 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 9932 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9933 | }; |
| 9934 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9935 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 9936 | .num_items = 2, |
| 9937 | .items = { |
| 9938 | { "Int DMic", 0x9 }, |
| 9939 | { "Mic", 0x0 }, |
| 9940 | }, |
| 9941 | }; |
| 9942 | |
| 9943 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 9944 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9945 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9946 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9947 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9948 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9949 | { } /* end */ |
| 9950 | }; |
| 9951 | |
| 9952 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 9953 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9955 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9956 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9957 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 9958 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9959 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 9960 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9961 | {} |
| 9962 | }; |
| 9963 | |
| 9964 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 9965 | { |
| 9966 | unsigned int present; |
| 9967 | |
| 9968 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 9969 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 9970 | snd_hda_codec_write(codec, 0x22, 0, |
| 9971 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 9972 | } |
| 9973 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9974 | |
| 9975 | /* unsolicited event for HP jack sensing */ |
| 9976 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 9977 | unsigned int res) |
| 9978 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9979 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 9980 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9981 | else |
| 9982 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9983 | } |
| 9984 | |
| 9985 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 9986 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9987 | struct alc_spec *spec = codec->spec; |
| 9988 | |
| 9989 | spec->autocfg.hp_pins[0] = 0x15; |
| 9990 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9991 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9992 | alc262_dmic_automute(codec); |
| 9993 | } |
| 9994 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9995 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 9996 | * nec model |
| 9997 | * 0x15 = headphone |
| 9998 | * 0x16 = internal speaker |
| 9999 | * 0x18 = external mic |
| 10000 | */ |
| 10001 | |
| 10002 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10003 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10004 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10005 | |
| 10006 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10007 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10008 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10009 | |
| 10010 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10011 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10012 | { } /* end */ |
| 10013 | }; |
| 10014 | |
| 10015 | static struct hda_verb alc262_nec_verbs[] = { |
| 10016 | /* Unmute Speaker */ |
| 10017 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10018 | |
| 10019 | /* Headphone */ |
| 10020 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10021 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10022 | |
| 10023 | /* External mic to headphone */ |
| 10024 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10025 | /* External mic to speaker */ |
| 10026 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10027 | {} |
| 10028 | }; |
| 10029 | |
| 10030 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10031 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10032 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10033 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10034 | */ |
| 10035 | |
| 10036 | #define ALC_HP_EVENT 0x37 |
| 10037 | |
| 10038 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10039 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10040 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10041 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10042 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10043 | {} |
| 10044 | }; |
| 10045 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10046 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10047 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10048 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10049 | {} |
| 10050 | }; |
| 10051 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10052 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10053 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10054 | .items = { |
| 10055 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10056 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10057 | { "CD", 0x4 }, |
| 10058 | }, |
| 10059 | }; |
| 10060 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10061 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10062 | .num_items = 5, |
| 10063 | .items = { |
| 10064 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10065 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10066 | { "Line", 0x2 }, |
| 10067 | { "CD", 0x4 }, |
| 10068 | { "AUX IN", 0x6 }, |
| 10069 | }, |
| 10070 | }; |
| 10071 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10072 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10073 | .num_items = 4, |
| 10074 | .items = { |
| 10075 | { "Mic", 0x0 }, |
| 10076 | { "Front Mic", 0x2 }, |
| 10077 | { "Line", 0x1 }, |
| 10078 | { "CD", 0x4 }, |
| 10079 | }, |
| 10080 | }; |
| 10081 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10082 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10083 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10084 | { |
| 10085 | struct alc_spec *spec = codec->spec; |
| 10086 | unsigned int mute; |
| 10087 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10088 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10089 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10090 | /* need to execute and sync at first */ |
| 10091 | 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] | 10092 | /* check laptop HP jack */ |
| 10093 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10094 | AC_VERB_GET_PIN_SENSE, 0); |
| 10095 | /* need to execute and sync at first */ |
| 10096 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10097 | /* check docking HP jack */ |
| 10098 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10099 | AC_VERB_GET_PIN_SENSE, 0); |
| 10100 | if (present & AC_PINSENSE_PRESENCE) |
| 10101 | spec->jack_present = 1; |
| 10102 | else |
| 10103 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10104 | spec->sense_updated = 1; |
| 10105 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10106 | /* unmute internal speaker only if both HPs are unplugged and |
| 10107 | * master switch is on |
| 10108 | */ |
| 10109 | if (spec->jack_present) |
| 10110 | mute = HDA_AMP_MUTE; |
| 10111 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10112 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10113 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10114 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10115 | } |
| 10116 | |
| 10117 | /* unsolicited event for HP jack sensing */ |
| 10118 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10119 | unsigned int res) |
| 10120 | { |
| 10121 | if ((res >> 26) != ALC_HP_EVENT) |
| 10122 | return; |
| 10123 | alc262_fujitsu_automute(codec, 1); |
| 10124 | } |
| 10125 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10126 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10127 | { |
| 10128 | alc262_fujitsu_automute(codec, 1); |
| 10129 | } |
| 10130 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10131 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10132 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10133 | .ops = &snd_hda_bind_vol, |
| 10134 | .values = { |
| 10135 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10136 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10137 | 0 |
| 10138 | }, |
| 10139 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10140 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10141 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10142 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10143 | { |
| 10144 | struct alc_spec *spec = codec->spec; |
| 10145 | unsigned int mute; |
| 10146 | |
| 10147 | if (force || !spec->sense_updated) { |
| 10148 | unsigned int present_int_hp; |
| 10149 | /* need to execute and sync at first */ |
| 10150 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10151 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10152 | AC_VERB_GET_PIN_SENSE, 0); |
| 10153 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10154 | spec->sense_updated = 1; |
| 10155 | } |
| 10156 | if (spec->jack_present) { |
| 10157 | /* mute internal speaker */ |
| 10158 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10159 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10160 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10161 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10162 | } else { |
| 10163 | /* unmute internal speaker if necessary */ |
| 10164 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10165 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10166 | HDA_AMP_MUTE, mute); |
| 10167 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10168 | HDA_AMP_MUTE, mute); |
| 10169 | } |
| 10170 | } |
| 10171 | |
| 10172 | /* unsolicited event for HP jack sensing */ |
| 10173 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10174 | unsigned int res) |
| 10175 | { |
| 10176 | if ((res >> 26) != ALC_HP_EVENT) |
| 10177 | return; |
| 10178 | alc262_lenovo_3000_automute(codec, 1); |
| 10179 | } |
| 10180 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10181 | /* bind hp and internal speaker mute (with plug check) */ |
| 10182 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10183 | struct snd_ctl_elem_value *ucontrol) |
| 10184 | { |
| 10185 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10186 | long *valp = ucontrol->value.integer.value; |
| 10187 | int change; |
| 10188 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10189 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10190 | HDA_AMP_MUTE, |
| 10191 | valp ? 0 : HDA_AMP_MUTE); |
| 10192 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10193 | HDA_AMP_MUTE, |
| 10194 | valp ? 0 : HDA_AMP_MUTE); |
| 10195 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10196 | if (change) |
| 10197 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10198 | return change; |
| 10199 | } |
| 10200 | |
| 10201 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10202 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10203 | { |
| 10204 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10205 | .name = "Master Playback Switch", |
| 10206 | .info = snd_hda_mixer_amp_switch_info, |
| 10207 | .get = snd_hda_mixer_amp_switch_get, |
| 10208 | .put = alc262_fujitsu_master_sw_put, |
| 10209 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10210 | }, |
| 10211 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10212 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10213 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10214 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10215 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10216 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10217 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10218 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10219 | { } /* end */ |
| 10220 | }; |
| 10221 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10222 | /* bind hp and internal speaker mute (with plug check) */ |
| 10223 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10224 | struct snd_ctl_elem_value *ucontrol) |
| 10225 | { |
| 10226 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10227 | long *valp = ucontrol->value.integer.value; |
| 10228 | int change; |
| 10229 | |
| 10230 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 10231 | HDA_AMP_MUTE, |
| 10232 | valp ? 0 : HDA_AMP_MUTE); |
| 10233 | |
| 10234 | if (change) |
| 10235 | alc262_lenovo_3000_automute(codec, 0); |
| 10236 | return change; |
| 10237 | } |
| 10238 | |
| 10239 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10240 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10241 | { |
| 10242 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10243 | .name = "Master Playback Switch", |
| 10244 | .info = snd_hda_mixer_amp_switch_info, |
| 10245 | .get = snd_hda_mixer_amp_switch_get, |
| 10246 | .put = alc262_lenovo_3000_master_sw_put, |
| 10247 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10248 | }, |
| 10249 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10250 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10251 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10252 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10253 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10254 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10255 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10256 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10257 | { } /* end */ |
| 10258 | }; |
| 10259 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10260 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10261 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10262 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10265 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10266 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10267 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10268 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10269 | { } /* end */ |
| 10270 | }; |
| 10271 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10272 | /* additional init verbs for Benq laptops */ |
| 10273 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10274 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10275 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10276 | {} |
| 10277 | }; |
| 10278 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10279 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10280 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10281 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10282 | |
| 10283 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10284 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10285 | {} |
| 10286 | }; |
| 10287 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10288 | /* Samsung Q1 Ultra Vista model setup */ |
| 10289 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10290 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10291 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10292 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10293 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10294 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10295 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10296 | { } /* end */ |
| 10297 | }; |
| 10298 | |
| 10299 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10300 | /* output mixer */ |
| 10301 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10302 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10303 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10304 | /* speaker */ |
| 10305 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10306 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10308 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10309 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10310 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10311 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10313 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10314 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10315 | /* internal mic */ |
| 10316 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10317 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10318 | /* ADC, choose mic */ |
| 10319 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10323 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10324 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10325 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10326 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10327 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10328 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10329 | {} |
| 10330 | }; |
| 10331 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10332 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10333 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10334 | { |
| 10335 | struct alc_spec *spec = codec->spec; |
| 10336 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10337 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10338 | mute = 0; |
| 10339 | /* auto-mute only when HP is used as HP */ |
| 10340 | if (!spec->cur_mux[0]) { |
| 10341 | unsigned int present; |
| 10342 | /* need to execute and sync at first */ |
| 10343 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10344 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10345 | AC_VERB_GET_PIN_SENSE, 0); |
| 10346 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10347 | if (spec->jack_present) |
| 10348 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10349 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10350 | /* mute/unmute internal speaker */ |
| 10351 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10352 | HDA_AMP_MUTE, mute); |
| 10353 | /* mute/unmute HP */ |
| 10354 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10355 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10356 | } |
| 10357 | |
| 10358 | /* unsolicited event for HP jack sensing */ |
| 10359 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10360 | unsigned int res) |
| 10361 | { |
| 10362 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10363 | return; |
| 10364 | alc262_ultra_automute(codec); |
| 10365 | } |
| 10366 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10367 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10368 | .num_items = 2, |
| 10369 | .items = { |
| 10370 | { "Mic", 0x1 }, |
| 10371 | { "Headphone", 0x7 }, |
| 10372 | }, |
| 10373 | }; |
| 10374 | |
| 10375 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10376 | struct snd_ctl_elem_value *ucontrol) |
| 10377 | { |
| 10378 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10379 | struct alc_spec *spec = codec->spec; |
| 10380 | int ret; |
| 10381 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10382 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10383 | if (!ret) |
| 10384 | return 0; |
| 10385 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10386 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10387 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10388 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10389 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10390 | return ret; |
| 10391 | } |
| 10392 | |
| 10393 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10394 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10395 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10396 | { |
| 10397 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10398 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10399 | .info = alc_mux_enum_info, |
| 10400 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10401 | .put = alc262_ultra_mux_enum_put, |
| 10402 | }, |
| 10403 | { } /* end */ |
| 10404 | }; |
| 10405 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10406 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10407 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10408 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10409 | { |
| 10410 | hda_nid_t nid; |
| 10411 | int err; |
| 10412 | |
| 10413 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10414 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10415 | spec->multiout.dac_nids[0] = 2; |
| 10416 | |
| 10417 | nid = cfg->line_out_pins[0]; |
| 10418 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10419 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10420 | "Front Playback Volume", |
| 10421 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10422 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10423 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10424 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10425 | "Front Playback Switch", |
| 10426 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10427 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10428 | return err; |
| 10429 | } |
| 10430 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10431 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10432 | if (nid) { |
| 10433 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10434 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10435 | "Speaker Playback Volume", |
| 10436 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10437 | HDA_OUTPUT)); |
| 10438 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10439 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10440 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10441 | "Speaker Playback Switch", |
| 10442 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10443 | HDA_OUTPUT)); |
| 10444 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10445 | return err; |
| 10446 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10447 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10448 | "Speaker Playback Switch", |
| 10449 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10450 | HDA_OUTPUT)); |
| 10451 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10452 | return err; |
| 10453 | } |
| 10454 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10455 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10456 | if (nid) { |
| 10457 | /* spec->multiout.hp_nid = 2; */ |
| 10458 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10459 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10460 | "Headphone Playback Volume", |
| 10461 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10462 | HDA_OUTPUT)); |
| 10463 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10464 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10465 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10466 | "Headphone Playback Switch", |
| 10467 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10468 | HDA_OUTPUT)); |
| 10469 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10470 | return err; |
| 10471 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10472 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10473 | "Headphone Playback Switch", |
| 10474 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10475 | HDA_OUTPUT)); |
| 10476 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10477 | return err; |
| 10478 | } |
| 10479 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10480 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10481 | } |
| 10482 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 10483 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10484 | const struct auto_pin_cfg *cfg) |
| 10485 | { |
| 10486 | int err; |
| 10487 | |
| 10488 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10489 | if (err < 0) |
| 10490 | return err; |
| 10491 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10492 | * because it's under 0x18 |
| 10493 | */ |
| 10494 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10495 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10496 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10497 | imux->items[imux->num_items].label = "Int Mic"; |
| 10498 | imux->items[imux->num_items].index = 0x09; |
| 10499 | imux->num_items++; |
| 10500 | } |
| 10501 | return 0; |
| 10502 | } |
| 10503 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10504 | |
| 10505 | /* |
| 10506 | * generic initialization of ADC, input mixers and output mixers |
| 10507 | */ |
| 10508 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10509 | /* |
| 10510 | * Unmute ADC0-2 and set the default input to mic-in |
| 10511 | */ |
| 10512 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10513 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10514 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10516 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10518 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10519 | /* 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] | 10520 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10521 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10522 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10523 | */ |
| 10524 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10525 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10526 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10527 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10529 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10530 | |
| 10531 | /* |
| 10532 | * Set up output mixers (0x0c - 0x0f) |
| 10533 | */ |
| 10534 | /* set vol=0 to output mixers */ |
| 10535 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10536 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10537 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10538 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10539 | /* set up input amps for analog loopback */ |
| 10540 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10541 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10542 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10543 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10544 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10545 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10546 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10547 | |
| 10548 | /* FIXME: use matrix-type input source selection */ |
| 10549 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10550 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10552 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10555 | /* Input mixer2 */ |
| 10556 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10557 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10558 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10559 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10560 | /* Input mixer3 */ |
| 10561 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10562 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10563 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10564 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10565 | |
| 10566 | { } |
| 10567 | }; |
| 10568 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10569 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10570 | /* |
| 10571 | * Unmute ADC0-2 and set the default input to mic-in |
| 10572 | */ |
| 10573 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10575 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10576 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10577 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10578 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10579 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10580 | /* 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] | 10581 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10582 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10583 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10584 | */ |
| 10585 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10593 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10594 | /* |
| 10595 | * Set up output mixers (0x0c - 0x0e) |
| 10596 | */ |
| 10597 | /* set vol=0 to output mixers */ |
| 10598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10600 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10601 | |
| 10602 | /* set up input amps for analog loopback */ |
| 10603 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10605 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10607 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10608 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10609 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10610 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10611 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10612 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10613 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10614 | |
| 10615 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10616 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10617 | |
| 10618 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10619 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10620 | |
| 10621 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10622 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10623 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10625 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10626 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10628 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10629 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10630 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10631 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10632 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10633 | |
| 10634 | |
| 10635 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10636 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 10637 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10638 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10639 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10640 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10641 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10642 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10643 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10644 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10646 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10647 | /* Input mixer2 */ |
| 10648 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10650 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10651 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10652 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10653 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10654 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10655 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10656 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10657 | /* Input mixer3 */ |
| 10658 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10659 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10660 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10661 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10662 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10663 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10664 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10665 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10666 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10667 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10668 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10669 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10670 | { } |
| 10671 | }; |
| 10672 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10673 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10674 | /* |
| 10675 | * Unmute ADC0-2 and set the default input to mic-in |
| 10676 | */ |
| 10677 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10678 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10679 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10680 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10681 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10682 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10683 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10684 | /* 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] | 10685 | * mixer widget |
| 10686 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10687 | * panel mic (mic 2) |
| 10688 | */ |
| 10689 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10690 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10691 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10692 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10693 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10694 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10695 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10696 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10697 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10698 | /* |
| 10699 | * Set up output mixers (0x0c - 0x0e) |
| 10700 | */ |
| 10701 | /* set vol=0 to output mixers */ |
| 10702 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10703 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10704 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10705 | |
| 10706 | /* set up input amps for analog loopback */ |
| 10707 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10709 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10710 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10711 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10712 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10713 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10714 | |
| 10715 | |
| 10716 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10717 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10718 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10719 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10720 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10721 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10722 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10723 | |
| 10724 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10725 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10726 | |
| 10727 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10728 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10729 | |
| 10730 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10731 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10732 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10733 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10734 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10735 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10736 | |
| 10737 | /* FIXME: use matrix-type input source selection */ |
| 10738 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10739 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10740 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10741 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10742 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10743 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10744 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10745 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10746 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10747 | /* Input mixer2 */ |
| 10748 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10749 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10750 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10751 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10752 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10753 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10754 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10755 | /* Input mixer3 */ |
| 10756 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10757 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10758 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10761 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10762 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10763 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10764 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10765 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10766 | { } |
| 10767 | }; |
| 10768 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10769 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10770 | |
| 10771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10773 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10774 | |
| 10775 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10776 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10777 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10778 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10779 | |
| 10780 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10781 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10782 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10783 | {} |
| 10784 | }; |
| 10785 | |
| 10786 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10787 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10788 | #define alc262_loopbacks alc880_loopbacks |
| 10789 | #endif |
| 10790 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 10791 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10792 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 10793 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 10794 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 10795 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 10796 | |
| 10797 | /* |
| 10798 | * BIOS auto configuration |
| 10799 | */ |
| 10800 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 10801 | { |
| 10802 | struct alc_spec *spec = codec->spec; |
| 10803 | int err; |
| 10804 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 10805 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10806 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10807 | alc262_ignore); |
| 10808 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10809 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10810 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10811 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10812 | spec->multiout.max_channels = 2; |
| 10813 | spec->no_analog = 1; |
| 10814 | goto dig_only; |
| 10815 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10816 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10817 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10818 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10819 | if (err < 0) |
| 10820 | return err; |
| 10821 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10822 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10823 | return err; |
| 10824 | |
| 10825 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10826 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10827 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10828 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10829 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 10830 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 10831 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10832 | if (spec->autocfg.dig_in_pin) |
| 10833 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 10834 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 10835 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10836 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10837 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 10838 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 10839 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10840 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10841 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10842 | err = alc_auto_add_mic_boost(codec); |
| 10843 | if (err < 0) |
| 10844 | return err; |
| 10845 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10846 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 10847 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10848 | return 1; |
| 10849 | } |
| 10850 | |
| 10851 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 10852 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 10853 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10854 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10855 | |
| 10856 | |
| 10857 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10858 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10859 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10860 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10861 | alc262_auto_init_multi_out(codec); |
| 10862 | alc262_auto_init_hp_out(codec); |
| 10863 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 10864 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10865 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10866 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10867 | } |
| 10868 | |
| 10869 | /* |
| 10870 | * configuration and preset |
| 10871 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10872 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 10873 | [ALC262_BASIC] = "basic", |
| 10874 | [ALC262_HIPPO] = "hippo", |
| 10875 | [ALC262_HIPPO_1] = "hippo_1", |
| 10876 | [ALC262_FUJITSU] = "fujitsu", |
| 10877 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10878 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 10879 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10880 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10881 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 10882 | [ALC262_BENQ_T31] = "benq-t31", |
| 10883 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 10884 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10885 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10886 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10887 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10888 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10889 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10890 | [ALC262_AUTO] = "auto", |
| 10891 | }; |
| 10892 | |
| 10893 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 10894 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10895 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10896 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 10897 | ALC262_HP_BPC), |
| 10898 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 10899 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 10900 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 10901 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10902 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10903 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10904 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10905 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10906 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10907 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10908 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10909 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10910 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 10911 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 10912 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10913 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 10914 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10915 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10916 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10917 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10918 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 10919 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 10920 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 10921 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 10922 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 10923 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10924 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 10925 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10926 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 10927 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10928 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10929 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 10930 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 10931 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10932 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10933 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10934 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10935 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10936 | {} |
| 10937 | }; |
| 10938 | |
| 10939 | static struct alc_config_preset alc262_presets[] = { |
| 10940 | [ALC262_BASIC] = { |
| 10941 | .mixers = { alc262_base_mixer }, |
| 10942 | .init_verbs = { alc262_init_verbs }, |
| 10943 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10944 | .dac_nids = alc262_dac_nids, |
| 10945 | .hp_nid = 0x03, |
| 10946 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10947 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 10948 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10949 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10950 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10951 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10952 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 10953 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10954 | .dac_nids = alc262_dac_nids, |
| 10955 | .hp_nid = 0x03, |
| 10956 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10957 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10958 | .channel_mode = alc262_modes, |
| 10959 | .input_mux = &alc262_capture_source, |
| 10960 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10961 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10962 | }, |
| 10963 | [ALC262_HIPPO_1] = { |
| 10964 | .mixers = { alc262_hippo1_mixer }, |
| 10965 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 10966 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10967 | .dac_nids = alc262_dac_nids, |
| 10968 | .hp_nid = 0x02, |
| 10969 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10970 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10971 | .channel_mode = alc262_modes, |
| 10972 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10973 | .unsol_event = alc262_hippo_unsol_event, |
| 10974 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10975 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10976 | [ALC262_FUJITSU] = { |
| 10977 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10978 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 10979 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10980 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10981 | .dac_nids = alc262_dac_nids, |
| 10982 | .hp_nid = 0x03, |
| 10983 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 10984 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10985 | .channel_mode = alc262_modes, |
| 10986 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 10987 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10988 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10989 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10990 | [ALC262_HP_BPC] = { |
| 10991 | .mixers = { alc262_HP_BPC_mixer }, |
| 10992 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 10993 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 10994 | .dac_nids = alc262_dac_nids, |
| 10995 | .hp_nid = 0x03, |
| 10996 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 10997 | .channel_mode = alc262_modes, |
| 10998 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10999 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11000 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11001 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11002 | [ALC262_HP_BPC_D7000_WF] = { |
| 11003 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11004 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11005 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11006 | .dac_nids = alc262_dac_nids, |
| 11007 | .hp_nid = 0x03, |
| 11008 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11009 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11010 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11011 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11012 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11013 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11014 | [ALC262_HP_BPC_D7000_WL] = { |
| 11015 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11016 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11017 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11018 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11019 | .dac_nids = alc262_dac_nids, |
| 11020 | .hp_nid = 0x03, |
| 11021 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11022 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11023 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11024 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11025 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11026 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11027 | [ALC262_HP_TC_T5735] = { |
| 11028 | .mixers = { alc262_hp_t5735_mixer }, |
| 11029 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11030 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11031 | .dac_nids = alc262_dac_nids, |
| 11032 | .hp_nid = 0x03, |
| 11033 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11034 | .channel_mode = alc262_modes, |
| 11035 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11036 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11037 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11038 | }, |
| 11039 | [ALC262_HP_RP5700] = { |
| 11040 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11041 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11042 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11043 | .dac_nids = alc262_dac_nids, |
| 11044 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11045 | .channel_mode = alc262_modes, |
| 11046 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11047 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11048 | [ALC262_BENQ_ED8] = { |
| 11049 | .mixers = { alc262_base_mixer }, |
| 11050 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11051 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11052 | .dac_nids = alc262_dac_nids, |
| 11053 | .hp_nid = 0x03, |
| 11054 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11055 | .channel_mode = alc262_modes, |
| 11056 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11057 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11058 | [ALC262_SONY_ASSAMD] = { |
| 11059 | .mixers = { alc262_sony_mixer }, |
| 11060 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11061 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11062 | .dac_nids = alc262_dac_nids, |
| 11063 | .hp_nid = 0x02, |
| 11064 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11065 | .channel_mode = alc262_modes, |
| 11066 | .input_mux = &alc262_capture_source, |
| 11067 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11068 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11069 | }, |
| 11070 | [ALC262_BENQ_T31] = { |
| 11071 | .mixers = { alc262_benq_t31_mixer }, |
| 11072 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11073 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11074 | .dac_nids = alc262_dac_nids, |
| 11075 | .hp_nid = 0x03, |
| 11076 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11077 | .channel_mode = alc262_modes, |
| 11078 | .input_mux = &alc262_capture_source, |
| 11079 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11080 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11081 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11082 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11083 | .mixers = { alc262_ultra_mixer }, |
| 11084 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11085 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11086 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11087 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11088 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11089 | .channel_mode = alc262_modes, |
| 11090 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11091 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11092 | .capsrc_nids = alc262_capsrc_nids, |
| 11093 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11094 | .unsol_event = alc262_ultra_unsol_event, |
| 11095 | .init_hook = alc262_ultra_automute, |
| 11096 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11097 | [ALC262_LENOVO_3000] = { |
| 11098 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11099 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11100 | alc262_lenovo_3000_unsol_verbs }, |
| 11101 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11102 | .dac_nids = alc262_dac_nids, |
| 11103 | .hp_nid = 0x03, |
| 11104 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11105 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11106 | .channel_mode = alc262_modes, |
| 11107 | .input_mux = &alc262_fujitsu_capture_source, |
| 11108 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11109 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11110 | [ALC262_NEC] = { |
| 11111 | .mixers = { alc262_nec_mixer }, |
| 11112 | .init_verbs = { alc262_nec_verbs }, |
| 11113 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11114 | .dac_nids = alc262_dac_nids, |
| 11115 | .hp_nid = 0x03, |
| 11116 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11117 | .channel_mode = alc262_modes, |
| 11118 | .input_mux = &alc262_capture_source, |
| 11119 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11120 | [ALC262_TOSHIBA_S06] = { |
| 11121 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11122 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11123 | alc262_eapd_verbs }, |
| 11124 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11125 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11126 | .dac_nids = alc262_dac_nids, |
| 11127 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11128 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11129 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11130 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11131 | .channel_mode = alc262_modes, |
| 11132 | .input_mux = &alc262_dmic_capture_source, |
| 11133 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11134 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11135 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11136 | [ALC262_TOSHIBA_RX1] = { |
| 11137 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11138 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11139 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11140 | .dac_nids = alc262_dac_nids, |
| 11141 | .hp_nid = 0x03, |
| 11142 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11143 | .channel_mode = alc262_modes, |
| 11144 | .input_mux = &alc262_capture_source, |
| 11145 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11146 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11147 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11148 | [ALC262_TYAN] = { |
| 11149 | .mixers = { alc262_tyan_mixer }, |
| 11150 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11151 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11152 | .dac_nids = alc262_dac_nids, |
| 11153 | .hp_nid = 0x02, |
| 11154 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11155 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11156 | .channel_mode = alc262_modes, |
| 11157 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11158 | .unsol_event = alc_automute_amp_unsol_event, |
| 11159 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11160 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11161 | }; |
| 11162 | |
| 11163 | static int patch_alc262(struct hda_codec *codec) |
| 11164 | { |
| 11165 | struct alc_spec *spec; |
| 11166 | int board_config; |
| 11167 | int err; |
| 11168 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11169 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11170 | if (spec == NULL) |
| 11171 | return -ENOMEM; |
| 11172 | |
| 11173 | codec->spec = spec; |
| 11174 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11175 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11176 | * under-run |
| 11177 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11178 | { |
| 11179 | int tmp; |
| 11180 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11181 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11182 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11183 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11184 | } |
| 11185 | #endif |
| 11186 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11187 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11188 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11189 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11190 | alc262_models, |
| 11191 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11192 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11193 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 11194 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 11195 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11196 | board_config = ALC262_AUTO; |
| 11197 | } |
| 11198 | |
| 11199 | if (board_config == ALC262_AUTO) { |
| 11200 | /* automatic parse from the BIOS config */ |
| 11201 | err = alc262_parse_auto_config(codec); |
| 11202 | if (err < 0) { |
| 11203 | alc_free(codec); |
| 11204 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11205 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11206 | printk(KERN_INFO |
| 11207 | "hda_codec: Cannot set up configuration " |
| 11208 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11209 | board_config = ALC262_BASIC; |
| 11210 | } |
| 11211 | } |
| 11212 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11213 | if (!spec->no_analog) { |
| 11214 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11215 | if (err < 0) { |
| 11216 | alc_free(codec); |
| 11217 | return err; |
| 11218 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11219 | } |
| 11220 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11221 | if (board_config != ALC262_AUTO) |
| 11222 | setup_preset(spec, &alc262_presets[board_config]); |
| 11223 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11224 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11225 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11226 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11227 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11228 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11230 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11231 | int i; |
| 11232 | /* check whether the digital-mic has to be supported */ |
| 11233 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11234 | if (spec->input_mux->items[i].index >= 9) |
| 11235 | break; |
| 11236 | } |
| 11237 | if (i < spec->input_mux->num_items) { |
| 11238 | /* use only ADC0 */ |
| 11239 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11240 | spec->num_adc_nids = 1; |
| 11241 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11242 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11243 | /* all analog inputs */ |
| 11244 | /* check whether NID 0x07 is valid */ |
| 11245 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11246 | |
| 11247 | /* get type */ |
| 11248 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 11249 | if (wcap != AC_WID_AUD_IN) { |
| 11250 | spec->adc_nids = alc262_adc_nids_alt; |
| 11251 | spec->num_adc_nids = |
| 11252 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11253 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11254 | } else { |
| 11255 | spec->adc_nids = alc262_adc_nids; |
| 11256 | spec->num_adc_nids = |
| 11257 | ARRAY_SIZE(alc262_adc_nids); |
| 11258 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11259 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11260 | } |
| 11261 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11262 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11263 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11264 | if (!spec->no_analog) |
| 11265 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11266 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11267 | spec->vmaster_nid = 0x0c; |
| 11268 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11269 | codec->patch_ops = alc_patch_ops; |
| 11270 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11271 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11272 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11273 | if (!spec->loopback.amplist) |
| 11274 | spec->loopback.amplist = alc262_loopbacks; |
| 11275 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11276 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11278 | return 0; |
| 11279 | } |
| 11280 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11281 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11282 | * ALC268 channel source setting (2 channel) |
| 11283 | */ |
| 11284 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11285 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11286 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11287 | static hda_nid_t alc268_dac_nids[2] = { |
| 11288 | /* front, hp */ |
| 11289 | 0x02, 0x03 |
| 11290 | }; |
| 11291 | |
| 11292 | static hda_nid_t alc268_adc_nids[2] = { |
| 11293 | /* ADC0-1 */ |
| 11294 | 0x08, 0x07 |
| 11295 | }; |
| 11296 | |
| 11297 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11298 | /* ADC0 */ |
| 11299 | 0x08 |
| 11300 | }; |
| 11301 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11302 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11303 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11304 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11305 | /* output mixer control */ |
| 11306 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11307 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11308 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11309 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11310 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11311 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11312 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11313 | { } |
| 11314 | }; |
| 11315 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11316 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11317 | /* output mixer control */ |
| 11318 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11319 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11320 | ALC262_HIPPO_MASTER_SWITCH, |
| 11321 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11322 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11323 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11324 | { } |
| 11325 | }; |
| 11326 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11327 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11328 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11329 | .ops = &snd_hda_bind_sw, |
| 11330 | .values = { |
| 11331 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11332 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11333 | 0 |
| 11334 | }, |
| 11335 | }; |
| 11336 | |
| 11337 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11338 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11339 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11340 | { } |
| 11341 | }; |
| 11342 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11343 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11344 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11345 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11346 | { } |
| 11347 | }; |
| 11348 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11349 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11350 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11351 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11352 | { } /* end */ |
| 11353 | }; |
| 11354 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11355 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11356 | .num_items = 2, |
| 11357 | .items = { |
| 11358 | { "i-Mic", 0x6 }, |
| 11359 | { "E-Mic", 0x0 }, |
| 11360 | }, |
| 11361 | }; |
| 11362 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11363 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11364 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11365 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11366 | .ops = &snd_hda_bind_vol, |
| 11367 | .values = { |
| 11368 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11369 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11370 | 0 |
| 11371 | }, |
| 11372 | }; |
| 11373 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11374 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11375 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11376 | { |
| 11377 | struct alc_spec *spec = codec->spec; |
| 11378 | unsigned int mute; |
| 11379 | |
| 11380 | if (force || !spec->sense_updated) { |
| 11381 | unsigned int present; |
| 11382 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11383 | AC_VERB_GET_PIN_SENSE, 0); |
| 11384 | spec->jack_present = (present & 0x80000000) != 0; |
| 11385 | spec->sense_updated = 1; |
| 11386 | } |
| 11387 | if (spec->jack_present) |
| 11388 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11389 | else /* unmute internal speaker if necessary */ |
| 11390 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11391 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11392 | HDA_AMP_MUTE, mute); |
| 11393 | } |
| 11394 | |
| 11395 | |
| 11396 | /* bind hp and internal speaker mute (with plug check) */ |
| 11397 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11398 | struct snd_ctl_elem_value *ucontrol) |
| 11399 | { |
| 11400 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11401 | long *valp = ucontrol->value.integer.value; |
| 11402 | int change; |
| 11403 | |
| 11404 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 11405 | HDA_AMP_MUTE, |
| 11406 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 11407 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 11408 | HDA_AMP_MUTE, |
| 11409 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 11410 | if (change) |
| 11411 | alc268_acer_automute(codec, 0); |
| 11412 | return change; |
| 11413 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11414 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11415 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11416 | /* output mixer control */ |
| 11417 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11418 | { |
| 11419 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11420 | .name = "Master Playback Switch", |
| 11421 | .info = snd_hda_mixer_amp_switch_info, |
| 11422 | .get = snd_hda_mixer_amp_switch_get, |
| 11423 | .put = alc268_acer_master_sw_put, |
| 11424 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11425 | }, |
| 11426 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11427 | { } |
| 11428 | }; |
| 11429 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11430 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11431 | /* output mixer control */ |
| 11432 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11433 | { |
| 11434 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11435 | .name = "Master Playback Switch", |
| 11436 | .info = snd_hda_mixer_amp_switch_info, |
| 11437 | .get = snd_hda_mixer_amp_switch_get, |
| 11438 | .put = alc268_acer_master_sw_put, |
| 11439 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11440 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11441 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11442 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11443 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11444 | { } |
| 11445 | }; |
| 11446 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11447 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11448 | /* output mixer control */ |
| 11449 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11450 | { |
| 11451 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11452 | .name = "Master Playback Switch", |
| 11453 | .info = snd_hda_mixer_amp_switch_info, |
| 11454 | .get = snd_hda_mixer_amp_switch_get, |
| 11455 | .put = alc268_acer_master_sw_put, |
| 11456 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11457 | }, |
| 11458 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11459 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11460 | { } |
| 11461 | }; |
| 11462 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11463 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11464 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11466 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11467 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11468 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11469 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11470 | { } |
| 11471 | }; |
| 11472 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11473 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11474 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11475 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11476 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11477 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11478 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11479 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11480 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11481 | { } |
| 11482 | }; |
| 11483 | |
| 11484 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11485 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11486 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11487 | |
| 11488 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11489 | unsigned int res) |
| 11490 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11491 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11492 | return; |
| 11493 | alc268_acer_automute(codec, 1); |
| 11494 | } |
| 11495 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11496 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11497 | { |
| 11498 | alc268_acer_automute(codec, 1); |
| 11499 | } |
| 11500 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11501 | /* toggle speaker-output according to the hp-jack state */ |
| 11502 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11503 | { |
| 11504 | unsigned int present; |
| 11505 | unsigned char bits; |
| 11506 | |
| 11507 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11508 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11509 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11510 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11511 | AMP_IN_MUTE(0), bits); |
| 11512 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11513 | AMP_IN_MUTE(0), bits); |
| 11514 | } |
| 11515 | |
| 11516 | |
| 11517 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11518 | { |
| 11519 | unsigned int present; |
| 11520 | |
| 11521 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11522 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11523 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11524 | present ? 0x0 : 0x6); |
| 11525 | } |
| 11526 | |
| 11527 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11528 | unsigned int res) |
| 11529 | { |
| 11530 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11531 | alc268_aspire_one_speaker_automute(codec); |
| 11532 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11533 | alc268_acer_mic_automute(codec); |
| 11534 | } |
| 11535 | |
| 11536 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11537 | { |
| 11538 | alc268_aspire_one_speaker_automute(codec); |
| 11539 | alc268_acer_mic_automute(codec); |
| 11540 | } |
| 11541 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11542 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11543 | /* output mixer control */ |
| 11544 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11545 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11546 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11547 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11548 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11549 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11550 | { } |
| 11551 | }; |
| 11552 | |
| 11553 | static struct hda_verb alc268_dell_verbs[] = { |
| 11554 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11555 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11556 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11557 | { } |
| 11558 | }; |
| 11559 | |
| 11560 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11561 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11562 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11563 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11564 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11565 | spec->autocfg.hp_pins[0] = 0x15; |
| 11566 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11567 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11568 | } |
| 11569 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11570 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11571 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11572 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11573 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11574 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11575 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11576 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11577 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11578 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11579 | { } |
| 11580 | }; |
| 11581 | |
| 11582 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11583 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11584 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11585 | { } |
| 11586 | }; |
| 11587 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11588 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11589 | { |
| 11590 | unsigned int present; |
| 11591 | |
| 11592 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11593 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11594 | snd_hda_codec_write(codec, 0x23, 0, |
| 11595 | AC_VERB_SET_CONNECT_SEL, |
| 11596 | present ? 0x00 : 0x01); |
| 11597 | } |
| 11598 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11599 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11600 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11601 | struct alc_spec *spec = codec->spec; |
| 11602 | |
| 11603 | spec->autocfg.hp_pins[0] = 0x15; |
| 11604 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11605 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11606 | alc267_quanta_il1_mic_automute(codec); |
| 11607 | } |
| 11608 | |
| 11609 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11610 | unsigned int res) |
| 11611 | { |
| 11612 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11613 | case ALC880_MIC_EVENT: |
| 11614 | alc267_quanta_il1_mic_automute(codec); |
| 11615 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11616 | default: |
| 11617 | alc_sku_unsol_event(codec, res); |
| 11618 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11619 | } |
| 11620 | } |
| 11621 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11622 | /* |
| 11623 | * generic initialization of ADC, input mixers and output mixers |
| 11624 | */ |
| 11625 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11626 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11627 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11628 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11629 | |
| 11630 | /* |
| 11631 | * Set up output mixers (0x0c - 0x0e) |
| 11632 | */ |
| 11633 | /* set vol=0 to output mixers */ |
| 11634 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11635 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11636 | |
| 11637 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11638 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11639 | |
| 11640 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11641 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11642 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11643 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11644 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11645 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11646 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11647 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11648 | |
| 11649 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11651 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11652 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11653 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11654 | |
| 11655 | /* set PCBEEP vol = 0, mute connections */ |
| 11656 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11657 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11658 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11659 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11660 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11661 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11662 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11664 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11666 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11667 | { } |
| 11668 | }; |
| 11669 | |
| 11670 | /* |
| 11671 | * generic initialization of ADC, input mixers and output mixers |
| 11672 | */ |
| 11673 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11674 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11675 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11676 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11677 | |
| 11678 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11679 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11680 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11681 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11682 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11683 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11685 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11686 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11687 | |
| 11688 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11689 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11690 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11691 | /* set PCBEEP vol = 0, mute connections */ |
| 11692 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11693 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11694 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11695 | |
| 11696 | { } |
| 11697 | }; |
| 11698 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11699 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11700 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11701 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11702 | { |
| 11703 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11704 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11705 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11706 | */ |
| 11707 | /* .name = "Capture Source", */ |
| 11708 | .name = "Input Source", |
| 11709 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11710 | .info = alc_mux_enum_info, |
| 11711 | .get = alc_mux_enum_get, |
| 11712 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11713 | }, |
| 11714 | { } /* end */ |
| 11715 | }; |
| 11716 | |
| 11717 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11718 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11719 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11720 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11721 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11722 | { |
| 11723 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11724 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11725 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11726 | */ |
| 11727 | /* .name = "Capture Source", */ |
| 11728 | .name = "Input Source", |
| 11729 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11730 | .info = alc_mux_enum_info, |
| 11731 | .get = alc_mux_enum_get, |
| 11732 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11733 | }, |
| 11734 | { } /* end */ |
| 11735 | }; |
| 11736 | |
| 11737 | static struct hda_input_mux alc268_capture_source = { |
| 11738 | .num_items = 4, |
| 11739 | .items = { |
| 11740 | { "Mic", 0x0 }, |
| 11741 | { "Front Mic", 0x1 }, |
| 11742 | { "Line", 0x2 }, |
| 11743 | { "CD", 0x3 }, |
| 11744 | }, |
| 11745 | }; |
| 11746 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11747 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11748 | .num_items = 3, |
| 11749 | .items = { |
| 11750 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11751 | { "Internal Mic", 0x1 }, |
| 11752 | { "Line", 0x2 }, |
| 11753 | }, |
| 11754 | }; |
| 11755 | |
| 11756 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11757 | .num_items = 3, |
| 11758 | .items = { |
| 11759 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11760 | { "Internal Mic", 0x6 }, |
| 11761 | { "Line", 0x2 }, |
| 11762 | }, |
| 11763 | }; |
| 11764 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11765 | #ifdef CONFIG_SND_DEBUG |
| 11766 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11767 | /* Volume widgets */ |
| 11768 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11769 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11770 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11771 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11772 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11773 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11774 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11775 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11776 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11777 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11778 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11779 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11780 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11781 | /* The below appears problematic on some hardwares */ |
| 11782 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11783 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11784 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11785 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11786 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11787 | |
| 11788 | /* Modes for retasking pin widgets */ |
| 11789 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 11790 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 11791 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 11792 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 11793 | |
| 11794 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 11795 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 11796 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 11797 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 11798 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 11799 | |
| 11800 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 11801 | * The ALC268 does not have an SPDIF input. |
| 11802 | */ |
| 11803 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 11804 | |
| 11805 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 11806 | * this output to turn on an external amplifier. |
| 11807 | */ |
| 11808 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 11809 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 11810 | |
| 11811 | { } /* end */ |
| 11812 | }; |
| 11813 | #endif |
| 11814 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11815 | /* create input playback/capture controls for the given pin */ |
| 11816 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 11817 | const char *ctlname, int idx) |
| 11818 | { |
| 11819 | char name[32]; |
| 11820 | int err; |
| 11821 | |
| 11822 | sprintf(name, "%s Playback Volume", ctlname); |
| 11823 | if (nid == 0x14) { |
| 11824 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11825 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 11826 | HDA_OUTPUT)); |
| 11827 | if (err < 0) |
| 11828 | return err; |
| 11829 | } else if (nid == 0x15) { |
| 11830 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 11831 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 11832 | HDA_OUTPUT)); |
| 11833 | if (err < 0) |
| 11834 | return err; |
| 11835 | } else |
| 11836 | return -1; |
| 11837 | sprintf(name, "%s Playback Switch", ctlname); |
| 11838 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 11839 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 11840 | if (err < 0) |
| 11841 | return err; |
| 11842 | return 0; |
| 11843 | } |
| 11844 | |
| 11845 | /* add playback controls from the parsed DAC table */ |
| 11846 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11847 | const struct auto_pin_cfg *cfg) |
| 11848 | { |
| 11849 | hda_nid_t nid; |
| 11850 | int err; |
| 11851 | |
| 11852 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 11853 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11854 | spec->multiout.dac_nids[0] = 2; |
| 11855 | spec->multiout.dac_nids[1] = 3; |
| 11856 | |
| 11857 | nid = cfg->line_out_pins[0]; |
| 11858 | if (nid) |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11859 | alc268_new_analog_output(spec, nid, "Front", 0); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11860 | |
| 11861 | nid = cfg->speaker_pins[0]; |
| 11862 | if (nid == 0x1d) { |
| 11863 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11864 | "Speaker Playback Volume", |
| 11865 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 11866 | if (err < 0) |
| 11867 | return err; |
| 11868 | } |
| 11869 | nid = cfg->hp_pins[0]; |
| 11870 | if (nid) |
| 11871 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 11872 | |
| 11873 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 11874 | if (nid == 0x16) { |
| 11875 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11876 | "Mono Playback Switch", |
| 11877 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 11878 | if (err < 0) |
| 11879 | return err; |
| 11880 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11881 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11882 | } |
| 11883 | |
| 11884 | /* create playback/capture controls for input pins */ |
| 11885 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11886 | const struct auto_pin_cfg *cfg) |
| 11887 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11888 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11889 | int i, idx1; |
| 11890 | |
| 11891 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11892 | switch(cfg->input_pins[i]) { |
| 11893 | case 0x18: |
| 11894 | idx1 = 0; /* Mic 1 */ |
| 11895 | break; |
| 11896 | case 0x19: |
| 11897 | idx1 = 1; /* Mic 2 */ |
| 11898 | break; |
| 11899 | case 0x1a: |
| 11900 | idx1 = 2; /* Line In */ |
| 11901 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11902 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11903 | idx1 = 3; /* CD */ |
| 11904 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 11905 | case 0x12: |
| 11906 | case 0x13: |
| 11907 | idx1 = 6; /* digital mics */ |
| 11908 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11909 | default: |
| 11910 | continue; |
| 11911 | } |
| 11912 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 11913 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11914 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11915 | } |
| 11916 | return 0; |
| 11917 | } |
| 11918 | |
| 11919 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 11920 | { |
| 11921 | struct alc_spec *spec = codec->spec; |
| 11922 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11923 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11924 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11925 | unsigned int dac_vol1, dac_vol2; |
| 11926 | |
| 11927 | if (speaker_nid) { |
| 11928 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 11929 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 11930 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11931 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11932 | AMP_IN_UNMUTE(1)); |
| 11933 | snd_hda_codec_write(codec, 0x10, 0, |
| 11934 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11935 | AMP_IN_UNMUTE(1)); |
| 11936 | } else { |
| 11937 | snd_hda_codec_write(codec, 0x0f, 0, |
| 11938 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11939 | snd_hda_codec_write(codec, 0x10, 0, |
| 11940 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 11941 | } |
| 11942 | |
| 11943 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11944 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11945 | dac_vol2 = AMP_OUT_ZERO; |
| 11946 | else if (line_nid == 0x15) |
| 11947 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11948 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11949 | dac_vol2 = AMP_OUT_ZERO; |
| 11950 | else if (hp_nid == 0x15) |
| 11951 | dac_vol1 = AMP_OUT_ZERO; |
| 11952 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 11953 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 11954 | spec->autocfg.line_out_pins[2] != 0x16) |
| 11955 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 11956 | |
| 11957 | snd_hda_codec_write(codec, 0x02, 0, |
| 11958 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 11959 | snd_hda_codec_write(codec, 0x03, 0, |
| 11960 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 11961 | } |
| 11962 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11963 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11964 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 11965 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 11966 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11967 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 11968 | |
| 11969 | /* |
| 11970 | * BIOS auto configuration |
| 11971 | */ |
| 11972 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 11973 | { |
| 11974 | struct alc_spec *spec = codec->spec; |
| 11975 | int err; |
| 11976 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 11977 | |
| 11978 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11979 | alc268_ignore); |
| 11980 | if (err < 0) |
| 11981 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11982 | if (!spec->autocfg.line_outs) { |
| 11983 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 11984 | spec->multiout.max_channels = 2; |
| 11985 | spec->no_analog = 1; |
| 11986 | goto dig_only; |
| 11987 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11988 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11989 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11990 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11991 | if (err < 0) |
| 11992 | return err; |
| 11993 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11994 | if (err < 0) |
| 11995 | return err; |
| 11996 | |
| 11997 | spec->multiout.max_channels = 2; |
| 11998 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 11999 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12000 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12001 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12002 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12003 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12004 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12005 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12006 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12007 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12008 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12009 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12010 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12011 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12012 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12013 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12014 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12015 | err = alc_auto_add_mic_boost(codec); |
| 12016 | if (err < 0) |
| 12017 | return err; |
| 12018 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12019 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12020 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12021 | return 1; |
| 12022 | } |
| 12023 | |
| 12024 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12025 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12026 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12027 | |
| 12028 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12029 | static void alc268_auto_init(struct hda_codec *codec) |
| 12030 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12031 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12032 | alc268_auto_init_multi_out(codec); |
| 12033 | alc268_auto_init_hp_out(codec); |
| 12034 | alc268_auto_init_mono_speaker_out(codec); |
| 12035 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12036 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12037 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12038 | } |
| 12039 | |
| 12040 | /* |
| 12041 | * configuration and preset |
| 12042 | */ |
| 12043 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12044 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12045 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12046 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12047 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12048 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12049 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12050 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12051 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12052 | #ifdef CONFIG_SND_DEBUG |
| 12053 | [ALC268_TEST] = "test", |
| 12054 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12055 | [ALC268_AUTO] = "auto", |
| 12056 | }; |
| 12057 | |
| 12058 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12059 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12060 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12061 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12062 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12063 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12064 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12065 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12066 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12067 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12068 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12069 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12070 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12071 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12072 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12073 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12074 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12075 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12076 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12077 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12078 | {} |
| 12079 | }; |
| 12080 | |
| 12081 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12082 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12083 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12084 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12085 | alc267_quanta_il1_verbs }, |
| 12086 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12087 | .dac_nids = alc268_dac_nids, |
| 12088 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12089 | .adc_nids = alc268_adc_nids_alt, |
| 12090 | .hp_nid = 0x03, |
| 12091 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12092 | .channel_mode = alc268_modes, |
| 12093 | .input_mux = &alc268_capture_source, |
| 12094 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12095 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12096 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12097 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12098 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12099 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12100 | .init_verbs = { alc268_base_init_verbs }, |
| 12101 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12102 | .dac_nids = alc268_dac_nids, |
| 12103 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12104 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12105 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12106 | .hp_nid = 0x03, |
| 12107 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12108 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12109 | .channel_mode = alc268_modes, |
| 12110 | .input_mux = &alc268_capture_source, |
| 12111 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12112 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12113 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12114 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12115 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12116 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12117 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12118 | .dac_nids = alc268_dac_nids, |
| 12119 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12120 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12121 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12122 | .hp_nid = 0x03, |
| 12123 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12124 | .channel_mode = alc268_modes, |
| 12125 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12126 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12127 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12128 | }, |
| 12129 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12130 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12131 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12132 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12133 | alc268_acer_verbs }, |
| 12134 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12135 | .dac_nids = alc268_dac_nids, |
| 12136 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12137 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12138 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12139 | .hp_nid = 0x02, |
| 12140 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12141 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12142 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12143 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12144 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12145 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12146 | [ALC268_ACER_DMIC] = { |
| 12147 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12148 | alc268_beep_mixer }, |
| 12149 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12150 | alc268_acer_verbs }, |
| 12151 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12152 | .dac_nids = alc268_dac_nids, |
| 12153 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12154 | .adc_nids = alc268_adc_nids_alt, |
| 12155 | .capsrc_nids = alc268_capsrc_nids, |
| 12156 | .hp_nid = 0x02, |
| 12157 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12158 | .channel_mode = alc268_modes, |
| 12159 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12160 | .unsol_event = alc268_acer_unsol_event, |
| 12161 | .init_hook = alc268_acer_init_hook, |
| 12162 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12163 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12164 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12165 | alc268_beep_mixer, |
| 12166 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12167 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12168 | alc268_acer_aspire_one_verbs }, |
| 12169 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12170 | .dac_nids = alc268_dac_nids, |
| 12171 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12172 | .adc_nids = alc268_adc_nids_alt, |
| 12173 | .capsrc_nids = alc268_capsrc_nids, |
| 12174 | .hp_nid = 0x03, |
| 12175 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12176 | .channel_mode = alc268_modes, |
| 12177 | .input_mux = &alc268_acer_lc_capture_source, |
| 12178 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12179 | .init_hook = alc268_acer_lc_init_hook, |
| 12180 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12181 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12182 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12183 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12184 | alc268_dell_verbs }, |
| 12185 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12186 | .dac_nids = alc268_dac_nids, |
| 12187 | .hp_nid = 0x02, |
| 12188 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12189 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12190 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12191 | .init_hook = alc268_dell_init_hook, |
| 12192 | .input_mux = &alc268_capture_source, |
| 12193 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12194 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12195 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12196 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12197 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12198 | alc268_toshiba_verbs }, |
| 12199 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12200 | .dac_nids = alc268_dac_nids, |
| 12201 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12202 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12203 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12204 | .hp_nid = 0x03, |
| 12205 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12206 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12207 | .channel_mode = alc268_modes, |
| 12208 | .input_mux = &alc268_capture_source, |
| 12209 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12210 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12211 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12212 | #ifdef CONFIG_SND_DEBUG |
| 12213 | [ALC268_TEST] = { |
| 12214 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12215 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12216 | alc268_volume_init_verbs }, |
| 12217 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12218 | .dac_nids = alc268_dac_nids, |
| 12219 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12220 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12221 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12222 | .hp_nid = 0x03, |
| 12223 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12224 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12225 | .channel_mode = alc268_modes, |
| 12226 | .input_mux = &alc268_capture_source, |
| 12227 | }, |
| 12228 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12229 | }; |
| 12230 | |
| 12231 | static int patch_alc268(struct hda_codec *codec) |
| 12232 | { |
| 12233 | struct alc_spec *spec; |
| 12234 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12235 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12236 | |
| 12237 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12238 | if (spec == NULL) |
| 12239 | return -ENOMEM; |
| 12240 | |
| 12241 | codec->spec = spec; |
| 12242 | |
| 12243 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12244 | alc268_models, |
| 12245 | alc268_cfg_tbl); |
| 12246 | |
| 12247 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 12248 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 12249 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12250 | board_config = ALC268_AUTO; |
| 12251 | } |
| 12252 | |
| 12253 | if (board_config == ALC268_AUTO) { |
| 12254 | /* automatic parse from the BIOS config */ |
| 12255 | err = alc268_parse_auto_config(codec); |
| 12256 | if (err < 0) { |
| 12257 | alc_free(codec); |
| 12258 | return err; |
| 12259 | } else if (!err) { |
| 12260 | printk(KERN_INFO |
| 12261 | "hda_codec: Cannot set up configuration " |
| 12262 | "from BIOS. Using base mode...\n"); |
| 12263 | board_config = ALC268_3ST; |
| 12264 | } |
| 12265 | } |
| 12266 | |
| 12267 | if (board_config != ALC268_AUTO) |
| 12268 | setup_preset(spec, &alc268_presets[board_config]); |
| 12269 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12270 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12271 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12272 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12273 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12274 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12275 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12276 | has_beep = 0; |
| 12277 | for (i = 0; i < spec->num_mixers; i++) { |
| 12278 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12279 | has_beep = 1; |
| 12280 | break; |
| 12281 | } |
| 12282 | } |
| 12283 | |
| 12284 | if (has_beep) { |
| 12285 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12286 | if (err < 0) { |
| 12287 | alc_free(codec); |
| 12288 | return err; |
| 12289 | } |
| 12290 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12291 | /* override the amp caps for beep generator */ |
| 12292 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12293 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12294 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12295 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12296 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12297 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12298 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12299 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12300 | /* check whether NID 0x07 is valid */ |
| 12301 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12302 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12303 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12304 | /* get type */ |
| 12305 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12306 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12307 | spec->adc_nids = alc268_adc_nids_alt; |
| 12308 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12309 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12310 | } else { |
| 12311 | spec->adc_nids = alc268_adc_nids; |
| 12312 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12313 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12314 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12315 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12316 | /* set default input source */ |
| 12317 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12318 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12319 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12320 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12321 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12322 | |
| 12323 | spec->vmaster_nid = 0x02; |
| 12324 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12325 | codec->patch_ops = alc_patch_ops; |
| 12326 | if (board_config == ALC268_AUTO) |
| 12327 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12328 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12329 | codec->proc_widget_hook = print_realtek_coef; |
| 12330 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12331 | return 0; |
| 12332 | } |
| 12333 | |
| 12334 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12335 | * ALC269 channel source setting (2 channel) |
| 12336 | */ |
| 12337 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12338 | |
| 12339 | #define alc269_dac_nids alc260_dac_nids |
| 12340 | |
| 12341 | static hda_nid_t alc269_adc_nids[1] = { |
| 12342 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12343 | 0x08, |
| 12344 | }; |
| 12345 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12346 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12347 | 0x23, |
| 12348 | }; |
| 12349 | |
| 12350 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12351 | * not a mux! |
| 12352 | */ |
| 12353 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12354 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12355 | .num_items = 2, |
| 12356 | .items = { |
| 12357 | { "i-Mic", 0x5 }, |
| 12358 | { "e-Mic", 0x0 }, |
| 12359 | }, |
| 12360 | }; |
| 12361 | |
| 12362 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12363 | .num_items = 2, |
| 12364 | .items = { |
| 12365 | { "i-Mic", 0x1 }, |
| 12366 | { "e-Mic", 0x0 }, |
| 12367 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12368 | }; |
| 12369 | |
| 12370 | #define alc269_modes alc260_modes |
| 12371 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12372 | |
| 12373 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12374 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12375 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12376 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12377 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12380 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12381 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12382 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12383 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12384 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12385 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12386 | { } /* end */ |
| 12387 | }; |
| 12388 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12389 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12390 | /* output mixer control */ |
| 12391 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12392 | { |
| 12393 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12394 | .name = "Master Playback Switch", |
| 12395 | .info = snd_hda_mixer_amp_switch_info, |
| 12396 | .get = snd_hda_mixer_amp_switch_get, |
| 12397 | .put = alc268_acer_master_sw_put, |
| 12398 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12399 | }, |
| 12400 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12402 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12403 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12404 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12405 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12406 | { } |
| 12407 | }; |
| 12408 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12409 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12410 | /* output mixer control */ |
| 12411 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12412 | { |
| 12413 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12414 | .name = "Master Playback Switch", |
| 12415 | .info = snd_hda_mixer_amp_switch_info, |
| 12416 | .get = snd_hda_mixer_amp_switch_get, |
| 12417 | .put = alc268_acer_master_sw_put, |
| 12418 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12419 | }, |
| 12420 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12421 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12422 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12423 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12424 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12425 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12426 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12427 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12428 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12429 | { } |
| 12430 | }; |
| 12431 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12432 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12433 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12434 | HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12436 | HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12437 | { } /* end */ |
| 12438 | }; |
| 12439 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12440 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12441 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12442 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12443 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12444 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12445 | { } /* end */ |
| 12446 | }; |
| 12447 | |
| 12448 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12449 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12450 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12451 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12452 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12453 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12454 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12455 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12456 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12457 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12458 | { } |
| 12459 | }; |
| 12460 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12461 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12462 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12463 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12464 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12466 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12467 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12468 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12469 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12470 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12471 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12472 | { } |
| 12473 | }; |
| 12474 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12475 | /* toggle speaker-output according to the hp-jack state */ |
| 12476 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12477 | { |
| 12478 | unsigned int present; |
| 12479 | unsigned char bits; |
| 12480 | |
| 12481 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12482 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12483 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12484 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12485 | AMP_IN_MUTE(0), bits); |
| 12486 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12487 | AMP_IN_MUTE(0), bits); |
| 12488 | |
| 12489 | snd_hda_codec_write(codec, 0x20, 0, |
| 12490 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12491 | snd_hda_codec_write(codec, 0x20, 0, |
| 12492 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12493 | |
| 12494 | snd_hda_codec_write(codec, 0x20, 0, |
| 12495 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12496 | snd_hda_codec_write(codec, 0x20, 0, |
| 12497 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12498 | } |
| 12499 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12500 | /* toggle speaker-output according to the hp-jacks state */ |
| 12501 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12502 | { |
| 12503 | unsigned int present; |
| 12504 | unsigned char bits; |
| 12505 | |
| 12506 | /* Check laptop headphone socket */ |
| 12507 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12508 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12509 | |
| 12510 | /* Check port replicator headphone socket */ |
| 12511 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12512 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12513 | |
| 12514 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12515 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12516 | AMP_IN_MUTE(0), bits); |
| 12517 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12518 | AMP_IN_MUTE(0), bits); |
| 12519 | |
| 12520 | snd_hda_codec_write(codec, 0x20, 0, |
| 12521 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12522 | snd_hda_codec_write(codec, 0x20, 0, |
| 12523 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12524 | |
| 12525 | snd_hda_codec_write(codec, 0x20, 0, |
| 12526 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12527 | snd_hda_codec_write(codec, 0x20, 0, |
| 12528 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12529 | } |
| 12530 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12531 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12532 | { |
| 12533 | unsigned int present; |
| 12534 | |
| 12535 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12536 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12537 | snd_hda_codec_write(codec, 0x23, 0, |
| 12538 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12539 | } |
| 12540 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12541 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12542 | { |
| 12543 | unsigned int present_laptop; |
| 12544 | unsigned int present_dock; |
| 12545 | |
| 12546 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12547 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12548 | |
| 12549 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12550 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12551 | |
| 12552 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12553 | if (present_dock) |
| 12554 | snd_hda_codec_write(codec, 0x23, 0, |
| 12555 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12556 | if (present_laptop) |
| 12557 | snd_hda_codec_write(codec, 0x23, 0, |
| 12558 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12559 | if (!present_dock && !present_laptop) |
| 12560 | snd_hda_codec_write(codec, 0x23, 0, |
| 12561 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12562 | } |
| 12563 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12564 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12565 | unsigned int res) |
| 12566 | { |
| 12567 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12568 | alc269_quanta_fl1_speaker_automute(codec); |
| 12569 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12570 | alc269_quanta_fl1_mic_automute(codec); |
| 12571 | } |
| 12572 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12573 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12574 | unsigned int res) |
| 12575 | { |
| 12576 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12577 | alc269_lifebook_speaker_automute(codec); |
| 12578 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12579 | alc269_lifebook_mic_autoswitch(codec); |
| 12580 | } |
| 12581 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12582 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12583 | { |
| 12584 | alc269_quanta_fl1_speaker_automute(codec); |
| 12585 | alc269_quanta_fl1_mic_automute(codec); |
| 12586 | } |
| 12587 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12588 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12589 | { |
| 12590 | alc269_lifebook_speaker_automute(codec); |
| 12591 | alc269_lifebook_mic_autoswitch(codec); |
| 12592 | } |
| 12593 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12594 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12595 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12596 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12597 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12598 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12599 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12600 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12601 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12602 | {} |
| 12603 | }; |
| 12604 | |
| 12605 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12606 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12607 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12608 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12609 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12610 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12611 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12612 | {} |
| 12613 | }; |
| 12614 | |
| 12615 | /* toggle speaker-output according to the hp-jack state */ |
| 12616 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12617 | { |
| 12618 | unsigned int present; |
| 12619 | unsigned char bits; |
| 12620 | |
| 12621 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12622 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12623 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12624 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12625 | AMP_IN_MUTE(0), bits); |
| 12626 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12627 | AMP_IN_MUTE(0), bits); |
| 12628 | } |
| 12629 | |
| 12630 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12631 | { |
| 12632 | unsigned int present; |
| 12633 | |
| 12634 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12635 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12636 | snd_hda_codec_write(codec, 0x23, 0, |
| 12637 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12638 | } |
| 12639 | |
| 12640 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12641 | { |
| 12642 | unsigned int present; |
| 12643 | |
| 12644 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12645 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12646 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12647 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12648 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12649 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12650 | } |
| 12651 | |
| 12652 | /* unsolicited event for HP jack sensing */ |
| 12653 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12654 | unsigned int res) |
| 12655 | { |
| 12656 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12657 | alc269_speaker_automute(codec); |
| 12658 | |
| 12659 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12660 | alc269_eeepc_dmic_automute(codec); |
| 12661 | } |
| 12662 | |
| 12663 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12664 | { |
| 12665 | alc269_speaker_automute(codec); |
| 12666 | alc269_eeepc_dmic_automute(codec); |
| 12667 | } |
| 12668 | |
| 12669 | /* unsolicited event for HP jack sensing */ |
| 12670 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12671 | unsigned int res) |
| 12672 | { |
| 12673 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12674 | alc269_speaker_automute(codec); |
| 12675 | |
| 12676 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12677 | alc269_eeepc_amic_automute(codec); |
| 12678 | } |
| 12679 | |
| 12680 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12681 | { |
| 12682 | alc269_speaker_automute(codec); |
| 12683 | alc269_eeepc_amic_automute(codec); |
| 12684 | } |
| 12685 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12686 | /* |
| 12687 | * generic initialization of ADC, input mixers and output mixers |
| 12688 | */ |
| 12689 | static struct hda_verb alc269_init_verbs[] = { |
| 12690 | /* |
| 12691 | * Unmute ADC0 and set the default input to mic-in |
| 12692 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12694 | |
| 12695 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12696 | * analog-loopback mixer widget |
| 12697 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12698 | * front panel mic (mic 2) |
| 12699 | */ |
| 12700 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12702 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12704 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12705 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12706 | |
| 12707 | /* |
| 12708 | * Set up output mixers (0x0c - 0x0e) |
| 12709 | */ |
| 12710 | /* set vol=0 to output mixers */ |
| 12711 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12712 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12713 | |
| 12714 | /* set up input amps for analog loopback */ |
| 12715 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12716 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12717 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12718 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12719 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12720 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12721 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12722 | |
| 12723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12724 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12725 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12727 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12730 | |
| 12731 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12732 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12733 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12734 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12735 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12737 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12738 | |
| 12739 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12740 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12741 | |
| 12742 | /* FIXME: use matrix-type input source selection */ |
| 12743 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12744 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12745 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12746 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12747 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12749 | |
| 12750 | /* set EAPD */ |
| 12751 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12752 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12753 | { } |
| 12754 | }; |
| 12755 | |
| 12756 | /* add playback controls from the parsed DAC table */ |
| 12757 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12758 | const struct auto_pin_cfg *cfg) |
| 12759 | { |
| 12760 | hda_nid_t nid; |
| 12761 | int err; |
| 12762 | |
| 12763 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12764 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12765 | spec->multiout.dac_nids[0] = 2; |
| 12766 | |
| 12767 | nid = cfg->line_out_pins[0]; |
| 12768 | if (nid) { |
| 12769 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12770 | "Front Playback Volume", |
| 12771 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 12772 | if (err < 0) |
| 12773 | return err; |
| 12774 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12775 | "Front Playback Switch", |
| 12776 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12777 | if (err < 0) |
| 12778 | return err; |
| 12779 | } |
| 12780 | |
| 12781 | nid = cfg->speaker_pins[0]; |
| 12782 | if (nid) { |
| 12783 | if (!cfg->line_out_pins[0]) { |
| 12784 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12785 | "Speaker Playback Volume", |
| 12786 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12787 | HDA_OUTPUT)); |
| 12788 | if (err < 0) |
| 12789 | return err; |
| 12790 | } |
| 12791 | if (nid == 0x16) { |
| 12792 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12793 | "Speaker Playback Switch", |
| 12794 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12795 | HDA_OUTPUT)); |
| 12796 | if (err < 0) |
| 12797 | return err; |
| 12798 | } else { |
| 12799 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12800 | "Speaker Playback Switch", |
| 12801 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12802 | HDA_OUTPUT)); |
| 12803 | if (err < 0) |
| 12804 | return err; |
| 12805 | } |
| 12806 | } |
| 12807 | nid = cfg->hp_pins[0]; |
| 12808 | if (nid) { |
| 12809 | /* spec->multiout.hp_nid = 2; */ |
| 12810 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 12811 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12812 | "Headphone Playback Volume", |
| 12813 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 12814 | HDA_OUTPUT)); |
| 12815 | if (err < 0) |
| 12816 | return err; |
| 12817 | } |
| 12818 | if (nid == 0x16) { |
| 12819 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12820 | "Headphone Playback Switch", |
| 12821 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12822 | HDA_OUTPUT)); |
| 12823 | if (err < 0) |
| 12824 | return err; |
| 12825 | } else { |
| 12826 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12827 | "Headphone Playback Switch", |
| 12828 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12829 | HDA_OUTPUT)); |
| 12830 | if (err < 0) |
| 12831 | return err; |
| 12832 | } |
| 12833 | } |
| 12834 | return 0; |
| 12835 | } |
| 12836 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12837 | #define alc269_auto_create_analog_input_ctls \ |
| 12838 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12839 | |
| 12840 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12841 | #define alc269_loopbacks alc880_loopbacks |
| 12842 | #endif |
| 12843 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12844 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12845 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 12846 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 12847 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 12848 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 12849 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 12850 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 12851 | .substreams = 1, |
| 12852 | .channels_min = 2, |
| 12853 | .channels_max = 8, |
| 12854 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12855 | /* NID is set in alc_build_pcms */ |
| 12856 | .ops = { |
| 12857 | .open = alc880_playback_pcm_open, |
| 12858 | .prepare = alc880_playback_pcm_prepare, |
| 12859 | .cleanup = alc880_playback_pcm_cleanup |
| 12860 | }, |
| 12861 | }; |
| 12862 | |
| 12863 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 12864 | .substreams = 1, |
| 12865 | .channels_min = 2, |
| 12866 | .channels_max = 2, |
| 12867 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 12868 | /* NID is set in alc_build_pcms */ |
| 12869 | }; |
| 12870 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12871 | /* |
| 12872 | * BIOS auto configuration |
| 12873 | */ |
| 12874 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 12875 | { |
| 12876 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 12877 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12878 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 12879 | |
| 12880 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12881 | alc269_ignore); |
| 12882 | if (err < 0) |
| 12883 | return err; |
| 12884 | |
| 12885 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12886 | if (err < 0) |
| 12887 | return err; |
| 12888 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12889 | if (err < 0) |
| 12890 | return err; |
| 12891 | |
| 12892 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12893 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12894 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12895 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 12896 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12897 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12898 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12899 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12900 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12901 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12902 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12903 | /* set default input source */ |
| 12904 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 12905 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12906 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12907 | |
| 12908 | err = alc_auto_add_mic_boost(codec); |
| 12909 | if (err < 0) |
| 12910 | return err; |
| 12911 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12912 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12913 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12914 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12915 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12916 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12917 | return 1; |
| 12918 | } |
| 12919 | |
| 12920 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 12921 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 12922 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 12923 | |
| 12924 | |
| 12925 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12926 | static void alc269_auto_init(struct hda_codec *codec) |
| 12927 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12928 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12929 | alc269_auto_init_multi_out(codec); |
| 12930 | alc269_auto_init_hp_out(codec); |
| 12931 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12932 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12933 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12934 | } |
| 12935 | |
| 12936 | /* |
| 12937 | * configuration and preset |
| 12938 | */ |
| 12939 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12940 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12941 | [ALC269_QUANTA_FL1] = "quanta", |
| 12942 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12943 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12944 | [ALC269_FUJITSU] = "fujitsu", |
| 12945 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12946 | }; |
| 12947 | |
| 12948 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12949 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12950 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 12951 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 12952 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 12953 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 12954 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 12955 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 12956 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 12957 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12958 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 12959 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12960 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 12961 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 12962 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12963 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12964 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12965 | {} |
| 12966 | }; |
| 12967 | |
| 12968 | static struct alc_config_preset alc269_presets[] = { |
| 12969 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12970 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12971 | .init_verbs = { alc269_init_verbs }, |
| 12972 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12973 | .dac_nids = alc269_dac_nids, |
| 12974 | .hp_nid = 0x03, |
| 12975 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12976 | .channel_mode = alc269_modes, |
| 12977 | .input_mux = &alc269_capture_source, |
| 12978 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12979 | [ALC269_QUANTA_FL1] = { |
| 12980 | .mixers = { alc269_quanta_fl1_mixer }, |
| 12981 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 12982 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12983 | .dac_nids = alc269_dac_nids, |
| 12984 | .hp_nid = 0x03, |
| 12985 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 12986 | .channel_mode = alc269_modes, |
| 12987 | .input_mux = &alc269_capture_source, |
| 12988 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 12989 | .init_hook = alc269_quanta_fl1_init_hook, |
| 12990 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12991 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12992 | .mixers = { alc269_eeepc_mixer }, |
| 12993 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12994 | .init_verbs = { alc269_init_verbs, |
| 12995 | alc269_eeepc_amic_init_verbs }, |
| 12996 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 12997 | .dac_nids = alc269_dac_nids, |
| 12998 | .hp_nid = 0x03, |
| 12999 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13000 | .channel_mode = alc269_modes, |
| 13001 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13002 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13003 | .init_hook = alc269_eeepc_amic_inithook, |
| 13004 | }, |
| 13005 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13006 | .mixers = { alc269_eeepc_mixer }, |
| 13007 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13008 | .init_verbs = { alc269_init_verbs, |
| 13009 | alc269_eeepc_dmic_init_verbs }, |
| 13010 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13011 | .dac_nids = alc269_dac_nids, |
| 13012 | .hp_nid = 0x03, |
| 13013 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13014 | .channel_mode = alc269_modes, |
| 13015 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13016 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13017 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13018 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13019 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13020 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13021 | .cap_mixer = alc269_epc_capture_mixer, |
| 13022 | .init_verbs = { alc269_init_verbs, |
| 13023 | alc269_eeepc_dmic_init_verbs }, |
| 13024 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13025 | .dac_nids = alc269_dac_nids, |
| 13026 | .hp_nid = 0x03, |
| 13027 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13028 | .channel_mode = alc269_modes, |
| 13029 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13030 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13031 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13032 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13033 | [ALC269_LIFEBOOK] = { |
| 13034 | .mixers = { alc269_lifebook_mixer }, |
| 13035 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13036 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13037 | .dac_nids = alc269_dac_nids, |
| 13038 | .hp_nid = 0x03, |
| 13039 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13040 | .channel_mode = alc269_modes, |
| 13041 | .input_mux = &alc269_capture_source, |
| 13042 | .unsol_event = alc269_lifebook_unsol_event, |
| 13043 | .init_hook = alc269_lifebook_init_hook, |
| 13044 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13045 | }; |
| 13046 | |
| 13047 | static int patch_alc269(struct hda_codec *codec) |
| 13048 | { |
| 13049 | struct alc_spec *spec; |
| 13050 | int board_config; |
| 13051 | int err; |
| 13052 | |
| 13053 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13054 | if (spec == NULL) |
| 13055 | return -ENOMEM; |
| 13056 | |
| 13057 | codec->spec = spec; |
| 13058 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13059 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13060 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13061 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13062 | alc269_models, |
| 13063 | alc269_cfg_tbl); |
| 13064 | |
| 13065 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 13066 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 13067 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13068 | board_config = ALC269_AUTO; |
| 13069 | } |
| 13070 | |
| 13071 | if (board_config == ALC269_AUTO) { |
| 13072 | /* automatic parse from the BIOS config */ |
| 13073 | err = alc269_parse_auto_config(codec); |
| 13074 | if (err < 0) { |
| 13075 | alc_free(codec); |
| 13076 | return err; |
| 13077 | } else if (!err) { |
| 13078 | printk(KERN_INFO |
| 13079 | "hda_codec: Cannot set up configuration " |
| 13080 | "from BIOS. Using base mode...\n"); |
| 13081 | board_config = ALC269_BASIC; |
| 13082 | } |
| 13083 | } |
| 13084 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13085 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13086 | if (err < 0) { |
| 13087 | alc_free(codec); |
| 13088 | return err; |
| 13089 | } |
| 13090 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13091 | if (board_config != ALC269_AUTO) |
| 13092 | setup_preset(spec, &alc269_presets[board_config]); |
| 13093 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13094 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13095 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13096 | * fix the sample rate of analog I/O to 44.1kHz |
| 13097 | */ |
| 13098 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13099 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13100 | } else { |
| 13101 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13102 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13103 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13104 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13105 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13106 | |
| 13107 | spec->adc_nids = alc269_adc_nids; |
| 13108 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13109 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13110 | if (!spec->cap_mixer) |
| 13111 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13112 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13113 | |
| 13114 | codec->patch_ops = alc_patch_ops; |
| 13115 | if (board_config == ALC269_AUTO) |
| 13116 | spec->init_hook = alc269_auto_init; |
| 13117 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13118 | if (!spec->loopback.amplist) |
| 13119 | spec->loopback.amplist = alc269_loopbacks; |
| 13120 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13121 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13122 | |
| 13123 | return 0; |
| 13124 | } |
| 13125 | |
| 13126 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13127 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13128 | */ |
| 13129 | |
| 13130 | /* |
| 13131 | * set the path ways for 2 channel output |
| 13132 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13133 | */ |
| 13134 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13135 | /* set pin widget 1Ah (line in) for input */ |
| 13136 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13137 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13138 | * the vref |
| 13139 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13140 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13141 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13142 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13143 | #if 0 |
| 13144 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13145 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13146 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13147 | { } /* end */ |
| 13148 | }; |
| 13149 | /* |
| 13150 | * 6ch mode |
| 13151 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13152 | */ |
| 13153 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13154 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13155 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13156 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13157 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13158 | |
| 13159 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13160 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13161 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13162 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13163 | #if 0 |
| 13164 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13165 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13166 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13167 | { } /* end */ |
| 13168 | }; |
| 13169 | |
| 13170 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13171 | { 2, alc861_threestack_ch2_init }, |
| 13172 | { 6, alc861_threestack_ch6_init }, |
| 13173 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13174 | /* Set mic1 as input and unmute the mixer */ |
| 13175 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13176 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13177 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13178 | { } /* end */ |
| 13179 | }; |
| 13180 | /* Set mic1 as output and mute mixer */ |
| 13181 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13182 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13183 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13184 | { } /* end */ |
| 13185 | }; |
| 13186 | |
| 13187 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13188 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13189 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13190 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13191 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13192 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13193 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13194 | /* set pin widget 1Ah (line in) for input */ |
| 13195 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13196 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13197 | * the vref |
| 13198 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13199 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13200 | |
| 13201 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13202 | #if 0 |
| 13203 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13204 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13205 | #endif |
| 13206 | { } /* end */ |
| 13207 | }; |
| 13208 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13209 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13210 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13211 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13212 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13213 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13214 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13215 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13216 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13217 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13218 | |
| 13219 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13220 | #if 0 |
| 13221 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13222 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13223 | #endif |
| 13224 | { } /* end */ |
| 13225 | }; |
| 13226 | |
| 13227 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13228 | { 2, alc861_asus_ch2_init }, |
| 13229 | { 6, alc861_asus_ch6_init }, |
| 13230 | }; |
| 13231 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13232 | /* patch-ALC861 */ |
| 13233 | |
| 13234 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13235 | /* output mixer control */ |
| 13236 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13237 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13238 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13239 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13240 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13241 | |
| 13242 | /*Input mixer control */ |
| 13243 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13244 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13245 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13246 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13247 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13248 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13249 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13250 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13251 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13252 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13253 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13254 | { } /* end */ |
| 13255 | }; |
| 13256 | |
| 13257 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13258 | /* output mixer control */ |
| 13259 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13260 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13261 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13262 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13263 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13264 | |
| 13265 | /* Input mixer control */ |
| 13266 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13267 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13268 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13269 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13271 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13273 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13274 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13275 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13276 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13277 | { |
| 13278 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13279 | .name = "Channel Mode", |
| 13280 | .info = alc_ch_mode_info, |
| 13281 | .get = alc_ch_mode_get, |
| 13282 | .put = alc_ch_mode_put, |
| 13283 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13284 | }, |
| 13285 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13286 | }; |
| 13287 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13288 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13289 | /* output mixer control */ |
| 13290 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13291 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13293 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13294 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13295 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13296 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13297 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13298 | /* output mixer control */ |
| 13299 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13300 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13301 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13302 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13303 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13304 | |
| 13305 | /* Input mixer control */ |
| 13306 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13307 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13308 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13309 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13310 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13311 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13312 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13313 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13314 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13315 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13316 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13317 | { |
| 13318 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13319 | .name = "Channel Mode", |
| 13320 | .info = alc_ch_mode_info, |
| 13321 | .get = alc_ch_mode_get, |
| 13322 | .put = alc_ch_mode_put, |
| 13323 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13324 | }, |
| 13325 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13326 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13327 | |
| 13328 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13329 | /* output mixer control */ |
| 13330 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13331 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13332 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13333 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13334 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13335 | |
| 13336 | /* Input mixer control */ |
| 13337 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13338 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13339 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13340 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13341 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13342 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13343 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13344 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13345 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13346 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13347 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13348 | { |
| 13349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13350 | .name = "Channel Mode", |
| 13351 | .info = alc_ch_mode_info, |
| 13352 | .get = alc_ch_mode_get, |
| 13353 | .put = alc_ch_mode_put, |
| 13354 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13355 | }, |
| 13356 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13357 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13358 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13359 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13360 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13361 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13362 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13363 | { } |
| 13364 | }; |
| 13365 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13366 | /* |
| 13367 | * generic initialization of ADC, input mixers and output mixers |
| 13368 | */ |
| 13369 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13370 | /* |
| 13371 | * Unmute ADC0 and set the default input to mic-in |
| 13372 | */ |
| 13373 | /* port-A for surround (rear panel) */ |
| 13374 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13375 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13376 | /* port-B for mic-in (rear panel) with vref */ |
| 13377 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13378 | /* port-C for line-in (rear panel) */ |
| 13379 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13380 | /* port-D for Front */ |
| 13381 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13382 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13383 | /* port-E for HP out (front panel) */ |
| 13384 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13385 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13386 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13387 | /* port-F for mic-in (front panel) with vref */ |
| 13388 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13389 | /* port-G for CLFE (rear panel) */ |
| 13390 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13391 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13392 | /* port-H for side (rear panel) */ |
| 13393 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13394 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13395 | /* CD-in */ |
| 13396 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13397 | /* route front mic to ADC1*/ |
| 13398 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13399 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13401 | /* Unmute DAC0~3 & spdif out*/ |
| 13402 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13403 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13404 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13405 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13406 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13407 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13408 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13409 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13410 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13411 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13412 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13413 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13414 | /* Unmute Stereo Mixer 15 */ |
| 13415 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13416 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13417 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13418 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13419 | |
| 13420 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13421 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13422 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13423 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13424 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13425 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13426 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13427 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13428 | /* hp used DAC 3 (Front) */ |
| 13429 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13430 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13431 | |
| 13432 | { } |
| 13433 | }; |
| 13434 | |
| 13435 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13436 | /* |
| 13437 | * Unmute ADC0 and set the default input to mic-in |
| 13438 | */ |
| 13439 | /* port-A for surround (rear panel) */ |
| 13440 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13441 | /* port-B for mic-in (rear panel) with vref */ |
| 13442 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13443 | /* port-C for line-in (rear panel) */ |
| 13444 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13445 | /* port-D for Front */ |
| 13446 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13447 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13448 | /* port-E for HP out (front panel) */ |
| 13449 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13450 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13451 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13452 | /* port-F for mic-in (front panel) with vref */ |
| 13453 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13454 | /* port-G for CLFE (rear panel) */ |
| 13455 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13456 | /* port-H for side (rear panel) */ |
| 13457 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13458 | /* CD-in */ |
| 13459 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13460 | /* route front mic to ADC1*/ |
| 13461 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13463 | /* Unmute DAC0~3 & spdif out*/ |
| 13464 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13465 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13466 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13467 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13468 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13469 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13470 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13471 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13472 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13473 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13474 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13475 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13476 | /* Unmute Stereo Mixer 15 */ |
| 13477 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13478 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13479 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13480 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13481 | |
| 13482 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13483 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13484 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13485 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13486 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13487 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13488 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13489 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13490 | /* hp used DAC 3 (Front) */ |
| 13491 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13492 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13493 | { } |
| 13494 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13495 | |
| 13496 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13497 | /* |
| 13498 | * Unmute ADC0 and set the default input to mic-in |
| 13499 | */ |
| 13500 | /* port-A for surround (rear panel) */ |
| 13501 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13502 | /* port-B for mic-in (rear panel) with vref */ |
| 13503 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13504 | /* port-C for line-in (rear panel) */ |
| 13505 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13506 | /* port-D for Front */ |
| 13507 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13508 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13509 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13510 | /* this has to be set to VREF80 */ |
| 13511 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13512 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13513 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13514 | /* port-F for mic-in (front panel) with vref */ |
| 13515 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13516 | /* port-G for CLFE (rear panel) */ |
| 13517 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13518 | /* port-H for side (rear panel) */ |
| 13519 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13520 | /* CD-in */ |
| 13521 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13522 | /* route front mic to ADC1*/ |
| 13523 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13524 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13525 | /* Unmute DAC0~3 & spdif out*/ |
| 13526 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13527 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13528 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13529 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13531 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13532 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13533 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13534 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13535 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13536 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13537 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13538 | /* Unmute Stereo Mixer 15 */ |
| 13539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13540 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13541 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13543 | |
| 13544 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13545 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13546 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13547 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13548 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13549 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13550 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13551 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13552 | /* hp used DAC 3 (Front) */ |
| 13553 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13554 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13555 | { } |
| 13556 | }; |
| 13557 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13558 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13559 | /* |
| 13560 | * Unmute ADC0 and set the default input to mic-in |
| 13561 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13562 | /* port-A for surround (rear panel) |
| 13563 | * according to codec#0 this is the HP jack |
| 13564 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13565 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13566 | /* route front PCM to HP */ |
| 13567 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13568 | /* port-B for mic-in (rear panel) with vref */ |
| 13569 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13570 | /* port-C for line-in (rear panel) */ |
| 13571 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13572 | /* port-D for Front */ |
| 13573 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13574 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13575 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13576 | /* this has to be set to VREF80 */ |
| 13577 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13578 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13579 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13580 | /* port-F for mic-in (front panel) with vref */ |
| 13581 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13582 | /* port-G for CLFE (rear panel) */ |
| 13583 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13584 | /* port-H for side (rear panel) */ |
| 13585 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13586 | /* CD-in */ |
| 13587 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13588 | /* route front mic to ADC1*/ |
| 13589 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13590 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13591 | /* Unmute DAC0~3 & spdif out*/ |
| 13592 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13593 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13594 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13595 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13596 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13597 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13598 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13599 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13600 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13601 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13602 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13603 | /* Unmute Stereo Mixer 15 */ |
| 13604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13605 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13606 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13607 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13608 | |
| 13609 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13610 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13611 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13612 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13613 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13614 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13615 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13616 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13617 | /* hp used DAC 3 (Front) */ |
| 13618 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13619 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13620 | { } |
| 13621 | }; |
| 13622 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13623 | /* additional init verbs for ASUS laptops */ |
| 13624 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13625 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13626 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13627 | { } |
| 13628 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13629 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13630 | /* |
| 13631 | * generic initialization of ADC, input mixers and output mixers |
| 13632 | */ |
| 13633 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13634 | /* |
| 13635 | * Unmute ADC0 and set the default input to mic-in |
| 13636 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13637 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13638 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13640 | /* Unmute DAC0~3 & spdif out*/ |
| 13641 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13642 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13643 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13644 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13647 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13648 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13649 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13650 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13651 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13652 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13653 | /* Unmute Stereo Mixer 15 */ |
| 13654 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13655 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13656 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13657 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13658 | |
| 13659 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13660 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13661 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13662 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13663 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13664 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13665 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13666 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13667 | |
| 13668 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13669 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13670 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13671 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13672 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13673 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13674 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13675 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13676 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13677 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13678 | |
| 13679 | { } |
| 13680 | }; |
| 13681 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13682 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13683 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13684 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13685 | { } |
| 13686 | }; |
| 13687 | |
| 13688 | /* toggle speaker-output according to the hp-jack state */ |
| 13689 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13690 | { |
| 13691 | unsigned int present; |
| 13692 | |
| 13693 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13694 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13695 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13696 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13697 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13698 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13699 | } |
| 13700 | |
| 13701 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13702 | unsigned int res) |
| 13703 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13704 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13705 | alc861_toshiba_automute(codec); |
| 13706 | } |
| 13707 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13708 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13709 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13710 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13711 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13712 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13713 | |
| 13714 | |
| 13715 | #define ALC861_DIGOUT_NID 0x07 |
| 13716 | |
| 13717 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13718 | { 8, NULL } |
| 13719 | }; |
| 13720 | |
| 13721 | static hda_nid_t alc861_dac_nids[4] = { |
| 13722 | /* front, surround, clfe, side */ |
| 13723 | 0x03, 0x06, 0x05, 0x04 |
| 13724 | }; |
| 13725 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13726 | static hda_nid_t alc660_dac_nids[3] = { |
| 13727 | /* front, clfe, surround */ |
| 13728 | 0x03, 0x05, 0x06 |
| 13729 | }; |
| 13730 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13731 | static hda_nid_t alc861_adc_nids[1] = { |
| 13732 | /* ADC0-2 */ |
| 13733 | 0x08, |
| 13734 | }; |
| 13735 | |
| 13736 | static struct hda_input_mux alc861_capture_source = { |
| 13737 | .num_items = 5, |
| 13738 | .items = { |
| 13739 | { "Mic", 0x0 }, |
| 13740 | { "Front Mic", 0x3 }, |
| 13741 | { "Line", 0x1 }, |
| 13742 | { "CD", 0x4 }, |
| 13743 | { "Mixer", 0x5 }, |
| 13744 | }, |
| 13745 | }; |
| 13746 | |
| 13747 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13748 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 13749 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13750 | { |
| 13751 | int i; |
| 13752 | hda_nid_t nid; |
| 13753 | |
| 13754 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 13755 | for (i = 0; i < cfg->line_outs; i++) { |
| 13756 | nid = cfg->line_out_pins[i]; |
| 13757 | if (nid) { |
| 13758 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 13759 | continue; |
| 13760 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 13761 | } |
| 13762 | } |
| 13763 | spec->multiout.num_dacs = cfg->line_outs; |
| 13764 | return 0; |
| 13765 | } |
| 13766 | |
| 13767 | /* add playback controls from the parsed DAC table */ |
| 13768 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13769 | const struct auto_pin_cfg *cfg) |
| 13770 | { |
| 13771 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13772 | static const char *chname[4] = { |
| 13773 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13774 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13775 | hda_nid_t nid; |
| 13776 | int i, idx, err; |
| 13777 | |
| 13778 | for (i = 0; i < cfg->line_outs; i++) { |
| 13779 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13780 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13781 | continue; |
| 13782 | if (nid == 0x05) { |
| 13783 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13784 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13785 | "Center Playback Switch", |
| 13786 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13787 | HDA_OUTPUT)); |
| 13788 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13789 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13790 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13791 | "LFE Playback Switch", |
| 13792 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13793 | HDA_OUTPUT)); |
| 13794 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13795 | return err; |
| 13796 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13797 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 13798 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13799 | if (nid == alc861_dac_nids[idx]) |
| 13800 | break; |
| 13801 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13802 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13803 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13804 | HDA_OUTPUT)); |
| 13805 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13806 | return err; |
| 13807 | } |
| 13808 | } |
| 13809 | return 0; |
| 13810 | } |
| 13811 | |
| 13812 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 13813 | { |
| 13814 | int err; |
| 13815 | hda_nid_t nid; |
| 13816 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13817 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13818 | return 0; |
| 13819 | |
| 13820 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 13821 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13822 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13823 | "Headphone Playback Switch", |
| 13824 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13825 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13826 | return err; |
| 13827 | spec->multiout.hp_nid = nid; |
| 13828 | } |
| 13829 | return 0; |
| 13830 | } |
| 13831 | |
| 13832 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13833 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13834 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13835 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13836 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13837 | int i, err, idx, idx1; |
| 13838 | |
| 13839 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13840 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13841 | case 0x0c: |
| 13842 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13843 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13844 | break; |
| 13845 | case 0x0f: |
| 13846 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13847 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13848 | break; |
| 13849 | case 0x0d: |
| 13850 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13851 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13852 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13853 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13854 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13855 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13856 | break; |
| 13857 | case 0x11: |
| 13858 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13859 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13860 | break; |
| 13861 | default: |
| 13862 | continue; |
| 13863 | } |
| 13864 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13865 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13866 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13867 | if (err < 0) |
| 13868 | return err; |
| 13869 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 13870 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13871 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13872 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13873 | } |
| 13874 | return 0; |
| 13875 | } |
| 13876 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13877 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13878 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13879 | int pin_type, int dac_idx) |
| 13880 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 13881 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13882 | pin_type); |
| 13883 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13884 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13885 | } |
| 13886 | |
| 13887 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 13888 | { |
| 13889 | struct alc_spec *spec = codec->spec; |
| 13890 | int i; |
| 13891 | |
| 13892 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13893 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13894 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13895 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13896 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13897 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13898 | } |
| 13899 | } |
| 13900 | |
| 13901 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 13902 | { |
| 13903 | struct alc_spec *spec = codec->spec; |
| 13904 | hda_nid_t pin; |
| 13905 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 13906 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13907 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13908 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 13909 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13910 | pin = spec->autocfg.speaker_pins[0]; |
| 13911 | if (pin) |
| 13912 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13913 | } |
| 13914 | |
| 13915 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 13916 | { |
| 13917 | struct alc_spec *spec = codec->spec; |
| 13918 | int i; |
| 13919 | |
| 13920 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13921 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 13922 | if (nid >= 0x0c && nid <= 0x11) |
| 13923 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13924 | } |
| 13925 | } |
| 13926 | |
| 13927 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13928 | /* return 1 if successful, 0 if the proper config is not found, |
| 13929 | * or a negative error code |
| 13930 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13931 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 13932 | { |
| 13933 | struct alc_spec *spec = codec->spec; |
| 13934 | int err; |
| 13935 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 13936 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13937 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13938 | alc861_ignore); |
| 13939 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13940 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13941 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13942 | return 0; /* can't find valid BIOS pin config */ |
| 13943 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13944 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13945 | if (err < 0) |
| 13946 | return err; |
| 13947 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13948 | if (err < 0) |
| 13949 | return err; |
| 13950 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 13951 | if (err < 0) |
| 13952 | return err; |
| 13953 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13954 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13955 | return err; |
| 13956 | |
| 13957 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13958 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13959 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13960 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 13961 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13962 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13963 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13964 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13965 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13966 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 13967 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13968 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13969 | |
| 13970 | spec->adc_nids = alc861_adc_nids; |
| 13971 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13972 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13973 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 13974 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 13975 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13976 | return 1; |
| 13977 | } |
| 13978 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13979 | /* additional initialization for auto-configuration model */ |
| 13980 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13981 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13982 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13983 | alc861_auto_init_multi_out(codec); |
| 13984 | alc861_auto_init_hp_out(codec); |
| 13985 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13986 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13987 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13988 | } |
| 13989 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13990 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13991 | static struct hda_amp_list alc861_loopbacks[] = { |
| 13992 | { 0x15, HDA_INPUT, 0 }, |
| 13993 | { 0x15, HDA_INPUT, 1 }, |
| 13994 | { 0x15, HDA_INPUT, 2 }, |
| 13995 | { 0x15, HDA_INPUT, 3 }, |
| 13996 | { } /* end */ |
| 13997 | }; |
| 13998 | #endif |
| 13999 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14000 | |
| 14001 | /* |
| 14002 | * configuration and preset |
| 14003 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14004 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14005 | [ALC861_3ST] = "3stack", |
| 14006 | [ALC660_3ST] = "3stack-660", |
| 14007 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14008 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14009 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14010 | [ALC861_TOSHIBA] = "toshiba", |
| 14011 | [ALC861_ASUS] = "asus", |
| 14012 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14013 | [ALC861_AUTO] = "auto", |
| 14014 | }; |
| 14015 | |
| 14016 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14017 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14018 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14019 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14020 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14021 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14022 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14023 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14024 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14025 | * Any other models that need this preset? |
| 14026 | */ |
| 14027 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14028 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14029 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14030 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14031 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14032 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14033 | /* FIXME: the below seems conflict */ |
| 14034 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14035 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14036 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14037 | {} |
| 14038 | }; |
| 14039 | |
| 14040 | static struct alc_config_preset alc861_presets[] = { |
| 14041 | [ALC861_3ST] = { |
| 14042 | .mixers = { alc861_3ST_mixer }, |
| 14043 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14044 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14045 | .dac_nids = alc861_dac_nids, |
| 14046 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14047 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14048 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14049 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14050 | .adc_nids = alc861_adc_nids, |
| 14051 | .input_mux = &alc861_capture_source, |
| 14052 | }, |
| 14053 | [ALC861_3ST_DIG] = { |
| 14054 | .mixers = { alc861_base_mixer }, |
| 14055 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14056 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14057 | .dac_nids = alc861_dac_nids, |
| 14058 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14059 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14060 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14061 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14062 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14063 | .adc_nids = alc861_adc_nids, |
| 14064 | .input_mux = &alc861_capture_source, |
| 14065 | }, |
| 14066 | [ALC861_6ST_DIG] = { |
| 14067 | .mixers = { alc861_base_mixer }, |
| 14068 | .init_verbs = { alc861_base_init_verbs }, |
| 14069 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14070 | .dac_nids = alc861_dac_nids, |
| 14071 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14072 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14073 | .channel_mode = alc861_8ch_modes, |
| 14074 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14075 | .adc_nids = alc861_adc_nids, |
| 14076 | .input_mux = &alc861_capture_source, |
| 14077 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14078 | [ALC660_3ST] = { |
| 14079 | .mixers = { alc861_3ST_mixer }, |
| 14080 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14081 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14082 | .dac_nids = alc660_dac_nids, |
| 14083 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14084 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14085 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14086 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14087 | .adc_nids = alc861_adc_nids, |
| 14088 | .input_mux = &alc861_capture_source, |
| 14089 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14090 | [ALC861_UNIWILL_M31] = { |
| 14091 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14092 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14093 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14094 | .dac_nids = alc861_dac_nids, |
| 14095 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14096 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14097 | .channel_mode = alc861_uniwill_m31_modes, |
| 14098 | .need_dac_fix = 1, |
| 14099 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14100 | .adc_nids = alc861_adc_nids, |
| 14101 | .input_mux = &alc861_capture_source, |
| 14102 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14103 | [ALC861_TOSHIBA] = { |
| 14104 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14105 | .init_verbs = { alc861_base_init_verbs, |
| 14106 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14107 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14108 | .dac_nids = alc861_dac_nids, |
| 14109 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14110 | .channel_mode = alc883_3ST_2ch_modes, |
| 14111 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14112 | .adc_nids = alc861_adc_nids, |
| 14113 | .input_mux = &alc861_capture_source, |
| 14114 | .unsol_event = alc861_toshiba_unsol_event, |
| 14115 | .init_hook = alc861_toshiba_automute, |
| 14116 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14117 | [ALC861_ASUS] = { |
| 14118 | .mixers = { alc861_asus_mixer }, |
| 14119 | .init_verbs = { alc861_asus_init_verbs }, |
| 14120 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14121 | .dac_nids = alc861_dac_nids, |
| 14122 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14123 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14124 | .channel_mode = alc861_asus_modes, |
| 14125 | .need_dac_fix = 1, |
| 14126 | .hp_nid = 0x06, |
| 14127 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14128 | .adc_nids = alc861_adc_nids, |
| 14129 | .input_mux = &alc861_capture_source, |
| 14130 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14131 | [ALC861_ASUS_LAPTOP] = { |
| 14132 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14133 | .init_verbs = { alc861_asus_init_verbs, |
| 14134 | alc861_asus_laptop_init_verbs }, |
| 14135 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14136 | .dac_nids = alc861_dac_nids, |
| 14137 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14138 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14139 | .channel_mode = alc883_3ST_2ch_modes, |
| 14140 | .need_dac_fix = 1, |
| 14141 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14142 | .adc_nids = alc861_adc_nids, |
| 14143 | .input_mux = &alc861_capture_source, |
| 14144 | }, |
| 14145 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14146 | |
| 14147 | |
| 14148 | static int patch_alc861(struct hda_codec *codec) |
| 14149 | { |
| 14150 | struct alc_spec *spec; |
| 14151 | int board_config; |
| 14152 | int err; |
| 14153 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14154 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14155 | if (spec == NULL) |
| 14156 | return -ENOMEM; |
| 14157 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14158 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14159 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14160 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14161 | alc861_models, |
| 14162 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14163 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14164 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 14165 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 14166 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14167 | board_config = ALC861_AUTO; |
| 14168 | } |
| 14169 | |
| 14170 | if (board_config == ALC861_AUTO) { |
| 14171 | /* automatic parse from the BIOS config */ |
| 14172 | err = alc861_parse_auto_config(codec); |
| 14173 | if (err < 0) { |
| 14174 | alc_free(codec); |
| 14175 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14176 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14177 | printk(KERN_INFO |
| 14178 | "hda_codec: Cannot set up configuration " |
| 14179 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14180 | board_config = ALC861_3ST_DIG; |
| 14181 | } |
| 14182 | } |
| 14183 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14184 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14185 | if (err < 0) { |
| 14186 | alc_free(codec); |
| 14187 | return err; |
| 14188 | } |
| 14189 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14190 | if (board_config != ALC861_AUTO) |
| 14191 | setup_preset(spec, &alc861_presets[board_config]); |
| 14192 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14193 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14194 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14195 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14196 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14197 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14198 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14199 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14200 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14201 | spec->vmaster_nid = 0x03; |
| 14202 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14203 | codec->patch_ops = alc_patch_ops; |
| 14204 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14205 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14206 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14207 | if (!spec->loopback.amplist) |
| 14208 | spec->loopback.amplist = alc861_loopbacks; |
| 14209 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14210 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14211 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14212 | return 0; |
| 14213 | } |
| 14214 | |
| 14215 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14216 | * ALC861-VD support |
| 14217 | * |
| 14218 | * Based on ALC882 |
| 14219 | * |
| 14220 | * In addition, an independent DAC |
| 14221 | */ |
| 14222 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14223 | |
| 14224 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14225 | /* front, surr, clfe, side surr */ |
| 14226 | 0x02, 0x03, 0x04, 0x05 |
| 14227 | }; |
| 14228 | |
| 14229 | /* dac_nids for ALC660vd are in a different order - according to |
| 14230 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14231 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14232 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14233 | * - and it is the same as in 861vd. |
| 14234 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14235 | */ |
| 14236 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14237 | /* front, rear, clfe, rear_surr */ |
| 14238 | 0x02, 0x04, 0x03 |
| 14239 | }; |
| 14240 | |
| 14241 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14242 | /* ADC0 */ |
| 14243 | 0x09, |
| 14244 | }; |
| 14245 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14246 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14247 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14248 | /* input MUX */ |
| 14249 | /* FIXME: should be a matrix-type input source selection */ |
| 14250 | static struct hda_input_mux alc861vd_capture_source = { |
| 14251 | .num_items = 4, |
| 14252 | .items = { |
| 14253 | { "Mic", 0x0 }, |
| 14254 | { "Front Mic", 0x1 }, |
| 14255 | { "Line", 0x2 }, |
| 14256 | { "CD", 0x4 }, |
| 14257 | }, |
| 14258 | }; |
| 14259 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14260 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14261 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14262 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14263 | { "Ext Mic", 0x0 }, |
| 14264 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14265 | }, |
| 14266 | }; |
| 14267 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14268 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14269 | .num_items = 2, |
| 14270 | .items = { |
| 14271 | { "Front Mic", 0x0 }, |
| 14272 | { "ATAPI Mic", 0x1 }, |
| 14273 | }, |
| 14274 | }; |
| 14275 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14276 | /* |
| 14277 | * 2ch mode |
| 14278 | */ |
| 14279 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14280 | { 2, NULL } |
| 14281 | }; |
| 14282 | |
| 14283 | /* |
| 14284 | * 6ch mode |
| 14285 | */ |
| 14286 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14287 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14288 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14289 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14290 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14291 | { } /* end */ |
| 14292 | }; |
| 14293 | |
| 14294 | /* |
| 14295 | * 8ch mode |
| 14296 | */ |
| 14297 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14298 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14299 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14300 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14301 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14302 | { } /* end */ |
| 14303 | }; |
| 14304 | |
| 14305 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14306 | { 6, alc861vd_6stack_ch6_init }, |
| 14307 | { 8, alc861vd_6stack_ch8_init }, |
| 14308 | }; |
| 14309 | |
| 14310 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14311 | { |
| 14312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14313 | .name = "Channel Mode", |
| 14314 | .info = alc_ch_mode_info, |
| 14315 | .get = alc_ch_mode_get, |
| 14316 | .put = alc_ch_mode_put, |
| 14317 | }, |
| 14318 | { } /* end */ |
| 14319 | }; |
| 14320 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14321 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14322 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14323 | */ |
| 14324 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14325 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14326 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14327 | |
| 14328 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14329 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14330 | |
| 14331 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14332 | HDA_OUTPUT), |
| 14333 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14334 | HDA_OUTPUT), |
| 14335 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14336 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14337 | |
| 14338 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14339 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14340 | |
| 14341 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14342 | |
| 14343 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14344 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14345 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14346 | |
| 14347 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14348 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14349 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14350 | |
| 14351 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14352 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14353 | |
| 14354 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14355 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14356 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14357 | { } /* end */ |
| 14358 | }; |
| 14359 | |
| 14360 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14361 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14362 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14363 | |
| 14364 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14365 | |
| 14366 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14367 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14368 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14369 | |
| 14370 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14371 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14372 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14373 | |
| 14374 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14375 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14376 | |
| 14377 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14378 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14379 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14380 | { } /* end */ |
| 14381 | }; |
| 14382 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14383 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14385 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14386 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14387 | |
| 14388 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14389 | |
| 14390 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14391 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14393 | |
| 14394 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14395 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14396 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14397 | |
| 14398 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14399 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14400 | |
| 14401 | { } /* end */ |
| 14402 | }; |
| 14403 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14404 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14405 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14406 | */ |
| 14407 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14408 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14409 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14410 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14411 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14412 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14413 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14414 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14415 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14416 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14417 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14418 | { } /* end */ |
| 14419 | }; |
| 14420 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14421 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14422 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14423 | */ |
| 14424 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14425 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14426 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14427 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14428 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14429 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14430 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14431 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14432 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14433 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14434 | { } /* end */ |
| 14435 | }; |
| 14436 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14437 | /* |
| 14438 | * generic initialization of ADC, input mixers and output mixers |
| 14439 | */ |
| 14440 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14441 | /* |
| 14442 | * Unmute ADC0 and set the default input to mic-in |
| 14443 | */ |
| 14444 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14445 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14446 | |
| 14447 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14448 | * the analog-loopback mixer widget |
| 14449 | */ |
| 14450 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14451 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14452 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14453 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14454 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14455 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14456 | |
| 14457 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14459 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14460 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14461 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14462 | |
| 14463 | /* |
| 14464 | * Set up output mixers (0x02 - 0x05) |
| 14465 | */ |
| 14466 | /* set vol=0 to output mixers */ |
| 14467 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14468 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14469 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14470 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14471 | |
| 14472 | /* set up input amps for analog loopback */ |
| 14473 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14474 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14475 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14476 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14477 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14478 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14479 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14480 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14481 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14482 | |
| 14483 | { } |
| 14484 | }; |
| 14485 | |
| 14486 | /* |
| 14487 | * 3-stack pin configuration: |
| 14488 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14489 | */ |
| 14490 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14491 | /* |
| 14492 | * Set pin mode and muting |
| 14493 | */ |
| 14494 | /* set front pin widgets 0x14 for output */ |
| 14495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14498 | |
| 14499 | /* Mic (rear) pin: input vref at 80% */ |
| 14500 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14501 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14502 | /* Front Mic pin: input vref at 80% */ |
| 14503 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14504 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14505 | /* Line In pin: input */ |
| 14506 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14508 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14509 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14510 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14511 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14512 | /* CD pin widget for input */ |
| 14513 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14514 | |
| 14515 | { } |
| 14516 | }; |
| 14517 | |
| 14518 | /* |
| 14519 | * 6-stack pin configuration: |
| 14520 | */ |
| 14521 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14522 | /* |
| 14523 | * Set pin mode and muting |
| 14524 | */ |
| 14525 | /* set front pin widgets 0x14 for output */ |
| 14526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14528 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14529 | |
| 14530 | /* Rear Pin: output 1 (0x0d) */ |
| 14531 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14532 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14533 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14534 | /* CLFE Pin: output 2 (0x0e) */ |
| 14535 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14536 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14537 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14538 | /* Side Pin: output 3 (0x0f) */ |
| 14539 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14540 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14541 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14542 | |
| 14543 | /* Mic (rear) pin: input vref at 80% */ |
| 14544 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14545 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14546 | /* Front Mic pin: input vref at 80% */ |
| 14547 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14548 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14549 | /* Line In pin: input */ |
| 14550 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14551 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14552 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14553 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14554 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14555 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14556 | /* CD pin widget for input */ |
| 14557 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14558 | |
| 14559 | { } |
| 14560 | }; |
| 14561 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14562 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14563 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14564 | { } |
| 14565 | }; |
| 14566 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14567 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14568 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14569 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14570 | { } |
| 14571 | }; |
| 14572 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14573 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14574 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14575 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14576 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14577 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14578 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14579 | {} |
| 14580 | }; |
| 14581 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14582 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14583 | { |
| 14584 | unsigned int present; |
| 14585 | unsigned char bits; |
| 14586 | |
| 14587 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14588 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14589 | bits = present ? HDA_AMP_MUTE : 0; |
| 14590 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14591 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14592 | } |
| 14593 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14594 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14595 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14596 | struct alc_spec *spec = codec->spec; |
| 14597 | |
| 14598 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14599 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14600 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14601 | alc861vd_lenovo_mic_automute(codec); |
| 14602 | } |
| 14603 | |
| 14604 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14605 | unsigned int res) |
| 14606 | { |
| 14607 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14608 | case ALC880_MIC_EVENT: |
| 14609 | alc861vd_lenovo_mic_automute(codec); |
| 14610 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14611 | default: |
| 14612 | alc_automute_amp_unsol_event(codec, res); |
| 14613 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14614 | } |
| 14615 | } |
| 14616 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14617 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14618 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14619 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14620 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14621 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14622 | |
| 14623 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14624 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14625 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14626 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14627 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14628 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14629 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14630 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14631 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14632 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14633 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14634 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14635 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14636 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14637 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14638 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14639 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14640 | |
| 14641 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14642 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14643 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14644 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14645 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14646 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14647 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14648 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14649 | |
| 14650 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14651 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14652 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14653 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14654 | |
| 14655 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14656 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14657 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14658 | |
| 14659 | { } /* end */ |
| 14660 | }; |
| 14661 | |
| 14662 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14663 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14664 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14665 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14666 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14667 | spec->autocfg.hp_pins[0] = 0x15; |
| 14668 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14669 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14670 | } |
| 14671 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14672 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14673 | #define alc861vd_loopbacks alc880_loopbacks |
| 14674 | #endif |
| 14675 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14676 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14677 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14678 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14679 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14680 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14681 | |
| 14682 | /* |
| 14683 | * configuration and preset |
| 14684 | */ |
| 14685 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14686 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14687 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14688 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14689 | [ALC861VD_3ST] = "3stack", |
| 14690 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14691 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14692 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14693 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14694 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14695 | [ALC861VD_AUTO] = "auto", |
| 14696 | }; |
| 14697 | |
| 14698 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14699 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14700 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14701 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14702 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14703 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14704 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14705 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14706 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14707 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14708 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14709 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14710 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14711 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14712 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14713 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14714 | {} |
| 14715 | }; |
| 14716 | |
| 14717 | static struct alc_config_preset alc861vd_presets[] = { |
| 14718 | [ALC660VD_3ST] = { |
| 14719 | .mixers = { alc861vd_3st_mixer }, |
| 14720 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14721 | alc861vd_3stack_init_verbs }, |
| 14722 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14723 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14724 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14725 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14726 | .input_mux = &alc861vd_capture_source, |
| 14727 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14728 | [ALC660VD_3ST_DIG] = { |
| 14729 | .mixers = { alc861vd_3st_mixer }, |
| 14730 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14731 | alc861vd_3stack_init_verbs }, |
| 14732 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14733 | .dac_nids = alc660vd_dac_nids, |
| 14734 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14735 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14736 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14737 | .input_mux = &alc861vd_capture_source, |
| 14738 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14739 | [ALC861VD_3ST] = { |
| 14740 | .mixers = { alc861vd_3st_mixer }, |
| 14741 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14742 | alc861vd_3stack_init_verbs }, |
| 14743 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14744 | .dac_nids = alc861vd_dac_nids, |
| 14745 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14746 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14747 | .input_mux = &alc861vd_capture_source, |
| 14748 | }, |
| 14749 | [ALC861VD_3ST_DIG] = { |
| 14750 | .mixers = { alc861vd_3st_mixer }, |
| 14751 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14752 | alc861vd_3stack_init_verbs }, |
| 14753 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14754 | .dac_nids = alc861vd_dac_nids, |
| 14755 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14756 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14757 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14758 | .input_mux = &alc861vd_capture_source, |
| 14759 | }, |
| 14760 | [ALC861VD_6ST_DIG] = { |
| 14761 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 14762 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14763 | alc861vd_6stack_init_verbs }, |
| 14764 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14765 | .dac_nids = alc861vd_dac_nids, |
| 14766 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14767 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 14768 | .channel_mode = alc861vd_6stack_modes, |
| 14769 | .input_mux = &alc861vd_capture_source, |
| 14770 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14771 | [ALC861VD_LENOVO] = { |
| 14772 | .mixers = { alc861vd_lenovo_mixer }, |
| 14773 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14774 | alc861vd_3stack_init_verbs, |
| 14775 | alc861vd_eapd_verbs, |
| 14776 | alc861vd_lenovo_unsol_verbs }, |
| 14777 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14778 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14779 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14780 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14781 | .input_mux = &alc861vd_capture_source, |
| 14782 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14783 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14784 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14785 | [ALC861VD_DALLAS] = { |
| 14786 | .mixers = { alc861vd_dallas_mixer }, |
| 14787 | .init_verbs = { alc861vd_dallas_verbs }, |
| 14788 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14789 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14790 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14791 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14792 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14793 | .unsol_event = alc_automute_amp_unsol_event, |
| 14794 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14795 | }, |
| 14796 | [ALC861VD_HP] = { |
| 14797 | .mixers = { alc861vd_hp_mixer }, |
| 14798 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 14799 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 14800 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14801 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14802 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14803 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14804 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14805 | .unsol_event = alc_automute_amp_unsol_event, |
| 14806 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14807 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14808 | [ALC660VD_ASUS_V1S] = { |
| 14809 | .mixers = { alc861vd_lenovo_mixer }, |
| 14810 | .init_verbs = { alc861vd_volume_init_verbs, |
| 14811 | alc861vd_3stack_init_verbs, |
| 14812 | alc861vd_eapd_verbs, |
| 14813 | alc861vd_lenovo_unsol_verbs }, |
| 14814 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 14815 | .dac_nids = alc660vd_dac_nids, |
| 14816 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 14817 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 14818 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 14819 | .input_mux = &alc861vd_capture_source, |
| 14820 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14821 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14822 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14823 | }; |
| 14824 | |
| 14825 | /* |
| 14826 | * BIOS auto configuration |
| 14827 | */ |
| 14828 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14829 | hda_nid_t nid, int pin_type, int dac_idx) |
| 14830 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14831 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14832 | } |
| 14833 | |
| 14834 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 14835 | { |
| 14836 | struct alc_spec *spec = codec->spec; |
| 14837 | int i; |
| 14838 | |
| 14839 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14840 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14841 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14842 | if (nid) |
| 14843 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14844 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14845 | } |
| 14846 | } |
| 14847 | |
| 14848 | |
| 14849 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 14850 | { |
| 14851 | struct alc_spec *spec = codec->spec; |
| 14852 | hda_nid_t pin; |
| 14853 | |
| 14854 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14855 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14856 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14857 | pin = spec->autocfg.speaker_pins[0]; |
| 14858 | if (pin) |
| 14859 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14860 | } |
| 14861 | |
| 14862 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14863 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 14864 | |
| 14865 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 14866 | { |
| 14867 | struct alc_spec *spec = codec->spec; |
| 14868 | int i; |
| 14869 | |
| 14870 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14871 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14872 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14873 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 14874 | if (nid != ALC861VD_PIN_CD_NID && |
| 14875 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14876 | snd_hda_codec_write(codec, nid, 0, |
| 14877 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14878 | AMP_OUT_MUTE); |
| 14879 | } |
| 14880 | } |
| 14881 | } |
| 14882 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 14883 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 14884 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14885 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 14886 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 14887 | |
| 14888 | /* add playback controls from the parsed DAC table */ |
| 14889 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14890 | * different NIDs for mute/unmute switch and volume control */ |
| 14891 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14892 | const struct auto_pin_cfg *cfg) |
| 14893 | { |
| 14894 | char name[32]; |
| 14895 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 14896 | hda_nid_t nid_v, nid_s; |
| 14897 | int i, err; |
| 14898 | |
| 14899 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14900 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14901 | continue; |
| 14902 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14903 | alc880_dac_to_idx( |
| 14904 | spec->multiout.dac_nids[i])); |
| 14905 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14906 | alc880_dac_to_idx( |
| 14907 | spec->multiout.dac_nids[i])); |
| 14908 | |
| 14909 | if (i == 2) { |
| 14910 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14911 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14912 | "Center Playback Volume", |
| 14913 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 14914 | HDA_OUTPUT)); |
| 14915 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14916 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14917 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14918 | "LFE Playback Volume", |
| 14919 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 14920 | HDA_OUTPUT)); |
| 14921 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14922 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14923 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14924 | "Center Playback Switch", |
| 14925 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 14926 | HDA_INPUT)); |
| 14927 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14928 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14929 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14930 | "LFE Playback Switch", |
| 14931 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 14932 | HDA_INPUT)); |
| 14933 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14934 | return err; |
| 14935 | } else { |
| 14936 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14937 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14938 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 14939 | HDA_OUTPUT)); |
| 14940 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14941 | return err; |
| 14942 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14943 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14944 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14945 | HDA_INPUT)); |
| 14946 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14947 | return err; |
| 14948 | } |
| 14949 | } |
| 14950 | return 0; |
| 14951 | } |
| 14952 | |
| 14953 | /* add playback controls for speaker and HP outputs */ |
| 14954 | /* Based on ALC880 version. But ALC861VD has separate, |
| 14955 | * different NIDs for mute/unmute switch and volume control */ |
| 14956 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 14957 | hda_nid_t pin, const char *pfx) |
| 14958 | { |
| 14959 | hda_nid_t nid_v, nid_s; |
| 14960 | int err; |
| 14961 | char name[32]; |
| 14962 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14963 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14964 | return 0; |
| 14965 | |
| 14966 | if (alc880_is_fixed_pin(pin)) { |
| 14967 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14968 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14969 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14970 | spec->multiout.hp_nid = nid_v; |
| 14971 | else |
| 14972 | spec->multiout.extra_out_nid[0] = nid_v; |
| 14973 | /* control HP volume/switch on the output mixer amp */ |
| 14974 | nid_v = alc861vd_idx_to_mixer_vol( |
| 14975 | alc880_fixed_pin_idx(pin)); |
| 14976 | nid_s = alc861vd_idx_to_mixer_switch( |
| 14977 | alc880_fixed_pin_idx(pin)); |
| 14978 | |
| 14979 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14980 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14981 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 14982 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14983 | return err; |
| 14984 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14985 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14986 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 14987 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14988 | return err; |
| 14989 | } else if (alc880_is_multi_pin(pin)) { |
| 14990 | /* set manual connection */ |
| 14991 | /* we have only a switch on HP-out PIN */ |
| 14992 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14993 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14994 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14995 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14996 | return err; |
| 14997 | } |
| 14998 | return 0; |
| 14999 | } |
| 15000 | |
| 15001 | /* parse the BIOS configuration and set up the alc_spec |
| 15002 | * return 1 if successful, 0 if the proper config is not found, |
| 15003 | * or a negative error code |
| 15004 | * Based on ALC880 version - had to change it to override |
| 15005 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15006 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15007 | { |
| 15008 | struct alc_spec *spec = codec->spec; |
| 15009 | int err; |
| 15010 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15011 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15012 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15013 | alc861vd_ignore); |
| 15014 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15015 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15016 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15017 | return 0; /* can't find valid BIOS pin config */ |
| 15018 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15019 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15020 | if (err < 0) |
| 15021 | return err; |
| 15022 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15023 | if (err < 0) |
| 15024 | return err; |
| 15025 | err = alc861vd_auto_create_extra_out(spec, |
| 15026 | spec->autocfg.speaker_pins[0], |
| 15027 | "Speaker"); |
| 15028 | if (err < 0) |
| 15029 | return err; |
| 15030 | err = alc861vd_auto_create_extra_out(spec, |
| 15031 | spec->autocfg.hp_pins[0], |
| 15032 | "Headphone"); |
| 15033 | if (err < 0) |
| 15034 | return err; |
| 15035 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15036 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15037 | return err; |
| 15038 | |
| 15039 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15040 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15041 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15042 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15043 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15044 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15045 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15046 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15047 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15048 | |
| 15049 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15050 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15051 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15052 | err = alc_auto_add_mic_boost(codec); |
| 15053 | if (err < 0) |
| 15054 | return err; |
| 15055 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15056 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15057 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15058 | return 1; |
| 15059 | } |
| 15060 | |
| 15061 | /* additional initialization for auto-configuration model */ |
| 15062 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15063 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15064 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15065 | alc861vd_auto_init_multi_out(codec); |
| 15066 | alc861vd_auto_init_hp_out(codec); |
| 15067 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15068 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15069 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15070 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15071 | } |
| 15072 | |
| 15073 | static int patch_alc861vd(struct hda_codec *codec) |
| 15074 | { |
| 15075 | struct alc_spec *spec; |
| 15076 | int err, board_config; |
| 15077 | |
| 15078 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15079 | if (spec == NULL) |
| 15080 | return -ENOMEM; |
| 15081 | |
| 15082 | codec->spec = spec; |
| 15083 | |
| 15084 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15085 | alc861vd_models, |
| 15086 | alc861vd_cfg_tbl); |
| 15087 | |
| 15088 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 15089 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 15090 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15091 | board_config = ALC861VD_AUTO; |
| 15092 | } |
| 15093 | |
| 15094 | if (board_config == ALC861VD_AUTO) { |
| 15095 | /* automatic parse from the BIOS config */ |
| 15096 | err = alc861vd_parse_auto_config(codec); |
| 15097 | if (err < 0) { |
| 15098 | alc_free(codec); |
| 15099 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15100 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15101 | printk(KERN_INFO |
| 15102 | "hda_codec: Cannot set up configuration " |
| 15103 | "from BIOS. Using base mode...\n"); |
| 15104 | board_config = ALC861VD_3ST; |
| 15105 | } |
| 15106 | } |
| 15107 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15108 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15109 | if (err < 0) { |
| 15110 | alc_free(codec); |
| 15111 | return err; |
| 15112 | } |
| 15113 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15114 | if (board_config != ALC861VD_AUTO) |
| 15115 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15116 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15117 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15118 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15119 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15120 | } |
| 15121 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15122 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15123 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15124 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15125 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15126 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15127 | |
| 15128 | spec->adc_nids = alc861vd_adc_nids; |
| 15129 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15130 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15131 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15132 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15133 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15134 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15135 | spec->vmaster_nid = 0x02; |
| 15136 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15137 | codec->patch_ops = alc_patch_ops; |
| 15138 | |
| 15139 | if (board_config == ALC861VD_AUTO) |
| 15140 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15141 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15142 | if (!spec->loopback.amplist) |
| 15143 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15144 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15145 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15146 | |
| 15147 | return 0; |
| 15148 | } |
| 15149 | |
| 15150 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15151 | * ALC662 support |
| 15152 | * |
| 15153 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15154 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15155 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15156 | * 6-channel independent captures. |
| 15157 | * |
| 15158 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15159 | * driver yet). |
| 15160 | */ |
| 15161 | #define ALC662_DIGOUT_NID 0x06 |
| 15162 | #define ALC662_DIGIN_NID 0x0a |
| 15163 | |
| 15164 | static hda_nid_t alc662_dac_nids[4] = { |
| 15165 | /* front, rear, clfe, rear_surr */ |
| 15166 | 0x02, 0x03, 0x04 |
| 15167 | }; |
| 15168 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15169 | static hda_nid_t alc272_dac_nids[2] = { |
| 15170 | 0x02, 0x03 |
| 15171 | }; |
| 15172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15173 | static hda_nid_t alc662_adc_nids[1] = { |
| 15174 | /* ADC1-2 */ |
| 15175 | 0x09, |
| 15176 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15177 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15178 | static hda_nid_t alc272_adc_nids[1] = { |
| 15179 | /* ADC1-2 */ |
| 15180 | 0x08, |
| 15181 | }; |
| 15182 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15183 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15184 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15185 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15186 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15187 | /* input MUX */ |
| 15188 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15189 | static struct hda_input_mux alc662_capture_source = { |
| 15190 | .num_items = 4, |
| 15191 | .items = { |
| 15192 | { "Mic", 0x0 }, |
| 15193 | { "Front Mic", 0x1 }, |
| 15194 | { "Line", 0x2 }, |
| 15195 | { "CD", 0x4 }, |
| 15196 | }, |
| 15197 | }; |
| 15198 | |
| 15199 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15200 | .num_items = 2, |
| 15201 | .items = { |
| 15202 | { "Mic", 0x1 }, |
| 15203 | { "Line", 0x2 }, |
| 15204 | }, |
| 15205 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15206 | |
| 15207 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15208 | .num_items = 2, |
| 15209 | .items = { |
| 15210 | { "i-Mic", 0x1 }, |
| 15211 | { "e-Mic", 0x0 }, |
| 15212 | }, |
| 15213 | }; |
| 15214 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15215 | static struct hda_input_mux alc663_capture_source = { |
| 15216 | .num_items = 3, |
| 15217 | .items = { |
| 15218 | { "Mic", 0x0 }, |
| 15219 | { "Front Mic", 0x1 }, |
| 15220 | { "Line", 0x2 }, |
| 15221 | }, |
| 15222 | }; |
| 15223 | |
| 15224 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15225 | .num_items = 2, |
| 15226 | .items = { |
| 15227 | { "Ext-Mic", 0x0 }, |
| 15228 | { "D-Mic", 0x9 }, |
| 15229 | }, |
| 15230 | }; |
| 15231 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15232 | #if 1 /* set to 0 for testing other input sources below */ |
| 15233 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15234 | .num_items = 2, |
| 15235 | .items = { |
| 15236 | { "Autoselect Mic", 0x0 }, |
| 15237 | { "Internal Mic", 0x1 }, |
| 15238 | }, |
| 15239 | }; |
| 15240 | #else |
| 15241 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15242 | .num_items = 16, |
| 15243 | .items = { |
| 15244 | { "Autoselect Mic", 0x0 }, |
| 15245 | { "Internal Mic", 0x1 }, |
| 15246 | { "In-0x02", 0x2 }, |
| 15247 | { "In-0x03", 0x3 }, |
| 15248 | { "In-0x04", 0x4 }, |
| 15249 | { "In-0x05", 0x5 }, |
| 15250 | { "In-0x06", 0x6 }, |
| 15251 | { "In-0x07", 0x7 }, |
| 15252 | { "In-0x08", 0x8 }, |
| 15253 | { "In-0x09", 0x9 }, |
| 15254 | { "In-0x0a", 0x0a }, |
| 15255 | { "In-0x0b", 0x0b }, |
| 15256 | { "In-0x0c", 0x0c }, |
| 15257 | { "In-0x0d", 0x0d }, |
| 15258 | { "In-0x0e", 0x0e }, |
| 15259 | { "In-0x0f", 0x0f }, |
| 15260 | }, |
| 15261 | }; |
| 15262 | #endif |
| 15263 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15264 | /* |
| 15265 | * 2ch mode |
| 15266 | */ |
| 15267 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15268 | { 2, NULL } |
| 15269 | }; |
| 15270 | |
| 15271 | /* |
| 15272 | * 2ch mode |
| 15273 | */ |
| 15274 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15275 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15276 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15277 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15278 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15279 | { } /* end */ |
| 15280 | }; |
| 15281 | |
| 15282 | /* |
| 15283 | * 6ch mode |
| 15284 | */ |
| 15285 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15286 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15287 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15288 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15289 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15290 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15291 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15292 | { } /* end */ |
| 15293 | }; |
| 15294 | |
| 15295 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15296 | { 2, alc662_3ST_ch2_init }, |
| 15297 | { 6, alc662_3ST_ch6_init }, |
| 15298 | }; |
| 15299 | |
| 15300 | /* |
| 15301 | * 2ch mode |
| 15302 | */ |
| 15303 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15304 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15305 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15306 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15307 | { } /* end */ |
| 15308 | }; |
| 15309 | |
| 15310 | /* |
| 15311 | * 6ch mode |
| 15312 | */ |
| 15313 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15314 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15315 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15316 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15317 | { } /* end */ |
| 15318 | }; |
| 15319 | |
| 15320 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15321 | { 2, alc662_sixstack_ch6_init }, |
| 15322 | { 6, alc662_sixstack_ch8_init }, |
| 15323 | }; |
| 15324 | |
| 15325 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15326 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15327 | */ |
| 15328 | |
| 15329 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15330 | /* output mixer control */ |
| 15331 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15332 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15333 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15334 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15335 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15336 | 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] | 15337 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15338 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15339 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15340 | |
| 15341 | /*Input mixer control */ |
| 15342 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15343 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15344 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15345 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15346 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15347 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15348 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15349 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15350 | { } /* end */ |
| 15351 | }; |
| 15352 | |
| 15353 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15354 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15355 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15356 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15357 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15358 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15359 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15360 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15361 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15362 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15363 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15364 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15365 | { } /* end */ |
| 15366 | }; |
| 15367 | |
| 15368 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15369 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15370 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15371 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15372 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15373 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15374 | 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] | 15375 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15376 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15377 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15378 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15379 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15380 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15381 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15382 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15383 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15384 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15385 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15386 | { } /* end */ |
| 15387 | }; |
| 15388 | |
| 15389 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15390 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15391 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15392 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15393 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15395 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15396 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15397 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15398 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15399 | { } /* end */ |
| 15400 | }; |
| 15401 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15402 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15403 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15404 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15405 | |
| 15406 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15407 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15408 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15409 | |
| 15410 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15411 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15412 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15413 | { } /* end */ |
| 15414 | }; |
| 15415 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15416 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15417 | ALC262_HIPPO_MASTER_SWITCH, |
| 15418 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15419 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15420 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15421 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15422 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15423 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15424 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15425 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15426 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15427 | { } /* end */ |
| 15428 | }; |
| 15429 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15430 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15431 | .ops = &snd_hda_bind_vol, |
| 15432 | .values = { |
| 15433 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15434 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15435 | 0 |
| 15436 | }, |
| 15437 | }; |
| 15438 | |
| 15439 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15440 | .ops = &snd_hda_bind_sw, |
| 15441 | .values = { |
| 15442 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15443 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15444 | 0 |
| 15445 | }, |
| 15446 | }; |
| 15447 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15448 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15449 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15450 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15451 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15452 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15453 | { } /* end */ |
| 15454 | }; |
| 15455 | |
| 15456 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15457 | .ops = &snd_hda_bind_sw, |
| 15458 | .values = { |
| 15459 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15460 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15461 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15462 | 0 |
| 15463 | }, |
| 15464 | }; |
| 15465 | |
| 15466 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15467 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15468 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15469 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15470 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15471 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15472 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15473 | |
| 15474 | { } /* end */ |
| 15475 | }; |
| 15476 | |
| 15477 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15478 | .ops = &snd_hda_bind_sw, |
| 15479 | .values = { |
| 15480 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15481 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15482 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15483 | 0 |
| 15484 | }, |
| 15485 | }; |
| 15486 | |
| 15487 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15488 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15489 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15490 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15491 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15492 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15493 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15494 | { } /* end */ |
| 15495 | }; |
| 15496 | |
| 15497 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15498 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15499 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15500 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15503 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15504 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15505 | { } /* end */ |
| 15506 | }; |
| 15507 | |
| 15508 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15509 | .ops = &snd_hda_bind_vol, |
| 15510 | .values = { |
| 15511 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15512 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15513 | 0 |
| 15514 | }, |
| 15515 | }; |
| 15516 | |
| 15517 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15518 | .ops = &snd_hda_bind_sw, |
| 15519 | .values = { |
| 15520 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15521 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15522 | 0 |
| 15523 | }, |
| 15524 | }; |
| 15525 | |
| 15526 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15527 | HDA_BIND_VOL("Master Playback Volume", |
| 15528 | &alc663_asus_two_bind_master_vol), |
| 15529 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15530 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15531 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15532 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15533 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15534 | { } /* end */ |
| 15535 | }; |
| 15536 | |
| 15537 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15538 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15539 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15540 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15541 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15542 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15543 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15544 | { } /* end */ |
| 15545 | }; |
| 15546 | |
| 15547 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15548 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15549 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15550 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15551 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15552 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15553 | |
| 15554 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15555 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15556 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15557 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15558 | { } /* end */ |
| 15559 | }; |
| 15560 | |
| 15561 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15562 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15563 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15564 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15565 | |
| 15566 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15567 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15568 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15569 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15570 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15571 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15572 | { } /* end */ |
| 15573 | }; |
| 15574 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15575 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15576 | { |
| 15577 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15578 | .name = "Channel Mode", |
| 15579 | .info = alc_ch_mode_info, |
| 15580 | .get = alc_ch_mode_get, |
| 15581 | .put = alc_ch_mode_put, |
| 15582 | }, |
| 15583 | { } /* end */ |
| 15584 | }; |
| 15585 | |
| 15586 | static struct hda_verb alc662_init_verbs[] = { |
| 15587 | /* ADC: mute amp left and right */ |
| 15588 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15589 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15590 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15591 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15593 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15594 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15595 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15596 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15597 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15599 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15600 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15601 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15603 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15604 | |
| 15605 | /* Front Pin: output 0 (0x0c) */ |
| 15606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15608 | |
| 15609 | /* Rear Pin: output 1 (0x0d) */ |
| 15610 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15611 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15612 | |
| 15613 | /* CLFE Pin: output 2 (0x0e) */ |
| 15614 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15615 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15616 | |
| 15617 | /* Mic (rear) pin: input vref at 80% */ |
| 15618 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15619 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15620 | /* Front Mic pin: input vref at 80% */ |
| 15621 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15622 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15623 | /* Line In pin: input */ |
| 15624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15625 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15626 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15628 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15629 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15630 | /* CD pin widget for input */ |
| 15631 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15632 | |
| 15633 | /* FIXME: use matrix-type input source selection */ |
| 15634 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15635 | /* Input mixer */ |
| 15636 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15637 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15638 | |
| 15639 | /* always trun on EAPD */ |
| 15640 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15641 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15642 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15643 | { } |
| 15644 | }; |
| 15645 | |
| 15646 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15647 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15648 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15649 | {} |
| 15650 | }; |
| 15651 | |
| 15652 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15653 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15654 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15655 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15656 | }; |
| 15657 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15658 | /* Set Unsolicited Event*/ |
| 15659 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15660 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15661 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15662 | {} |
| 15663 | }; |
| 15664 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15665 | /* |
| 15666 | * generic initialization of ADC, input mixers and output mixers |
| 15667 | */ |
| 15668 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15669 | /* |
| 15670 | * Unmute ADC and set the default input to mic-in |
| 15671 | */ |
| 15672 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15673 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15674 | |
| 15675 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15676 | * mixer widget |
| 15677 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15678 | * panel mic (mic 2) |
| 15679 | */ |
| 15680 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15681 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15682 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15683 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15684 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15685 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15686 | |
| 15687 | /* |
| 15688 | * Set up output mixers (0x0c - 0x0f) |
| 15689 | */ |
| 15690 | /* set vol=0 to output mixers */ |
| 15691 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15692 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15693 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15694 | |
| 15695 | /* set up input amps for analog loopback */ |
| 15696 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15698 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15700 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15701 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15702 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15703 | |
| 15704 | |
| 15705 | /* FIXME: use matrix-type input source selection */ |
| 15706 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15707 | /* Input mixer */ |
| 15708 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15710 | { } |
| 15711 | }; |
| 15712 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15713 | /* additional verbs for ALC663 */ |
| 15714 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 15715 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15716 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15717 | { } |
| 15718 | }; |
| 15719 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15720 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15721 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15722 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15723 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15724 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15725 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15726 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15727 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15728 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15729 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15730 | {} |
| 15731 | }; |
| 15732 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15733 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 15734 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15735 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15736 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15737 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15738 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15739 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15740 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15741 | {} |
| 15742 | }; |
| 15743 | |
| 15744 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 15745 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15746 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15747 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15748 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15749 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15750 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15751 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15752 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15753 | {} |
| 15754 | }; |
| 15755 | |
| 15756 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 15757 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15758 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15759 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15762 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15763 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15764 | {} |
| 15765 | }; |
| 15766 | |
| 15767 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 15768 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15769 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15770 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15771 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15772 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15774 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 15775 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15777 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15778 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15779 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15780 | {} |
| 15781 | }; |
| 15782 | |
| 15783 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 15784 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15785 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15786 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15787 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15789 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15790 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15791 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15792 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15793 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15794 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15795 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15796 | {} |
| 15797 | }; |
| 15798 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15799 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 15800 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15801 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 15802 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 15803 | |
| 15804 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15805 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15806 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15807 | |
| 15808 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15809 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 15810 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 15811 | {} |
| 15812 | }; |
| 15813 | |
| 15814 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 15815 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15816 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15817 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 15818 | |
| 15819 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15820 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15821 | {} |
| 15822 | }; |
| 15823 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15824 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 15825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 15826 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15827 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15828 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15829 | {} |
| 15830 | }; |
| 15831 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15832 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 15833 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15834 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15835 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15836 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15837 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15838 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15839 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15840 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15841 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15842 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15843 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15844 | {} |
| 15845 | }; |
| 15846 | |
| 15847 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 15848 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15849 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15850 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15851 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15852 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15853 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15854 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 15855 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15856 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 15857 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15858 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15859 | {} |
| 15860 | }; |
| 15861 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15862 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 15863 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 15864 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 15865 | { } /* end */ |
| 15866 | }; |
| 15867 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15868 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 15869 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 15870 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 15871 | { } /* end */ |
| 15872 | }; |
| 15873 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15874 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 15875 | { |
| 15876 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15877 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15878 | |
| 15879 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 15880 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15881 | bits = present ? HDA_AMP_MUTE : 0; |
| 15882 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15883 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15884 | } |
| 15885 | |
| 15886 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 15887 | { |
| 15888 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15889 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15890 | |
| 15891 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 15892 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15893 | bits = present ? HDA_AMP_MUTE : 0; |
| 15894 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 15895 | HDA_AMP_MUTE, bits); |
| 15896 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 15897 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15898 | } |
| 15899 | |
| 15900 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 15901 | unsigned int res) |
| 15902 | { |
| 15903 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15904 | alc662_lenovo_101e_all_automute(codec); |
| 15905 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 15906 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 15907 | } |
| 15908 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15909 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 15910 | { |
| 15911 | unsigned int present; |
| 15912 | |
| 15913 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15914 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 15915 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15916 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15917 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15918 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 15919 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15920 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15921 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15922 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 15923 | } |
| 15924 | |
| 15925 | /* unsolicited event for HP jack sensing */ |
| 15926 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 15927 | unsigned int res) |
| 15928 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15929 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 15930 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15931 | else |
| 15932 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15933 | } |
| 15934 | |
| 15935 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 15936 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15937 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15938 | alc662_eeepc_mic_automute(codec); |
| 15939 | } |
| 15940 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15941 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 15942 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15943 | struct alc_spec *spec = codec->spec; |
| 15944 | |
| 15945 | spec->autocfg.hp_pins[0] = 0x14; |
| 15946 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 15947 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15948 | } |
| 15949 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15950 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 15951 | { |
| 15952 | unsigned int present; |
| 15953 | unsigned char bits; |
| 15954 | |
| 15955 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15956 | AC_VERB_GET_PIN_SENSE, 0) |
| 15957 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15958 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15959 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15960 | AMP_IN_MUTE(0), bits); |
| 15961 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15962 | AMP_IN_MUTE(0), bits); |
| 15963 | } |
| 15964 | |
| 15965 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 15966 | { |
| 15967 | unsigned int present; |
| 15968 | unsigned char bits; |
| 15969 | |
| 15970 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 15971 | AC_VERB_GET_PIN_SENSE, 0) |
| 15972 | & AC_PINSENSE_PRESENCE; |
| 15973 | bits = present ? HDA_AMP_MUTE : 0; |
| 15974 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15975 | AMP_IN_MUTE(0), bits); |
| 15976 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15977 | AMP_IN_MUTE(0), bits); |
| 15978 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15979 | AMP_IN_MUTE(0), bits); |
| 15980 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 15981 | AMP_IN_MUTE(0), bits); |
| 15982 | } |
| 15983 | |
| 15984 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 15985 | { |
| 15986 | unsigned int present; |
| 15987 | unsigned char bits; |
| 15988 | |
| 15989 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 15990 | AC_VERB_GET_PIN_SENSE, 0) |
| 15991 | & AC_PINSENSE_PRESENCE; |
| 15992 | bits = present ? HDA_AMP_MUTE : 0; |
| 15993 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 15994 | AMP_IN_MUTE(0), bits); |
| 15995 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 15996 | AMP_IN_MUTE(0), bits); |
| 15997 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 15998 | AMP_IN_MUTE(0), bits); |
| 15999 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16000 | AMP_IN_MUTE(0), bits); |
| 16001 | } |
| 16002 | |
| 16003 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16004 | { |
| 16005 | unsigned int present; |
| 16006 | unsigned char bits; |
| 16007 | |
| 16008 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16009 | AC_VERB_GET_PIN_SENSE, 0) |
| 16010 | & AC_PINSENSE_PRESENCE; |
| 16011 | bits = present ? 0 : PIN_OUT; |
| 16012 | snd_hda_codec_write(codec, 0x14, 0, |
| 16013 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16014 | } |
| 16015 | |
| 16016 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16017 | { |
| 16018 | unsigned int present1, present2; |
| 16019 | |
| 16020 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16021 | AC_VERB_GET_PIN_SENSE, 0) |
| 16022 | & AC_PINSENSE_PRESENCE; |
| 16023 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16024 | AC_VERB_GET_PIN_SENSE, 0) |
| 16025 | & AC_PINSENSE_PRESENCE; |
| 16026 | |
| 16027 | if (present1 || present2) { |
| 16028 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16029 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16030 | } else { |
| 16031 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16032 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16033 | } |
| 16034 | } |
| 16035 | |
| 16036 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16037 | { |
| 16038 | unsigned int present1, present2; |
| 16039 | |
| 16040 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16041 | AC_VERB_GET_PIN_SENSE, 0) |
| 16042 | & AC_PINSENSE_PRESENCE; |
| 16043 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16044 | AC_VERB_GET_PIN_SENSE, 0) |
| 16045 | & AC_PINSENSE_PRESENCE; |
| 16046 | |
| 16047 | if (present1 || present2) { |
| 16048 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16049 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16050 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16051 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16052 | } else { |
| 16053 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16054 | AMP_IN_MUTE(0), 0); |
| 16055 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16056 | AMP_IN_MUTE(0), 0); |
| 16057 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16058 | } |
| 16059 | |
| 16060 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16061 | { |
| 16062 | unsigned int present; |
| 16063 | |
| 16064 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16065 | AC_VERB_GET_PIN_SENSE, 0) |
| 16066 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16067 | 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] | 16068 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16069 | 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] | 16070 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16071 | 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] | 16072 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16073 | 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] | 16074 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16075 | } |
| 16076 | |
| 16077 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16078 | unsigned int res) |
| 16079 | { |
| 16080 | switch (res >> 26) { |
| 16081 | case ALC880_HP_EVENT: |
| 16082 | alc663_m51va_speaker_automute(codec); |
| 16083 | break; |
| 16084 | case ALC880_MIC_EVENT: |
| 16085 | alc663_m51va_mic_automute(codec); |
| 16086 | break; |
| 16087 | } |
| 16088 | } |
| 16089 | |
| 16090 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16091 | { |
| 16092 | alc663_m51va_speaker_automute(codec); |
| 16093 | alc663_m51va_mic_automute(codec); |
| 16094 | } |
| 16095 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16096 | /* ***************** Mode1 ******************************/ |
| 16097 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16098 | unsigned int res) |
| 16099 | { |
| 16100 | switch (res >> 26) { |
| 16101 | case ALC880_HP_EVENT: |
| 16102 | alc663_m51va_speaker_automute(codec); |
| 16103 | break; |
| 16104 | case ALC880_MIC_EVENT: |
| 16105 | alc662_eeepc_mic_automute(codec); |
| 16106 | break; |
| 16107 | } |
| 16108 | } |
| 16109 | |
| 16110 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16111 | { |
| 16112 | alc663_m51va_speaker_automute(codec); |
| 16113 | alc662_eeepc_mic_automute(codec); |
| 16114 | } |
| 16115 | /* ***************** Mode2 ******************************/ |
| 16116 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16117 | unsigned int res) |
| 16118 | { |
| 16119 | switch (res >> 26) { |
| 16120 | case ALC880_HP_EVENT: |
| 16121 | alc662_f5z_speaker_automute(codec); |
| 16122 | break; |
| 16123 | case ALC880_MIC_EVENT: |
| 16124 | alc662_eeepc_mic_automute(codec); |
| 16125 | break; |
| 16126 | } |
| 16127 | } |
| 16128 | |
| 16129 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16130 | { |
| 16131 | alc662_f5z_speaker_automute(codec); |
| 16132 | alc662_eeepc_mic_automute(codec); |
| 16133 | } |
| 16134 | /* ***************** Mode3 ******************************/ |
| 16135 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16136 | unsigned int res) |
| 16137 | { |
| 16138 | switch (res >> 26) { |
| 16139 | case ALC880_HP_EVENT: |
| 16140 | alc663_two_hp_m1_speaker_automute(codec); |
| 16141 | break; |
| 16142 | case ALC880_MIC_EVENT: |
| 16143 | alc662_eeepc_mic_automute(codec); |
| 16144 | break; |
| 16145 | } |
| 16146 | } |
| 16147 | |
| 16148 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16149 | { |
| 16150 | alc663_two_hp_m1_speaker_automute(codec); |
| 16151 | alc662_eeepc_mic_automute(codec); |
| 16152 | } |
| 16153 | /* ***************** Mode4 ******************************/ |
| 16154 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16155 | unsigned int res) |
| 16156 | { |
| 16157 | switch (res >> 26) { |
| 16158 | case ALC880_HP_EVENT: |
| 16159 | alc663_21jd_two_speaker_automute(codec); |
| 16160 | break; |
| 16161 | case ALC880_MIC_EVENT: |
| 16162 | alc662_eeepc_mic_automute(codec); |
| 16163 | break; |
| 16164 | } |
| 16165 | } |
| 16166 | |
| 16167 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16168 | { |
| 16169 | alc663_21jd_two_speaker_automute(codec); |
| 16170 | alc662_eeepc_mic_automute(codec); |
| 16171 | } |
| 16172 | /* ***************** Mode5 ******************************/ |
| 16173 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16174 | unsigned int res) |
| 16175 | { |
| 16176 | switch (res >> 26) { |
| 16177 | case ALC880_HP_EVENT: |
| 16178 | alc663_15jd_two_speaker_automute(codec); |
| 16179 | break; |
| 16180 | case ALC880_MIC_EVENT: |
| 16181 | alc662_eeepc_mic_automute(codec); |
| 16182 | break; |
| 16183 | } |
| 16184 | } |
| 16185 | |
| 16186 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16187 | { |
| 16188 | alc663_15jd_two_speaker_automute(codec); |
| 16189 | alc662_eeepc_mic_automute(codec); |
| 16190 | } |
| 16191 | /* ***************** Mode6 ******************************/ |
| 16192 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16193 | unsigned int res) |
| 16194 | { |
| 16195 | switch (res >> 26) { |
| 16196 | case ALC880_HP_EVENT: |
| 16197 | alc663_two_hp_m2_speaker_automute(codec); |
| 16198 | break; |
| 16199 | case ALC880_MIC_EVENT: |
| 16200 | alc662_eeepc_mic_automute(codec); |
| 16201 | break; |
| 16202 | } |
| 16203 | } |
| 16204 | |
| 16205 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16206 | { |
| 16207 | alc663_two_hp_m2_speaker_automute(codec); |
| 16208 | alc662_eeepc_mic_automute(codec); |
| 16209 | } |
| 16210 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16211 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16212 | { |
| 16213 | unsigned int present; |
| 16214 | unsigned char bits; |
| 16215 | |
| 16216 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16217 | AC_VERB_GET_PIN_SENSE, 0) |
| 16218 | & AC_PINSENSE_PRESENCE; |
| 16219 | bits = present ? HDA_AMP_MUTE : 0; |
| 16220 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16221 | HDA_AMP_MUTE, bits); |
| 16222 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16223 | HDA_AMP_MUTE, bits); |
| 16224 | } |
| 16225 | |
| 16226 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16227 | { |
| 16228 | unsigned int present; |
| 16229 | unsigned char bits; |
| 16230 | |
| 16231 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16232 | AC_VERB_GET_PIN_SENSE, 0) |
| 16233 | & AC_PINSENSE_PRESENCE; |
| 16234 | bits = present ? HDA_AMP_MUTE : 0; |
| 16235 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16236 | HDA_AMP_MUTE, bits); |
| 16237 | } |
| 16238 | |
| 16239 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16240 | unsigned int res) |
| 16241 | { |
| 16242 | switch (res >> 26) { |
| 16243 | case ALC880_HP_EVENT: |
| 16244 | alc663_g71v_hp_automute(codec); |
| 16245 | break; |
| 16246 | case ALC880_FRONT_EVENT: |
| 16247 | alc663_g71v_front_automute(codec); |
| 16248 | break; |
| 16249 | case ALC880_MIC_EVENT: |
| 16250 | alc662_eeepc_mic_automute(codec); |
| 16251 | break; |
| 16252 | } |
| 16253 | } |
| 16254 | |
| 16255 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16256 | { |
| 16257 | alc663_g71v_front_automute(codec); |
| 16258 | alc663_g71v_hp_automute(codec); |
| 16259 | alc662_eeepc_mic_automute(codec); |
| 16260 | } |
| 16261 | |
| 16262 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16263 | unsigned int res) |
| 16264 | { |
| 16265 | switch (res >> 26) { |
| 16266 | case ALC880_HP_EVENT: |
| 16267 | alc663_m51va_speaker_automute(codec); |
| 16268 | break; |
| 16269 | case ALC880_MIC_EVENT: |
| 16270 | alc662_eeepc_mic_automute(codec); |
| 16271 | break; |
| 16272 | } |
| 16273 | } |
| 16274 | |
| 16275 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16276 | { |
| 16277 | alc663_m51va_speaker_automute(codec); |
| 16278 | alc662_eeepc_mic_automute(codec); |
| 16279 | } |
| 16280 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16281 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16282 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16283 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16284 | |
| 16285 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16286 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16287 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16288 | |
| 16289 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16290 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16291 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16292 | { } /* end */ |
| 16293 | }; |
| 16294 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16295 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16296 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16297 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16298 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16299 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16300 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16301 | |
| 16302 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16303 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16304 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16305 | |
| 16306 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16307 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16308 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16309 | { } /* end */ |
| 16310 | }; |
| 16311 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16312 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16313 | #define alc662_loopbacks alc880_loopbacks |
| 16314 | #endif |
| 16315 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16316 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16317 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16318 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16319 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16320 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16321 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16322 | |
| 16323 | /* |
| 16324 | * configuration and preset |
| 16325 | */ |
| 16326 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16327 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16328 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16329 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16330 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16331 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16332 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16333 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16334 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16335 | [ALC663_ASUS_M51VA] = "m51va", |
| 16336 | [ALC663_ASUS_G71V] = "g71v", |
| 16337 | [ALC663_ASUS_H13] = "h13", |
| 16338 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16339 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16340 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16341 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16342 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16343 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16344 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16345 | [ALC272_DELL] = "dell", |
| 16346 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16347 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16348 | [ALC662_AUTO] = "auto", |
| 16349 | }; |
| 16350 | |
| 16351 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16352 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16353 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16354 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16355 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16356 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16357 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16358 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16359 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16360 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16361 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16362 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16363 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16364 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16365 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16366 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16367 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16368 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16369 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16370 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16371 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16372 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16373 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16374 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16375 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16376 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16377 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16378 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16379 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16380 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16381 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16382 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16383 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16384 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16385 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16386 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16387 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16388 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16389 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16390 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16391 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16392 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16393 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16394 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16395 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16396 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16397 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16398 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16399 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16400 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16401 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16402 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16403 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16404 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16405 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16406 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16407 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16408 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16409 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16410 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16411 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16412 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16413 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16414 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16415 | {} |
| 16416 | }; |
| 16417 | |
| 16418 | static struct alc_config_preset alc662_presets[] = { |
| 16419 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16420 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16421 | .init_verbs = { alc662_init_verbs }, |
| 16422 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16423 | .dac_nids = alc662_dac_nids, |
| 16424 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16425 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16426 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16427 | .channel_mode = alc662_3ST_2ch_modes, |
| 16428 | .input_mux = &alc662_capture_source, |
| 16429 | }, |
| 16430 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16431 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16432 | .init_verbs = { alc662_init_verbs }, |
| 16433 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16434 | .dac_nids = alc662_dac_nids, |
| 16435 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16436 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16437 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16438 | .channel_mode = alc662_3ST_6ch_modes, |
| 16439 | .need_dac_fix = 1, |
| 16440 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16441 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16442 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16443 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16444 | .init_verbs = { alc662_init_verbs }, |
| 16445 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16446 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16447 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16448 | .channel_mode = alc662_3ST_6ch_modes, |
| 16449 | .need_dac_fix = 1, |
| 16450 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16451 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16452 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16453 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16454 | .init_verbs = { alc662_init_verbs }, |
| 16455 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16456 | .dac_nids = alc662_dac_nids, |
| 16457 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16458 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16459 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16460 | .channel_mode = alc662_5stack_modes, |
| 16461 | .input_mux = &alc662_capture_source, |
| 16462 | }, |
| 16463 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16464 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16465 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16466 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16467 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16468 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16469 | .channel_mode = alc662_3ST_2ch_modes, |
| 16470 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16471 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16472 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16473 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16474 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16475 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16476 | .init_verbs = { alc662_init_verbs, |
| 16477 | alc662_eeepc_sue_init_verbs }, |
| 16478 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16479 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16480 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16481 | .channel_mode = alc662_3ST_2ch_modes, |
| 16482 | .input_mux = &alc662_eeepc_capture_source, |
| 16483 | .unsol_event = alc662_eeepc_unsol_event, |
| 16484 | .init_hook = alc662_eeepc_inithook, |
| 16485 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16486 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16487 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16488 | alc662_chmode_mixer }, |
| 16489 | .init_verbs = { alc662_init_verbs, |
| 16490 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16491 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16492 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16493 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16494 | .channel_mode = alc662_3ST_6ch_modes, |
| 16495 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16496 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16497 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16498 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16499 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16500 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16501 | .init_verbs = { alc662_init_verbs, |
| 16502 | alc662_ecs_init_verbs }, |
| 16503 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16504 | .dac_nids = alc662_dac_nids, |
| 16505 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16506 | .channel_mode = alc662_3ST_2ch_modes, |
| 16507 | .input_mux = &alc662_eeepc_capture_source, |
| 16508 | .unsol_event = alc662_eeepc_unsol_event, |
| 16509 | .init_hook = alc662_eeepc_inithook, |
| 16510 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16511 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16512 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16513 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16514 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16515 | .dac_nids = alc662_dac_nids, |
| 16516 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16517 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16518 | .channel_mode = alc662_3ST_2ch_modes, |
| 16519 | .input_mux = &alc663_m51va_capture_source, |
| 16520 | .unsol_event = alc663_m51va_unsol_event, |
| 16521 | .init_hook = alc663_m51va_inithook, |
| 16522 | }, |
| 16523 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16524 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16525 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16526 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16527 | .dac_nids = alc662_dac_nids, |
| 16528 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16529 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16530 | .channel_mode = alc662_3ST_2ch_modes, |
| 16531 | .input_mux = &alc662_eeepc_capture_source, |
| 16532 | .unsol_event = alc663_g71v_unsol_event, |
| 16533 | .init_hook = alc663_g71v_inithook, |
| 16534 | }, |
| 16535 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16536 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16537 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16538 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16539 | .dac_nids = alc662_dac_nids, |
| 16540 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16541 | .channel_mode = alc662_3ST_2ch_modes, |
| 16542 | .input_mux = &alc663_m51va_capture_source, |
| 16543 | .unsol_event = alc663_m51va_unsol_event, |
| 16544 | .init_hook = alc663_m51va_inithook, |
| 16545 | }, |
| 16546 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16547 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16548 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16549 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16550 | .dac_nids = alc662_dac_nids, |
| 16551 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16552 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16553 | .channel_mode = alc662_3ST_6ch_modes, |
| 16554 | .input_mux = &alc663_capture_source, |
| 16555 | .unsol_event = alc663_g50v_unsol_event, |
| 16556 | .init_hook = alc663_g50v_inithook, |
| 16557 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16558 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16559 | .mixers = { alc663_m51va_mixer }, |
| 16560 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16561 | .init_verbs = { alc662_init_verbs, |
| 16562 | alc663_21jd_amic_init_verbs }, |
| 16563 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16564 | .hp_nid = 0x03, |
| 16565 | .dac_nids = alc662_dac_nids, |
| 16566 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16567 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16568 | .channel_mode = alc662_3ST_2ch_modes, |
| 16569 | .input_mux = &alc662_eeepc_capture_source, |
| 16570 | .unsol_event = alc663_mode1_unsol_event, |
| 16571 | .init_hook = alc663_mode1_inithook, |
| 16572 | }, |
| 16573 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16574 | .mixers = { alc662_1bjd_mixer }, |
| 16575 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16576 | .init_verbs = { alc662_init_verbs, |
| 16577 | alc662_1bjd_amic_init_verbs }, |
| 16578 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16579 | .dac_nids = alc662_dac_nids, |
| 16580 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16581 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16582 | .channel_mode = alc662_3ST_2ch_modes, |
| 16583 | .input_mux = &alc662_eeepc_capture_source, |
| 16584 | .unsol_event = alc662_mode2_unsol_event, |
| 16585 | .init_hook = alc662_mode2_inithook, |
| 16586 | }, |
| 16587 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16588 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16589 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16590 | .init_verbs = { alc662_init_verbs, |
| 16591 | alc663_two_hp_amic_m1_init_verbs }, |
| 16592 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16593 | .hp_nid = 0x03, |
| 16594 | .dac_nids = alc662_dac_nids, |
| 16595 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16596 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16597 | .channel_mode = alc662_3ST_2ch_modes, |
| 16598 | .input_mux = &alc662_eeepc_capture_source, |
| 16599 | .unsol_event = alc663_mode3_unsol_event, |
| 16600 | .init_hook = alc663_mode3_inithook, |
| 16601 | }, |
| 16602 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16603 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16604 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16605 | .init_verbs = { alc662_init_verbs, |
| 16606 | alc663_21jd_amic_init_verbs}, |
| 16607 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16608 | .hp_nid = 0x03, |
| 16609 | .dac_nids = alc662_dac_nids, |
| 16610 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16611 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16612 | .channel_mode = alc662_3ST_2ch_modes, |
| 16613 | .input_mux = &alc662_eeepc_capture_source, |
| 16614 | .unsol_event = alc663_mode4_unsol_event, |
| 16615 | .init_hook = alc663_mode4_inithook, |
| 16616 | }, |
| 16617 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16618 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16619 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16620 | .init_verbs = { alc662_init_verbs, |
| 16621 | alc663_15jd_amic_init_verbs }, |
| 16622 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16623 | .hp_nid = 0x03, |
| 16624 | .dac_nids = alc662_dac_nids, |
| 16625 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16626 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16627 | .channel_mode = alc662_3ST_2ch_modes, |
| 16628 | .input_mux = &alc662_eeepc_capture_source, |
| 16629 | .unsol_event = alc663_mode5_unsol_event, |
| 16630 | .init_hook = alc663_mode5_inithook, |
| 16631 | }, |
| 16632 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16633 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16634 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16635 | .init_verbs = { alc662_init_verbs, |
| 16636 | alc663_two_hp_amic_m2_init_verbs }, |
| 16637 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16638 | .hp_nid = 0x03, |
| 16639 | .dac_nids = alc662_dac_nids, |
| 16640 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16641 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16642 | .channel_mode = alc662_3ST_2ch_modes, |
| 16643 | .input_mux = &alc662_eeepc_capture_source, |
| 16644 | .unsol_event = alc663_mode6_unsol_event, |
| 16645 | .init_hook = alc663_mode6_inithook, |
| 16646 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16647 | [ALC272_DELL] = { |
| 16648 | .mixers = { alc663_m51va_mixer }, |
| 16649 | .cap_mixer = alc272_auto_capture_mixer, |
| 16650 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16651 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16652 | .dac_nids = alc662_dac_nids, |
| 16653 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16654 | .adc_nids = alc272_adc_nids, |
| 16655 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16656 | .capsrc_nids = alc272_capsrc_nids, |
| 16657 | .channel_mode = alc662_3ST_2ch_modes, |
| 16658 | .input_mux = &alc663_m51va_capture_source, |
| 16659 | .unsol_event = alc663_m51va_unsol_event, |
| 16660 | .init_hook = alc663_m51va_inithook, |
| 16661 | }, |
| 16662 | [ALC272_DELL_ZM1] = { |
| 16663 | .mixers = { alc663_m51va_mixer }, |
| 16664 | .cap_mixer = alc662_auto_capture_mixer, |
| 16665 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16666 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16667 | .dac_nids = alc662_dac_nids, |
| 16668 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16669 | .adc_nids = alc662_adc_nids, |
| 16670 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16671 | .capsrc_nids = alc662_capsrc_nids, |
| 16672 | .channel_mode = alc662_3ST_2ch_modes, |
| 16673 | .input_mux = &alc663_m51va_capture_source, |
| 16674 | .unsol_event = alc663_m51va_unsol_event, |
| 16675 | .init_hook = alc663_m51va_inithook, |
| 16676 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16677 | [ALC272_SAMSUNG_NC10] = { |
| 16678 | .mixers = { alc272_nc10_mixer }, |
| 16679 | .init_verbs = { alc662_init_verbs, |
| 16680 | alc663_21jd_amic_init_verbs }, |
| 16681 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16682 | .dac_nids = alc272_dac_nids, |
| 16683 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16684 | .channel_mode = alc662_3ST_2ch_modes, |
| 16685 | .input_mux = &alc272_nc10_capture_source, |
| 16686 | .unsol_event = alc663_mode4_unsol_event, |
| 16687 | .init_hook = alc663_mode4_inithook, |
| 16688 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16689 | }; |
| 16690 | |
| 16691 | |
| 16692 | /* |
| 16693 | * BIOS auto configuration |
| 16694 | */ |
| 16695 | |
| 16696 | /* add playback controls from the parsed DAC table */ |
| 16697 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16698 | const struct auto_pin_cfg *cfg) |
| 16699 | { |
| 16700 | char name[32]; |
| 16701 | static const char *chname[4] = { |
| 16702 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16703 | }; |
| 16704 | hda_nid_t nid; |
| 16705 | int i, err; |
| 16706 | |
| 16707 | for (i = 0; i < cfg->line_outs; i++) { |
| 16708 | if (!spec->multiout.dac_nids[i]) |
| 16709 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16710 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16711 | if (i == 2) { |
| 16712 | /* Center/LFE */ |
| 16713 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16714 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16715 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 16716 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16717 | if (err < 0) |
| 16718 | return err; |
| 16719 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 16720 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16721 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 16722 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16723 | if (err < 0) |
| 16724 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16725 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16726 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16727 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16728 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16729 | if (err < 0) |
| 16730 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16731 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16732 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16733 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16734 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16735 | if (err < 0) |
| 16736 | return err; |
| 16737 | } else { |
| 16738 | sprintf(name, "%s Playback Volume", chname[i]); |
| 16739 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16740 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 16741 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16742 | if (err < 0) |
| 16743 | return err; |
| 16744 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 16745 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16746 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 16747 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16748 | if (err < 0) |
| 16749 | return err; |
| 16750 | } |
| 16751 | } |
| 16752 | return 0; |
| 16753 | } |
| 16754 | |
| 16755 | /* add playback controls for speaker and HP outputs */ |
| 16756 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 16757 | const char *pfx) |
| 16758 | { |
| 16759 | hda_nid_t nid; |
| 16760 | int err; |
| 16761 | char name[32]; |
| 16762 | |
| 16763 | if (!pin) |
| 16764 | return 0; |
| 16765 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16766 | if (pin == 0x17) { |
| 16767 | /* ALC663 has a mono output pin on 0x17 */ |
| 16768 | sprintf(name, "%s Playback Switch", pfx); |
| 16769 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16770 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 16771 | return err; |
| 16772 | } |
| 16773 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16774 | if (alc880_is_fixed_pin(pin)) { |
| 16775 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 16776 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16777 | /* specify the DAC as the extra output */ |
| 16778 | if (!spec->multiout.hp_nid) |
| 16779 | spec->multiout.hp_nid = nid; |
| 16780 | else |
| 16781 | spec->multiout.extra_out_nid[0] = nid; |
| 16782 | /* control HP volume/switch on the output mixer amp */ |
| 16783 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16784 | sprintf(name, "%s Playback Volume", pfx); |
| 16785 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 16786 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 16787 | if (err < 0) |
| 16788 | return err; |
| 16789 | sprintf(name, "%s Playback Switch", pfx); |
| 16790 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 16791 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 16792 | if (err < 0) |
| 16793 | return err; |
| 16794 | } else if (alc880_is_multi_pin(pin)) { |
| 16795 | /* set manual connection */ |
| 16796 | /* we have only a switch on HP-out PIN */ |
| 16797 | sprintf(name, "%s Playback Switch", pfx); |
| 16798 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 16799 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16800 | if (err < 0) |
| 16801 | return err; |
| 16802 | } |
| 16803 | return 0; |
| 16804 | } |
| 16805 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16806 | /* return the index of the src widget from the connection list of the nid. |
| 16807 | * return -1 if not found |
| 16808 | */ |
| 16809 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 16810 | hda_nid_t src) |
| 16811 | { |
| 16812 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 16813 | int i, conns; |
| 16814 | |
| 16815 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 16816 | ARRAY_SIZE(conn_list)); |
| 16817 | if (conns < 0) |
| 16818 | return -1; |
| 16819 | for (i = 0; i < conns; i++) |
| 16820 | if (conn_list[i] == src) |
| 16821 | return i; |
| 16822 | return -1; |
| 16823 | } |
| 16824 | |
| 16825 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 16826 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 16827 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16828 | return (pincap & AC_PINCAP_IN) != 0; |
| 16829 | } |
| 16830 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16831 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16832 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16833 | const struct auto_pin_cfg *cfg) |
| 16834 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16835 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16836 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16837 | int i, err, idx; |
| 16838 | |
| 16839 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16840 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 16841 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 16842 | cfg->input_pins[i]); |
| 16843 | if (idx >= 0) { |
| 16844 | err = new_analog_input(spec, cfg->input_pins[i], |
| 16845 | auto_pin_cfg_labels[i], |
| 16846 | idx, 0x0b); |
| 16847 | if (err < 0) |
| 16848 | return err; |
| 16849 | } |
| 16850 | idx = alc662_input_pin_idx(codec, 0x22, |
| 16851 | cfg->input_pins[i]); |
| 16852 | if (idx >= 0) { |
| 16853 | imux->items[imux->num_items].label = |
| 16854 | auto_pin_cfg_labels[i]; |
| 16855 | imux->items[imux->num_items].index = idx; |
| 16856 | imux->num_items++; |
| 16857 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16858 | } |
| 16859 | } |
| 16860 | return 0; |
| 16861 | } |
| 16862 | |
| 16863 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16864 | hda_nid_t nid, int pin_type, |
| 16865 | int dac_idx) |
| 16866 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16867 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16868 | /* need the manual connection? */ |
| 16869 | if (alc880_is_multi_pin(nid)) { |
| 16870 | struct alc_spec *spec = codec->spec; |
| 16871 | int idx = alc880_multi_pin_idx(nid); |
| 16872 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 16873 | AC_VERB_SET_CONNECT_SEL, |
| 16874 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 16875 | } |
| 16876 | } |
| 16877 | |
| 16878 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 16879 | { |
| 16880 | struct alc_spec *spec = codec->spec; |
| 16881 | int i; |
| 16882 | |
| 16883 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16884 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16885 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16886 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16887 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16888 | i); |
| 16889 | } |
| 16890 | } |
| 16891 | |
| 16892 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 16893 | { |
| 16894 | struct alc_spec *spec = codec->spec; |
| 16895 | hda_nid_t pin; |
| 16896 | |
| 16897 | pin = spec->autocfg.hp_pins[0]; |
| 16898 | if (pin) /* connect to front */ |
| 16899 | /* use dac 0 */ |
| 16900 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16901 | pin = spec->autocfg.speaker_pins[0]; |
| 16902 | if (pin) |
| 16903 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16904 | } |
| 16905 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16906 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 16907 | |
| 16908 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 16909 | { |
| 16910 | struct alc_spec *spec = codec->spec; |
| 16911 | int i; |
| 16912 | |
| 16913 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16914 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16915 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16916 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 16917 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16918 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16919 | snd_hda_codec_write(codec, nid, 0, |
| 16920 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16921 | AMP_OUT_MUTE); |
| 16922 | } |
| 16923 | } |
| 16924 | } |
| 16925 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16926 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 16927 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16928 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 16929 | { |
| 16930 | struct alc_spec *spec = codec->spec; |
| 16931 | int err; |
| 16932 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 16933 | |
| 16934 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16935 | alc662_ignore); |
| 16936 | if (err < 0) |
| 16937 | return err; |
| 16938 | if (!spec->autocfg.line_outs) |
| 16939 | return 0; /* can't find valid BIOS pin config */ |
| 16940 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16941 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16942 | if (err < 0) |
| 16943 | return err; |
| 16944 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16945 | if (err < 0) |
| 16946 | return err; |
| 16947 | err = alc662_auto_create_extra_out(spec, |
| 16948 | spec->autocfg.speaker_pins[0], |
| 16949 | "Speaker"); |
| 16950 | if (err < 0) |
| 16951 | return err; |
| 16952 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 16953 | "Headphone"); |
| 16954 | if (err < 0) |
| 16955 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 16956 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16957 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16958 | return err; |
| 16959 | |
| 16960 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16961 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16962 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16963 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 16964 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16965 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16966 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16967 | |
| 16968 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16969 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16970 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16971 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16972 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16973 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 16974 | |
| 16975 | err = alc_auto_add_mic_boost(codec); |
| 16976 | if (err < 0) |
| 16977 | return err; |
| 16978 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16979 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 16980 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 16981 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16982 | } |
| 16983 | |
| 16984 | /* additional initialization for auto-configuration model */ |
| 16985 | static void alc662_auto_init(struct hda_codec *codec) |
| 16986 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16987 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16988 | alc662_auto_init_multi_out(codec); |
| 16989 | alc662_auto_init_hp_out(codec); |
| 16990 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16991 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16992 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16993 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16994 | } |
| 16995 | |
| 16996 | static int patch_alc662(struct hda_codec *codec) |
| 16997 | { |
| 16998 | struct alc_spec *spec; |
| 16999 | int err, board_config; |
| 17000 | |
| 17001 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17002 | if (!spec) |
| 17003 | return -ENOMEM; |
| 17004 | |
| 17005 | codec->spec = spec; |
| 17006 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17007 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17008 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17009 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17010 | alc662_models, |
| 17011 | alc662_cfg_tbl); |
| 17012 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 17013 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 17014 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17015 | board_config = ALC662_AUTO; |
| 17016 | } |
| 17017 | |
| 17018 | if (board_config == ALC662_AUTO) { |
| 17019 | /* automatic parse from the BIOS config */ |
| 17020 | err = alc662_parse_auto_config(codec); |
| 17021 | if (err < 0) { |
| 17022 | alc_free(codec); |
| 17023 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17024 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17025 | printk(KERN_INFO |
| 17026 | "hda_codec: Cannot set up configuration " |
| 17027 | "from BIOS. Using base mode...\n"); |
| 17028 | board_config = ALC662_3ST_2ch_DIG; |
| 17029 | } |
| 17030 | } |
| 17031 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17032 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17033 | if (err < 0) { |
| 17034 | alc_free(codec); |
| 17035 | return err; |
| 17036 | } |
| 17037 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17038 | if (board_config != ALC662_AUTO) |
| 17039 | setup_preset(spec, &alc662_presets[board_config]); |
| 17040 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17041 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17042 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17043 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17044 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17045 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17046 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17047 | spec->adc_nids = alc662_adc_nids; |
| 17048 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17049 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17050 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17051 | if (!spec->cap_mixer) |
| 17052 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17053 | if (codec->vendor_id == 0x10ec0662) |
| 17054 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17055 | else |
| 17056 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17057 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17058 | spec->vmaster_nid = 0x02; |
| 17059 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17060 | codec->patch_ops = alc_patch_ops; |
| 17061 | if (board_config == ALC662_AUTO) |
| 17062 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17063 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17064 | if (!spec->loopback.amplist) |
| 17065 | spec->loopback.amplist = alc662_loopbacks; |
| 17066 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17067 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17068 | |
| 17069 | return 0; |
| 17070 | } |
| 17071 | |
| 17072 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17073 | * patch entries |
| 17074 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17075 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17076 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17077 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17078 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17079 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17080 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17081 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17082 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17083 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17084 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17085 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17086 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17087 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17088 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17089 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17090 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17091 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17092 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17093 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17094 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17095 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17096 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17097 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17098 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17099 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17100 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17101 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17102 | .patch = patch_alc882 }, |
| 17103 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17104 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17105 | {} /* terminator */ |
| 17106 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17107 | |
| 17108 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17109 | |
| 17110 | MODULE_LICENSE("GPL"); |
| 17111 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17112 | |
| 17113 | static struct hda_codec_preset_list realtek_list = { |
| 17114 | .preset = snd_hda_preset_realtek, |
| 17115 | .owner = THIS_MODULE, |
| 17116 | }; |
| 17117 | |
| 17118 | static int __init patch_realtek_init(void) |
| 17119 | { |
| 17120 | return snd_hda_add_codec_preset(&realtek_list); |
| 17121 | } |
| 17122 | |
| 17123 | static void __exit patch_realtek_exit(void) |
| 17124 | { |
| 17125 | snd_hda_delete_codec_preset(&realtek_list); |
| 17126 | } |
| 17127 | |
| 17128 | module_init(patch_realtek_init) |
| 17129 | module_exit(patch_realtek_exit) |