Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 31 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include "hda_codec.h" |
| 33 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 34 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 36 | #define ALC880_FRONT_EVENT 0x01 |
| 37 | #define ALC880_DCVOL_EVENT 0x02 |
| 38 | #define ALC880_HP_EVENT 0x04 |
| 39 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | /* ALC880 board config type */ |
| 42 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | ALC880_3ST, |
| 44 | ALC880_3ST_DIG, |
| 45 | ALC880_5ST, |
| 46 | ALC880_5ST_DIG, |
| 47 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 48 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 49 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 50 | ALC880_6ST_DIG, |
| 51 | ALC880_F1734, |
| 52 | ALC880_ASUS, |
| 53 | ALC880_ASUS_DIG, |
| 54 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 55 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 56 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 58 | ALC880_UNIWILL, |
| 59 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 60 | ALC880_CLEVO, |
| 61 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 62 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 63 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 64 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 65 | #ifdef CONFIG_SND_DEBUG |
| 66 | ALC880_TEST, |
| 67 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 68 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 69 | ALC880_MODEL_LAST /* last tag */ |
| 70 | }; |
| 71 | |
| 72 | /* ALC260 models */ |
| 73 | enum { |
| 74 | ALC260_BASIC, |
| 75 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 76 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 77 | ALC260_HP_3013, |
| 78 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 79 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 80 | ALC260_WILL, |
| 81 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 82 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 83 | #ifdef CONFIG_SND_DEBUG |
| 84 | ALC260_TEST, |
| 85 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 87 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | }; |
| 89 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 90 | /* ALC262 models */ |
| 91 | enum { |
| 92 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 93 | ALC262_HIPPO, |
| 94 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 95 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 96 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 97 | ALC262_HP_BPC_D7000_WL, |
| 98 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 99 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 100 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 101 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 102 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 103 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 104 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 105 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 106 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 108 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 109 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 110 | ALC262_AUTO, |
| 111 | ALC262_MODEL_LAST /* last tag */ |
| 112 | }; |
| 113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | /* ALC268 models */ |
| 115 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 116 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 117 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 118 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 119 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 120 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 121 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 122 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 123 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 124 | #ifdef CONFIG_SND_DEBUG |
| 125 | ALC268_TEST, |
| 126 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 127 | ALC268_AUTO, |
| 128 | ALC268_MODEL_LAST /* last tag */ |
| 129 | }; |
| 130 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 131 | /* ALC269 models */ |
| 132 | enum { |
| 133 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 134 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 135 | ALC269_AMIC, |
| 136 | ALC269_DMIC, |
| 137 | ALC269VB_AMIC, |
| 138 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 139 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 140 | ALC269_LIFEBOOK, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 141 | ALC271_ACER, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 142 | ALC269_AUTO, |
| 143 | ALC269_MODEL_LAST /* last tag */ |
| 144 | }; |
| 145 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | /* ALC861 models */ |
| 147 | enum { |
| 148 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 149 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 150 | ALC861_3ST_DIG, |
| 151 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 152 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 153 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 154 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 155 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 156 | ALC861_AUTO, |
| 157 | ALC861_MODEL_LAST, |
| 158 | }; |
| 159 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 160 | /* ALC861-VD models */ |
| 161 | enum { |
| 162 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 163 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 164 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 165 | ALC861VD_3ST, |
| 166 | ALC861VD_3ST_DIG, |
| 167 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 168 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 169 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 170 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 171 | ALC861VD_AUTO, |
| 172 | ALC861VD_MODEL_LAST, |
| 173 | }; |
| 174 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 175 | /* ALC662 models */ |
| 176 | enum { |
| 177 | ALC662_3ST_2ch_DIG, |
| 178 | ALC662_3ST_6ch_DIG, |
| 179 | ALC662_3ST_6ch, |
| 180 | ALC662_5ST_DIG, |
| 181 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 182 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 183 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 184 | ALC663_ASUS_M51VA, |
| 185 | ALC663_ASUS_G71V, |
| 186 | ALC663_ASUS_H13, |
| 187 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 188 | ALC662_ECS, |
| 189 | ALC663_ASUS_MODE1, |
| 190 | ALC662_ASUS_MODE2, |
| 191 | ALC663_ASUS_MODE3, |
| 192 | ALC663_ASUS_MODE4, |
| 193 | ALC663_ASUS_MODE5, |
| 194 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 195 | ALC663_ASUS_MODE7, |
| 196 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 197 | ALC272_DELL, |
| 198 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 199 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 200 | ALC662_AUTO, |
| 201 | ALC662_MODEL_LAST, |
| 202 | }; |
| 203 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 204 | /* ALC882 models */ |
| 205 | enum { |
| 206 | ALC882_3ST_DIG, |
| 207 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 208 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 209 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 210 | ALC882_TARGA, |
| 211 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 212 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 213 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 214 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 215 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 216 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 217 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 218 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 219 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 220 | ALC883_3ST_2ch_DIG, |
| 221 | ALC883_3ST_6ch_DIG, |
| 222 | ALC883_3ST_6ch, |
| 223 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 224 | ALC883_TARGA_DIG, |
| 225 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 226 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 227 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 228 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 231 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 232 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 233 | ALC883_MEDION, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 234 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 235 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 237 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 239 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 240 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 241 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 242 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 243 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 244 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 245 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 246 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 247 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 248 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 249 | ALC889A_INTEL, |
| 250 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 251 | ALC888_ASUS_M90V, |
| 252 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 253 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 254 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 255 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 256 | ALC882_AUTO, |
| 257 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 258 | }; |
| 259 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 260 | /* ALC680 models */ |
| 261 | enum { |
| 262 | ALC680_BASE, |
| 263 | ALC680_AUTO, |
| 264 | ALC680_MODEL_LAST, |
| 265 | }; |
| 266 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 267 | /* for GPIO Poll */ |
| 268 | #define GPIO_MASK 0x03 |
| 269 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | /* extra amp-initialization sequence types */ |
| 271 | enum { |
| 272 | ALC_INIT_NONE, |
| 273 | ALC_INIT_DEFAULT, |
| 274 | ALC_INIT_GPIO1, |
| 275 | ALC_INIT_GPIO2, |
| 276 | ALC_INIT_GPIO3, |
| 277 | }; |
| 278 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 279 | struct alc_mic_route { |
| 280 | hda_nid_t pin; |
| 281 | unsigned char mux_idx; |
| 282 | unsigned char amix_idx; |
| 283 | }; |
| 284 | |
| 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 287 | struct alc_customize_define { |
| 288 | unsigned int sku_cfg; |
| 289 | unsigned char port_connectivity; |
| 290 | unsigned char check_sum; |
| 291 | unsigned char customization; |
| 292 | unsigned char external_amp; |
| 293 | unsigned int enable_pcbeep:1; |
| 294 | unsigned int platform_type:1; |
| 295 | unsigned int swap:1; |
| 296 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 297 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 298 | }; |
| 299 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 300 | struct alc_fixup; |
| 301 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 302 | struct alc_multi_io { |
| 303 | hda_nid_t pin; /* multi-io widget pin NID */ |
| 304 | hda_nid_t dac; /* DAC to be connected */ |
| 305 | unsigned int ctl_in; /* cached input-pin control value */ |
| 306 | }; |
| 307 | |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 308 | enum { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 309 | ALC_AUTOMUTE_PIN, /* change the pin control */ |
| 310 | ALC_AUTOMUTE_AMP, /* mute/unmute the pin AMP */ |
| 311 | ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 312 | }; |
| 313 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | struct alc_spec { |
| 315 | /* codec parameterization */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 316 | const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | unsigned int num_mixers; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 318 | const struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 319 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 321 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 322 | * don't forget NULL |
| 323 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 324 | */ |
| 325 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 327 | char stream_name_analog[32]; /* analog PCM stream */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 328 | const struct hda_pcm_stream *stream_analog_playback; |
| 329 | const struct hda_pcm_stream *stream_analog_capture; |
| 330 | const struct hda_pcm_stream *stream_analog_alt_playback; |
| 331 | const struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 333 | char stream_name_digital[32]; /* digital PCM stream */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 334 | const struct hda_pcm_stream *stream_digital_playback; |
| 335 | const struct hda_pcm_stream *stream_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | |
| 337 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 338 | struct hda_multi_out multiout; /* playback set-up |
| 339 | * max_channels, dacs must be set |
| 340 | * dig_out_nid and hp_nid are optional |
| 341 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 342 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 343 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 344 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | |
| 346 | /* capture */ |
| 347 | unsigned int num_adc_nids; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 348 | const hda_nid_t *adc_nids; |
| 349 | const hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 350 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 352 | /* capture setup for dynamic dual-adc switch */ |
| 353 | unsigned int cur_adc_idx; |
| 354 | hda_nid_t cur_adc; |
| 355 | unsigned int cur_adc_stream_tag; |
| 356 | unsigned int cur_adc_format; |
| 357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 359 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | const struct hda_input_mux *input_mux; |
| 361 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 362 | struct alc_mic_route ext_mic; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 363 | struct alc_mic_route dock_mic; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 364 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | |
| 366 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 367 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 369 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 370 | int const_channel_count; |
| 371 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | |
| 373 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 374 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 375 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 376 | /* dynamic controls, init_verbs and input_mux */ |
| 377 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 378 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 379 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 380 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 381 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 382 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 383 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 384 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 385 | /* hooks */ |
| 386 | void (*init_hook)(struct hda_codec *codec); |
| 387 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 388 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 389 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 390 | #endif |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 391 | void (*shutup)(struct hda_codec *codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 392 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 393 | /* for pin sensing */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 394 | unsigned int jack_present: 1; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 395 | unsigned int line_jack_present:1; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 396 | unsigned int master_mute:1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 397 | unsigned int auto_mic:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 398 | unsigned int automute:1; /* HP automute enabled */ |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 399 | unsigned int detect_line:1; /* Line-out detection enabled */ |
| 400 | unsigned int automute_lines:1; /* automute line-out as well */ |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 401 | unsigned int automute_hp_lo:1; /* both HP and LO available */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 402 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 403 | /* other flags */ |
| 404 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 405 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 406 | unsigned int single_input_src:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 407 | |
| 408 | /* auto-mute control */ |
| 409 | int automute_mode; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 410 | hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 411 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 412 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 413 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 414 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 415 | /* for virtual master */ |
| 416 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 417 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 418 | struct hda_loopback_check loopback; |
| 419 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 420 | |
| 421 | /* for PLL fix */ |
| 422 | hda_nid_t pll_nid; |
| 423 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 424 | |
| 425 | /* fix-up list */ |
| 426 | int fixup_id; |
| 427 | const struct alc_fixup *fixup_list; |
| 428 | const char *fixup_name; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 429 | |
| 430 | /* multi-io */ |
| 431 | int multi_ios; |
| 432 | struct alc_multi_io multi_io[4]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 433 | }; |
| 434 | |
| 435 | /* |
| 436 | * configuration template - to be copied to the spec instance |
| 437 | */ |
| 438 | struct alc_config_preset { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 439 | const struct snd_kcontrol_new *mixers[5]; /* should be identical size |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 440 | * with spec |
| 441 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 442 | const struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 443 | const struct hda_verb *init_verbs[5]; |
| 444 | unsigned int num_dacs; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 445 | const hda_nid_t *dac_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 446 | hda_nid_t dig_out_nid; /* optional */ |
| 447 | hda_nid_t hp_nid; /* optional */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 448 | const hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 449 | unsigned int num_adc_nids; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 450 | const hda_nid_t *adc_nids; |
| 451 | const hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 452 | hda_nid_t dig_in_nid; |
| 453 | unsigned int num_channel_mode; |
| 454 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 455 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 456 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 457 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 458 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 459 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 460 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 461 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 462 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 463 | const struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 464 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 465 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | }; |
| 467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | |
| 469 | /* |
| 470 | * input MUX handling |
| 471 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 472 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 473 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | { |
| 475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 476 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 477 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 478 | if (mux_idx >= spec->num_mux_defs) |
| 479 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 480 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 481 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 482 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | } |
| 484 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 485 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 486 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | { |
| 488 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 489 | struct alc_spec *spec = codec->spec; |
| 490 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 491 | |
| 492 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 493 | return 0; |
| 494 | } |
| 495 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 496 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 497 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | { |
| 499 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 500 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 501 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 503 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 504 | hda_nid_t nid = spec->capsrc_nids ? |
| 505 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 506 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 508 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 509 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 510 | if (!imux->num_items && mux_idx > 0) |
| 511 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 512 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 513 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 514 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 515 | /* Matrix-mixer style (e.g. ALC882) */ |
| 516 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 517 | unsigned int i, idx; |
| 518 | |
| 519 | idx = ucontrol->value.enumerated.item[0]; |
| 520 | if (idx >= imux->num_items) |
| 521 | idx = imux->num_items - 1; |
| 522 | if (*cur_val == idx) |
| 523 | return 0; |
| 524 | for (i = 0; i < imux->num_items; i++) { |
| 525 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 526 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 527 | imux->items[i].index, |
| 528 | HDA_AMP_MUTE, v); |
| 529 | } |
| 530 | *cur_val = idx; |
| 531 | return 1; |
| 532 | } else { |
| 533 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 534 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 535 | &spec->cur_mux[adc_idx]); |
| 536 | } |
| 537 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 538 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | /* |
| 540 | * channel mode setting |
| 541 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 542 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 543 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | { |
| 545 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 546 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 547 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 548 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | } |
| 550 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 552 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 553 | { |
| 554 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 555 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 556 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 557 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 558 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | } |
| 560 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 561 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 562 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | { |
| 564 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 565 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 566 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 567 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 568 | &spec->ext_channel_count); |
| 569 | if (err >= 0 && !spec->const_channel_count) { |
| 570 | spec->multiout.max_channels = spec->ext_channel_count; |
| 571 | if (spec->need_dac_fix) |
| 572 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 573 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 574 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | } |
| 576 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 578 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 579 | * instead of "%" to avoid consequences of accidentally treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 580 | * being part of a format specifier. Maximum allowed length of a value is |
| 581 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 582 | * |
| 583 | * Note: some retasking pin complexes seem to ignore requests for input |
| 584 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 585 | * are requested. Therefore order this list so that this behaviour will not |
| 586 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 587 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 588 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 589 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 590 | static const char * const alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 591 | "Mic 50pc bias", "Mic 80pc bias", |
| 592 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 593 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 594 | static const unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 595 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 596 | }; |
| 597 | /* 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] | 598 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 599 | * addition, "input" pins may or may not process the mic bias option |
| 600 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 601 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 602 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 603 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 604 | #define ALC_PIN_DIR_IN 0x00 |
| 605 | #define ALC_PIN_DIR_OUT 0x01 |
| 606 | #define ALC_PIN_DIR_INOUT 0x02 |
| 607 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 608 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 610 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 611 | * For each direction the minimum and maximum values are given. |
| 612 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 613 | static const signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 614 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 615 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 616 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 617 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 618 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 619 | }; |
| 620 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 621 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 622 | #define alc_pin_mode_n_items(_dir) \ |
| 623 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 624 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 625 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 626 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 627 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 628 | unsigned int item_num = uinfo->value.enumerated.item; |
| 629 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 630 | |
| 631 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 632 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 633 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 634 | |
| 635 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 636 | item_num = alc_pin_mode_min(dir); |
| 637 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 638 | return 0; |
| 639 | } |
| 640 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 641 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 642 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 643 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 644 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 645 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 646 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 647 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 648 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 650 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 651 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 652 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 653 | /* Find enumerated value for current pinctl setting */ |
| 654 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 655 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 656 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 657 | *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] | 658 | return 0; |
| 659 | } |
| 660 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 661 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 662 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 663 | { |
| 664 | signed int change; |
| 665 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 666 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 667 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 668 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 669 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 670 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 671 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 672 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 673 | 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] | 674 | val = alc_pin_mode_min(dir); |
| 675 | |
| 676 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 677 | if (change) { |
| 678 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 679 | snd_hda_codec_write_cache(codec, nid, 0, |
| 680 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 681 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 682 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 683 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 684 | * for the requested pin mode. Enum values of 2 or less are |
| 685 | * input modes. |
| 686 | * |
| 687 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 688 | * reduces noise slightly (particularly on input) so we'll |
| 689 | * do it. However, having both input and output buffers |
| 690 | * enabled simultaneously doesn't seem to be problematic if |
| 691 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 692 | */ |
| 693 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 694 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 695 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 696 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 697 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 698 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 699 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 700 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 701 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 702 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 703 | } |
| 704 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 705 | return change; |
| 706 | } |
| 707 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 708 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 709 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 710 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 711 | .info = alc_pin_mode_info, \ |
| 712 | .get = alc_pin_mode_get, \ |
| 713 | .put = alc_pin_mode_put, \ |
| 714 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 715 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 716 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 717 | * together using a mask with more than one bit set. This control is |
| 718 | * currently used only by the ALC260 test model. At this stage they are not |
| 719 | * needed for any "production" models. |
| 720 | */ |
| 721 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 722 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 723 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 724 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 725 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 726 | { |
| 727 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 728 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 729 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 730 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 731 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 732 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 733 | |
| 734 | *valp = (val & mask) != 0; |
| 735 | return 0; |
| 736 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 737 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 738 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 739 | { |
| 740 | signed int change; |
| 741 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 742 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 743 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 744 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 745 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 746 | AC_VERB_GET_GPIO_DATA, |
| 747 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 748 | |
| 749 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 750 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 751 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 752 | gpio_data &= ~mask; |
| 753 | else |
| 754 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 755 | snd_hda_codec_write_cache(codec, nid, 0, |
| 756 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 757 | |
| 758 | return change; |
| 759 | } |
| 760 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 761 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 762 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 763 | .info = alc_gpio_data_info, \ |
| 764 | .get = alc_gpio_data_get, \ |
| 765 | .put = alc_gpio_data_put, \ |
| 766 | .private_value = nid | (mask<<16) } |
| 767 | #endif /* CONFIG_SND_DEBUG */ |
| 768 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 769 | /* A switch control to allow the enabling of the digital IO pins on the |
| 770 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 771 | * to provide something in the test model allowing digital outputs to be |
| 772 | * identified if present. If models are found which can utilise these |
| 773 | * outputs a more complete mixer control can be devised for those models if |
| 774 | * necessary. |
| 775 | */ |
| 776 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 777 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 778 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 779 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 780 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 781 | { |
| 782 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 783 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 784 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 785 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 786 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 787 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 788 | |
| 789 | *valp = (val & mask) != 0; |
| 790 | return 0; |
| 791 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 792 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 793 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 794 | { |
| 795 | signed int change; |
| 796 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 797 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 798 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 799 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 800 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 801 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 802 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 803 | |
| 804 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 805 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 806 | if (val==0) |
| 807 | ctrl_data &= ~mask; |
| 808 | else |
| 809 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 810 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 811 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 812 | |
| 813 | return change; |
| 814 | } |
| 815 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 816 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 817 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 818 | .info = alc_spdif_ctrl_info, \ |
| 819 | .get = alc_spdif_ctrl_get, \ |
| 820 | .put = alc_spdif_ctrl_put, \ |
| 821 | .private_value = nid | (mask<<16) } |
| 822 | #endif /* CONFIG_SND_DEBUG */ |
| 823 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 824 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 825 | * Again, this is only used in the ALC26x test models to help identify when |
| 826 | * the EAPD line must be asserted for features to work. |
| 827 | */ |
| 828 | #ifdef CONFIG_SND_DEBUG |
| 829 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 830 | |
| 831 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 832 | struct snd_ctl_elem_value *ucontrol) |
| 833 | { |
| 834 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 835 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 836 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 837 | long *valp = ucontrol->value.integer.value; |
| 838 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 839 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 840 | |
| 841 | *valp = (val & mask) != 0; |
| 842 | return 0; |
| 843 | } |
| 844 | |
| 845 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 846 | struct snd_ctl_elem_value *ucontrol) |
| 847 | { |
| 848 | int change; |
| 849 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 850 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 851 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 852 | long val = *ucontrol->value.integer.value; |
| 853 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 854 | AC_VERB_GET_EAPD_BTLENABLE, |
| 855 | 0x00); |
| 856 | |
| 857 | /* Set/unset the masked control bit(s) as needed */ |
| 858 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 859 | if (!val) |
| 860 | ctrl_data &= ~mask; |
| 861 | else |
| 862 | ctrl_data |= mask; |
| 863 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 864 | ctrl_data); |
| 865 | |
| 866 | return change; |
| 867 | } |
| 868 | |
| 869 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 870 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 871 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 872 | .info = alc_eapd_ctrl_info, \ |
| 873 | .get = alc_eapd_ctrl_get, \ |
| 874 | .put = alc_eapd_ctrl_put, \ |
| 875 | .private_value = nid | (mask<<16) } |
| 876 | #endif /* CONFIG_SND_DEBUG */ |
| 877 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 878 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 879 | * set up the input pin config (depending on the given auto-pin type) |
| 880 | */ |
| 881 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 882 | int auto_pin_type) |
| 883 | { |
| 884 | unsigned int val = PIN_IN; |
| 885 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 886 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 887 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 888 | unsigned int oldval; |
| 889 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 890 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 891 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 892 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 893 | /* if the default pin setup is vref50, we give it priority */ |
| 894 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 895 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 896 | else if (pincap & AC_PINCAP_VREF_50) |
| 897 | val = PIN_VREF50; |
| 898 | else if (pincap & AC_PINCAP_VREF_100) |
| 899 | val = PIN_VREF100; |
| 900 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 901 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 902 | } |
| 903 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 904 | } |
| 905 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 906 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 907 | { |
| 908 | struct alc_spec *spec = codec->spec; |
| 909 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 910 | |
| 911 | if (!cfg->line_outs) { |
| 912 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 913 | cfg->line_out_pins[cfg->line_outs]) |
| 914 | cfg->line_outs++; |
| 915 | } |
| 916 | if (!cfg->speaker_outs) { |
| 917 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 918 | cfg->speaker_pins[cfg->speaker_outs]) |
| 919 | cfg->speaker_outs++; |
| 920 | } |
| 921 | if (!cfg->hp_outs) { |
| 922 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 923 | cfg->hp_pins[cfg->hp_outs]) |
| 924 | cfg->hp_outs++; |
| 925 | } |
| 926 | } |
| 927 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 928 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 929 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 930 | static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 931 | { |
| 932 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 933 | return; |
| 934 | spec->mixers[spec->num_mixers++] = mix; |
| 935 | } |
| 936 | |
| 937 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 938 | { |
| 939 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 940 | return; |
| 941 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 942 | } |
| 943 | |
| 944 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 945 | * set up from the preset table |
| 946 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 947 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 948 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 949 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 950 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 951 | int i; |
| 952 | |
| 953 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 954 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 955 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 956 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 957 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 958 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 960 | spec->channel_mode = preset->channel_mode; |
| 961 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 962 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 963 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 964 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 965 | if (preset->const_channel_count) |
| 966 | spec->multiout.max_channels = preset->const_channel_count; |
| 967 | else |
| 968 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 969 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 970 | |
| 971 | spec->multiout.num_dacs = preset->num_dacs; |
| 972 | spec->multiout.dac_nids = preset->dac_nids; |
| 973 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 974 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 975 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 976 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 977 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 978 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 979 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 980 | spec->input_mux = preset->input_mux; |
| 981 | |
| 982 | spec->num_adc_nids = preset->num_adc_nids; |
| 983 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 984 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 985 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 986 | |
| 987 | spec->unsol_event = preset->unsol_event; |
| 988 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 989 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 990 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 991 | spec->loopback.amplist = preset->loopbacks; |
| 992 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 993 | |
| 994 | if (preset->setup) |
| 995 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 996 | |
| 997 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 998 | } |
| 999 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1000 | /* Enable GPIO mask and set output */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1001 | static const struct hda_verb alc_gpio1_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1002 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 1003 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 1004 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 1005 | { } |
| 1006 | }; |
| 1007 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1008 | static const struct hda_verb alc_gpio2_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1009 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 1010 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 1011 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 1012 | { } |
| 1013 | }; |
| 1014 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1015 | static const struct hda_verb alc_gpio3_init_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1016 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 1017 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 1018 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 1019 | { } |
| 1020 | }; |
| 1021 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 1022 | /* |
| 1023 | * Fix hardware PLL issue |
| 1024 | * On some codecs, the analog PLL gating control must be off while |
| 1025 | * the default value is 1. |
| 1026 | */ |
| 1027 | static void alc_fix_pll(struct hda_codec *codec) |
| 1028 | { |
| 1029 | struct alc_spec *spec = codec->spec; |
| 1030 | unsigned int val; |
| 1031 | |
| 1032 | if (!spec->pll_nid) |
| 1033 | return; |
| 1034 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1035 | spec->pll_coef_idx); |
| 1036 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1037 | AC_VERB_GET_PROC_COEF, 0); |
| 1038 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1039 | spec->pll_coef_idx); |
| 1040 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1041 | val & ~(1 << spec->pll_coef_bit)); |
| 1042 | } |
| 1043 | |
| 1044 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1045 | unsigned int coef_idx, unsigned int coef_bit) |
| 1046 | { |
| 1047 | struct alc_spec *spec = codec->spec; |
| 1048 | spec->pll_nid = nid; |
| 1049 | spec->pll_coef_idx = coef_idx; |
| 1050 | spec->pll_coef_bit = coef_bit; |
| 1051 | alc_fix_pll(codec); |
| 1052 | } |
| 1053 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1054 | static int alc_init_jacks(struct hda_codec *codec) |
| 1055 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1056 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1057 | struct alc_spec *spec = codec->spec; |
| 1058 | int err; |
| 1059 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1060 | unsigned int mic_nid = spec->ext_mic.pin; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1061 | unsigned int dock_nid = spec->dock_mic.pin; |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1062 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1063 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1064 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1065 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1066 | if (err < 0) |
| 1067 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1068 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1069 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1070 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1071 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1072 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1073 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1074 | if (err < 0) |
| 1075 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1076 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1077 | } |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1078 | if (dock_nid) { |
| 1079 | err = snd_hda_input_jack_add(codec, dock_nid, |
| 1080 | SND_JACK_MICROPHONE, NULL); |
| 1081 | if (err < 0) |
| 1082 | return err; |
| 1083 | snd_hda_input_jack_report(codec, dock_nid); |
| 1084 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1085 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1086 | return 0; |
| 1087 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1088 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1089 | static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1090 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1091 | int i, present = 0; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1092 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1093 | for (i = 0; i < num_pins; i++) { |
| 1094 | hda_nid_t nid = pins[i]; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1095 | if (!nid) |
| 1096 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1097 | snd_hda_input_jack_report(codec, nid); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1098 | present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1099 | } |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1100 | return present; |
| 1101 | } |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1102 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1103 | static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1104 | bool mute, bool hp_out) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1105 | { |
| 1106 | struct alc_spec *spec = codec->spec; |
| 1107 | unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1108 | unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1109 | int i; |
| 1110 | |
| 1111 | for (i = 0; i < num_pins; i++) { |
| 1112 | hda_nid_t nid = pins[i]; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1113 | if (!nid) |
| 1114 | break; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1115 | switch (spec->automute_mode) { |
| 1116 | case ALC_AUTOMUTE_PIN: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1117 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1118 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1119 | pin_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1120 | break; |
| 1121 | case ALC_AUTOMUTE_AMP: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1122 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1123 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1124 | break; |
| 1125 | case ALC_AUTOMUTE_MIXER: |
| 1126 | nid = spec->automute_mixer_nid[i]; |
| 1127 | if (!nid) |
| 1128 | break; |
| 1129 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1130 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1131 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1132 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1133 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1134 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1135 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1136 | } |
| 1137 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1138 | /* Toggle internal speakers muting */ |
| 1139 | static void update_speakers(struct hda_codec *codec) |
| 1140 | { |
| 1141 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1142 | int on; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1143 | |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1144 | if (!spec->automute) |
| 1145 | on = 0; |
| 1146 | else |
| 1147 | on = spec->jack_present | spec->line_jack_present; |
| 1148 | on |= spec->master_mute; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1149 | do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1150 | spec->autocfg.speaker_pins, on, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1151 | |
| 1152 | /* toggle line-out mutes if needed, too */ |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1153 | /* if LO is a copy of either HP or Speaker, don't need to handle it */ |
| 1154 | if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] || |
| 1155 | spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0]) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1156 | return; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1157 | if (!spec->automute_lines || !spec->automute) |
| 1158 | on = 0; |
| 1159 | else |
| 1160 | on = spec->jack_present; |
| 1161 | on |= spec->master_mute; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1162 | do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1163 | spec->autocfg.line_out_pins, on, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1164 | } |
| 1165 | |
| 1166 | static void alc_hp_automute(struct hda_codec *codec) |
| 1167 | { |
| 1168 | struct alc_spec *spec = codec->spec; |
| 1169 | |
| 1170 | if (!spec->automute) |
| 1171 | return; |
| 1172 | spec->jack_present = |
| 1173 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 1174 | spec->autocfg.hp_pins); |
| 1175 | update_speakers(codec); |
| 1176 | } |
| 1177 | |
| 1178 | static void alc_line_automute(struct hda_codec *codec) |
| 1179 | { |
| 1180 | struct alc_spec *spec = codec->spec; |
| 1181 | |
| 1182 | if (!spec->automute || !spec->detect_line) |
| 1183 | return; |
| 1184 | spec->line_jack_present = |
| 1185 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
| 1186 | spec->autocfg.line_out_pins); |
| 1187 | update_speakers(codec); |
| 1188 | } |
| 1189 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1190 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1191 | hda_nid_t nid) |
| 1192 | { |
| 1193 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1194 | int i, nums; |
| 1195 | |
| 1196 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1197 | for (i = 0; i < nums; i++) |
| 1198 | if (conn[i] == nid) |
| 1199 | return i; |
| 1200 | return -1; |
| 1201 | } |
| 1202 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1203 | /* switch the current ADC according to the jack state */ |
| 1204 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1205 | { |
| 1206 | struct alc_spec *spec = codec->spec; |
| 1207 | unsigned int present; |
| 1208 | hda_nid_t new_adc; |
| 1209 | |
| 1210 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1211 | if (present) |
| 1212 | spec->cur_adc_idx = 1; |
| 1213 | else |
| 1214 | spec->cur_adc_idx = 0; |
| 1215 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1216 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1217 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1218 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1219 | spec->cur_adc = new_adc; |
| 1220 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1221 | spec->cur_adc_stream_tag, 0, |
| 1222 | spec->cur_adc_format); |
| 1223 | } |
| 1224 | } |
| 1225 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1226 | static void alc_mic_automute(struct hda_codec *codec) |
| 1227 | { |
| 1228 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1229 | struct alc_mic_route *dead1, *dead2, *alive; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1230 | unsigned int present, type; |
| 1231 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1232 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1233 | if (!spec->auto_mic) |
| 1234 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1235 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1236 | return; |
| 1237 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1238 | return; |
| 1239 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1240 | if (spec->dual_adc_switch) { |
| 1241 | alc_dual_mic_adc_auto_switch(codec); |
| 1242 | return; |
| 1243 | } |
| 1244 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1245 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1246 | |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1247 | alive = &spec->int_mic; |
| 1248 | dead1 = &spec->ext_mic; |
| 1249 | dead2 = &spec->dock_mic; |
| 1250 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1251 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1252 | if (present) { |
| 1253 | alive = &spec->ext_mic; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1254 | dead1 = &spec->int_mic; |
| 1255 | dead2 = &spec->dock_mic; |
| 1256 | } |
| 1257 | if (!present && spec->dock_mic.pin > 0) { |
| 1258 | present = snd_hda_jack_detect(codec, spec->dock_mic.pin); |
| 1259 | if (present) { |
| 1260 | alive = &spec->dock_mic; |
| 1261 | dead1 = &spec->int_mic; |
| 1262 | dead2 = &spec->ext_mic; |
| 1263 | } |
| 1264 | snd_hda_input_jack_report(codec, spec->dock_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1265 | } |
| 1266 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1267 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1268 | if (type == AC_WID_AUD_MIX) { |
| 1269 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1270 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1271 | alive->mux_idx, |
| 1272 | HDA_AMP_MUTE, 0); |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1273 | if (dead1->pin > 0) |
| 1274 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1275 | dead1->mux_idx, |
| 1276 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1277 | if (dead2->pin > 0) |
| 1278 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1279 | dead2->mux_idx, |
| 1280 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1281 | } else { |
| 1282 | /* MUX style (e.g. ALC880) */ |
| 1283 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1284 | AC_VERB_SET_CONNECT_SEL, |
| 1285 | alive->mux_idx); |
| 1286 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1287 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1288 | |
| 1289 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1290 | } |
| 1291 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1292 | /* unsolicited event for HP jack sensing */ |
| 1293 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1294 | { |
| 1295 | if (codec->vendor_id == 0x10ec0880) |
| 1296 | res >>= 28; |
| 1297 | else |
| 1298 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1299 | switch (res) { |
| 1300 | case ALC880_HP_EVENT: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1301 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1302 | break; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1303 | case ALC880_FRONT_EVENT: |
| 1304 | alc_line_automute(codec); |
| 1305 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1306 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1307 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1308 | break; |
| 1309 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1310 | } |
| 1311 | |
| 1312 | static void alc_inithook(struct hda_codec *codec) |
| 1313 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1314 | alc_hp_automute(codec); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1315 | alc_line_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1316 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1317 | } |
| 1318 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1319 | /* additional initialization for ALC888 variants */ |
| 1320 | static void alc888_coef_init(struct hda_codec *codec) |
| 1321 | { |
| 1322 | unsigned int tmp; |
| 1323 | |
| 1324 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1325 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1326 | 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] | 1327 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1328 | /* alc888S-VC */ |
| 1329 | snd_hda_codec_read(codec, 0x20, 0, |
| 1330 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1331 | else |
| 1332 | /* alc888-VB */ |
| 1333 | snd_hda_codec_read(codec, 0x20, 0, |
| 1334 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1335 | } |
| 1336 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1337 | static void alc889_coef_init(struct hda_codec *codec) |
| 1338 | { |
| 1339 | unsigned int tmp; |
| 1340 | |
| 1341 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1342 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1343 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1344 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1345 | } |
| 1346 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1347 | /* turn on/off EAPD control (only if available) */ |
| 1348 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1349 | { |
| 1350 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1351 | return; |
| 1352 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1353 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1354 | on ? 2 : 0); |
| 1355 | } |
| 1356 | |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1357 | /* turn on/off EAPD controls of the codec */ |
| 1358 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) |
| 1359 | { |
| 1360 | /* We currently only handle front, HP */ |
| 1361 | switch (codec->vendor_id) { |
| 1362 | case 0x10ec0260: |
| 1363 | set_eapd(codec, 0x0f, on); |
| 1364 | set_eapd(codec, 0x10, on); |
| 1365 | break; |
| 1366 | case 0x10ec0262: |
| 1367 | case 0x10ec0267: |
| 1368 | case 0x10ec0268: |
| 1369 | case 0x10ec0269: |
| 1370 | case 0x10ec0270: |
| 1371 | case 0x10ec0272: |
| 1372 | case 0x10ec0660: |
| 1373 | case 0x10ec0662: |
| 1374 | case 0x10ec0663: |
| 1375 | case 0x10ec0665: |
| 1376 | case 0x10ec0862: |
| 1377 | case 0x10ec0889: |
| 1378 | case 0x10ec0892: |
| 1379 | set_eapd(codec, 0x14, on); |
| 1380 | set_eapd(codec, 0x15, on); |
| 1381 | break; |
| 1382 | } |
| 1383 | } |
| 1384 | |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 1385 | /* generic shutup callback; |
| 1386 | * just turning off EPAD and a little pause for avoiding pop-noise |
| 1387 | */ |
| 1388 | static void alc_eapd_shutup(struct hda_codec *codec) |
| 1389 | { |
| 1390 | alc_auto_setup_eapd(codec, false); |
| 1391 | msleep(200); |
| 1392 | } |
| 1393 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1394 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1395 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1396 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1397 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1398 | switch (type) { |
| 1399 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1400 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1401 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1402 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1403 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1404 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1405 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1406 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1407 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1408 | case ALC_INIT_DEFAULT: |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1409 | alc_auto_setup_eapd(codec, true); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1410 | switch (codec->vendor_id) { |
| 1411 | case 0x10ec0260: |
| 1412 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1413 | AC_VERB_SET_COEF_INDEX, 7); |
| 1414 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1415 | AC_VERB_GET_PROC_COEF, 0); |
| 1416 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1417 | AC_VERB_SET_COEF_INDEX, 7); |
| 1418 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1419 | AC_VERB_SET_PROC_COEF, |
| 1420 | tmp | 0x2010); |
| 1421 | break; |
| 1422 | case 0x10ec0262: |
| 1423 | case 0x10ec0880: |
| 1424 | case 0x10ec0882: |
| 1425 | case 0x10ec0883: |
| 1426 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1427 | case 0x10ec0887: |
Takashi Iwai | 20b67dd | 2011-03-23 22:54:32 +0100 | [diff] [blame] | 1428 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1429 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1430 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1431 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1432 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1433 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1434 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1435 | case 0x10ec0267: |
| 1436 | case 0x10ec0268: |
| 1437 | snd_hda_codec_write(codec, 0x20, 0, |
| 1438 | AC_VERB_SET_COEF_INDEX, 7); |
| 1439 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1440 | AC_VERB_GET_PROC_COEF, 0); |
| 1441 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1442 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1443 | snd_hda_codec_write(codec, 0x20, 0, |
| 1444 | AC_VERB_SET_PROC_COEF, |
| 1445 | tmp | 0x3000); |
| 1446 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1447 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1448 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1449 | break; |
| 1450 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1451 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1452 | |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1453 | static int alc_automute_mode_info(struct snd_kcontrol *kcontrol, |
| 1454 | struct snd_ctl_elem_info *uinfo) |
| 1455 | { |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1457 | struct alc_spec *spec = codec->spec; |
| 1458 | static const char * const texts2[] = { |
| 1459 | "Disabled", "Enabled" |
| 1460 | }; |
| 1461 | static const char * const texts3[] = { |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1462 | "Disabled", "Speaker Only", "Line-Out+Speaker" |
| 1463 | }; |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1464 | const char * const *texts; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1465 | |
| 1466 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 1467 | uinfo->count = 1; |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1468 | if (spec->automute_hp_lo) { |
| 1469 | uinfo->value.enumerated.items = 3; |
| 1470 | texts = texts3; |
| 1471 | } else { |
| 1472 | uinfo->value.enumerated.items = 2; |
| 1473 | texts = texts2; |
| 1474 | } |
| 1475 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
| 1476 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1477 | strcpy(uinfo->value.enumerated.name, |
| 1478 | texts[uinfo->value.enumerated.item]); |
| 1479 | return 0; |
| 1480 | } |
| 1481 | |
| 1482 | static int alc_automute_mode_get(struct snd_kcontrol *kcontrol, |
| 1483 | struct snd_ctl_elem_value *ucontrol) |
| 1484 | { |
| 1485 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1486 | struct alc_spec *spec = codec->spec; |
| 1487 | unsigned int val; |
| 1488 | if (!spec->automute) |
| 1489 | val = 0; |
| 1490 | else if (!spec->automute_lines) |
| 1491 | val = 1; |
| 1492 | else |
| 1493 | val = 2; |
| 1494 | ucontrol->value.enumerated.item[0] = val; |
| 1495 | return 0; |
| 1496 | } |
| 1497 | |
| 1498 | static int alc_automute_mode_put(struct snd_kcontrol *kcontrol, |
| 1499 | struct snd_ctl_elem_value *ucontrol) |
| 1500 | { |
| 1501 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1502 | struct alc_spec *spec = codec->spec; |
| 1503 | |
| 1504 | switch (ucontrol->value.enumerated.item[0]) { |
| 1505 | case 0: |
| 1506 | if (!spec->automute) |
| 1507 | return 0; |
| 1508 | spec->automute = 0; |
| 1509 | break; |
| 1510 | case 1: |
| 1511 | if (spec->automute && !spec->automute_lines) |
| 1512 | return 0; |
| 1513 | spec->automute = 1; |
| 1514 | spec->automute_lines = 0; |
| 1515 | break; |
| 1516 | case 2: |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1517 | if (!spec->automute_hp_lo) |
| 1518 | return -EINVAL; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1519 | if (spec->automute && spec->automute_lines) |
| 1520 | return 0; |
| 1521 | spec->automute = 1; |
| 1522 | spec->automute_lines = 1; |
| 1523 | break; |
| 1524 | default: |
| 1525 | return -EINVAL; |
| 1526 | } |
| 1527 | update_speakers(codec); |
| 1528 | return 1; |
| 1529 | } |
| 1530 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1531 | static const struct snd_kcontrol_new alc_automute_mode_enum = { |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1532 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1533 | .name = "Auto-Mute Mode", |
| 1534 | .info = alc_automute_mode_info, |
| 1535 | .get = alc_automute_mode_get, |
| 1536 | .put = alc_automute_mode_put, |
| 1537 | }; |
| 1538 | |
| 1539 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec); |
| 1540 | |
| 1541 | static int alc_add_automute_mode_enum(struct hda_codec *codec) |
| 1542 | { |
| 1543 | struct alc_spec *spec = codec->spec; |
| 1544 | struct snd_kcontrol_new *knew; |
| 1545 | |
| 1546 | knew = alc_kcontrol_new(spec); |
| 1547 | if (!knew) |
| 1548 | return -ENOMEM; |
| 1549 | *knew = alc_automute_mode_enum; |
| 1550 | knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL); |
| 1551 | if (!knew->name) |
| 1552 | return -ENOMEM; |
| 1553 | return 0; |
| 1554 | } |
| 1555 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1556 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1557 | { |
| 1558 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1559 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 1daf5f4 | 2011-04-28 17:57:46 +0200 | [diff] [blame] | 1560 | int present = 0; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1561 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1562 | |
Takashi Iwai | 1daf5f4 | 2011-04-28 17:57:46 +0200 | [diff] [blame] | 1563 | if (cfg->hp_pins[0]) |
| 1564 | present++; |
| 1565 | if (cfg->line_out_pins[0]) |
| 1566 | present++; |
| 1567 | if (cfg->speaker_pins[0]) |
| 1568 | present++; |
| 1569 | if (present < 2) /* need two different output types */ |
| 1570 | return; |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1571 | if (present == 3) |
| 1572 | spec->automute_hp_lo = 1; /* both HP and LO automute */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1573 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1574 | if (!cfg->speaker_pins[0]) { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1575 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1576 | sizeof(cfg->speaker_pins)); |
| 1577 | cfg->speaker_outs = cfg->line_outs; |
| 1578 | } |
| 1579 | |
| 1580 | if (!cfg->hp_pins[0]) { |
| 1581 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1582 | sizeof(cfg->hp_pins)); |
| 1583 | cfg->hp_outs = cfg->line_outs; |
| 1584 | } |
| 1585 | |
| 1586 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1587 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | 06dec22 | 2011-05-17 10:00:16 +0200 | [diff] [blame] | 1588 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1589 | continue; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1590 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1591 | nid); |
| 1592 | snd_hda_codec_write_cache(codec, nid, 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1593 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1594 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1595 | spec->automute = 1; |
| 1596 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1597 | } |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1598 | if (spec->automute && cfg->line_out_pins[0] && |
| 1599 | cfg->line_out_pins[0] != cfg->hp_pins[0] && |
| 1600 | cfg->line_out_pins[0] != cfg->speaker_pins[0]) { |
| 1601 | for (i = 0; i < cfg->line_outs; i++) { |
| 1602 | hda_nid_t nid = cfg->line_out_pins[i]; |
Takashi Iwai | 06dec22 | 2011-05-17 10:00:16 +0200 | [diff] [blame] | 1603 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1604 | continue; |
| 1605 | snd_printdd("realtek: Enable Line-Out auto-muting " |
| 1606 | "on NID 0x%x\n", nid); |
| 1607 | snd_hda_codec_write_cache(codec, nid, 0, |
| 1608 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1609 | AC_USRSP_EN | ALC880_FRONT_EVENT); |
| 1610 | spec->detect_line = 1; |
| 1611 | } |
Takashi Iwai | 52d3cb8 | 2011-05-17 10:04:08 +0200 | [diff] [blame] | 1612 | spec->automute_lines = spec->detect_line; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1613 | } |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1614 | |
| 1615 | if (spec->automute) { |
| 1616 | /* create a control for automute mode */ |
| 1617 | alc_add_automute_mode_enum(codec); |
| 1618 | spec->unsol_event = alc_sku_unsol_event; |
| 1619 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1620 | } |
| 1621 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1622 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1623 | { |
| 1624 | struct alc_spec *spec = codec->spec; |
| 1625 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1626 | hda_nid_t fixed, ext, dock; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1627 | int i; |
| 1628 | |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1629 | fixed = ext = dock = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1630 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1631 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1632 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1633 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1634 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1635 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1636 | if (fixed) |
| 1637 | return; /* already occupied */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1638 | if (cfg->inputs[i].type != AUTO_PIN_MIC) |
| 1639 | return; /* invalid type */ |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1640 | fixed = nid; |
| 1641 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1642 | case INPUT_PIN_ATTR_UNUSED: |
| 1643 | return; /* invalid entry */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1644 | case INPUT_PIN_ATTR_DOCK: |
| 1645 | if (dock) |
| 1646 | return; /* already occupied */ |
| 1647 | if (cfg->inputs[i].type > AUTO_PIN_LINE_IN) |
| 1648 | return; /* invalid type */ |
| 1649 | dock = nid; |
| 1650 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1651 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1652 | if (ext) |
| 1653 | return; /* already occupied */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1654 | if (cfg->inputs[i].type != AUTO_PIN_MIC) |
| 1655 | return; /* invalid type */ |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1656 | ext = nid; |
| 1657 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1658 | } |
| 1659 | } |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1660 | if (!ext && dock) { |
| 1661 | ext = dock; |
| 1662 | dock = 0; |
| 1663 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1664 | if (!ext || !fixed) |
| 1665 | return; |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 1666 | if (!is_jack_detectable(codec, ext)) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1667 | return; /* no unsol support */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1668 | if (dock && !is_jack_detectable(codec, dock)) |
| 1669 | return; /* no unsol support */ |
| 1670 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n", |
| 1671 | ext, fixed, dock); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1672 | spec->ext_mic.pin = ext; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1673 | spec->dock_mic.pin = dock; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1674 | spec->int_mic.pin = fixed; |
| 1675 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1676 | spec->dock_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1677 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1678 | spec->auto_mic = 1; |
| 1679 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1680 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1681 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1682 | spec->unsol_event = alc_sku_unsol_event; |
| 1683 | } |
| 1684 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1685 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1686 | * the driver to ignore any present sku defines. |
| 1687 | */ |
| 1688 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1689 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1690 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1691 | { |
| 1692 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1693 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1694 | struct alc_spec *spec = codec->spec; |
| 1695 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1696 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1697 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1698 | if (spec->cdefine.fixup) { |
| 1699 | ass = spec->cdefine.sku_cfg; |
| 1700 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1701 | return -1; |
| 1702 | goto do_sku; |
| 1703 | } |
| 1704 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1705 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1706 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1707 | goto do_sku; |
| 1708 | |
| 1709 | nid = 0x1d; |
| 1710 | if (codec->vendor_id == 0x10ec0260) |
| 1711 | nid = 0x17; |
| 1712 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1713 | |
| 1714 | if (!(ass & 1)) { |
| 1715 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1716 | codec->chip_name, ass); |
| 1717 | return -1; |
| 1718 | } |
| 1719 | |
| 1720 | /* check sum */ |
| 1721 | tmp = 0; |
| 1722 | for (i = 1; i < 16; i++) { |
| 1723 | if ((ass >> i) & 1) |
| 1724 | tmp++; |
| 1725 | } |
| 1726 | if (((ass >> 16) & 0xf) != tmp) |
| 1727 | return -1; |
| 1728 | |
| 1729 | spec->cdefine.port_connectivity = ass >> 30; |
| 1730 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1731 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1732 | spec->cdefine.customization = ass >> 8; |
| 1733 | do_sku: |
| 1734 | spec->cdefine.sku_cfg = ass; |
| 1735 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1736 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1737 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1738 | spec->cdefine.override = ass & 0x1; |
| 1739 | |
| 1740 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1741 | nid, spec->cdefine.sku_cfg); |
| 1742 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1743 | spec->cdefine.port_connectivity); |
| 1744 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1745 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1746 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1747 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1748 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1749 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1750 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1751 | |
| 1752 | return 0; |
| 1753 | } |
| 1754 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1755 | /* check subsystem ID and set up device-specific initialization; |
| 1756 | * return 1 if initialized, 0 if invalid SSID |
| 1757 | */ |
| 1758 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1759 | * 31 ~ 16 : Manufacture ID |
| 1760 | * 15 ~ 8 : SKU ID |
| 1761 | * 7 ~ 0 : Assembly ID |
| 1762 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1763 | */ |
| 1764 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1765 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1766 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1767 | { |
| 1768 | unsigned int ass, tmp, i; |
| 1769 | unsigned nid; |
| 1770 | struct alc_spec *spec = codec->spec; |
| 1771 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1772 | if (spec->cdefine.fixup) { |
| 1773 | ass = spec->cdefine.sku_cfg; |
| 1774 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1775 | return 0; |
| 1776 | goto do_sku; |
| 1777 | } |
| 1778 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1779 | ass = codec->subsystem_id & 0xffff; |
| 1780 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1781 | goto do_sku; |
| 1782 | |
| 1783 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1784 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1785 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1786 | * 29~21 : reserve |
| 1787 | * 20 : PCBEEP input |
| 1788 | * 19~16 : Check sum (15:1) |
| 1789 | * 15~1 : Custom |
| 1790 | * 0 : override |
| 1791 | */ |
| 1792 | nid = 0x1d; |
| 1793 | if (codec->vendor_id == 0x10ec0260) |
| 1794 | nid = 0x17; |
| 1795 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1796 | snd_printd("realtek: No valid SSID, " |
| 1797 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1798 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1799 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1800 | return 0; |
| 1801 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1802 | return 0; |
| 1803 | |
| 1804 | /* check sum */ |
| 1805 | tmp = 0; |
| 1806 | for (i = 1; i < 16; i++) { |
| 1807 | if ((ass >> i) & 1) |
| 1808 | tmp++; |
| 1809 | } |
| 1810 | if (((ass >> 16) & 0xf) != tmp) |
| 1811 | return 0; |
| 1812 | do_sku: |
| 1813 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1814 | ass & 0xffff, codec->vendor_id); |
| 1815 | /* |
| 1816 | * 0 : override |
| 1817 | * 1 : Swap Jack |
| 1818 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1819 | * 3~5 : External Amplifier control |
| 1820 | * 7~6 : Reserved |
| 1821 | */ |
| 1822 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1823 | switch (tmp) { |
| 1824 | case 1: |
| 1825 | spec->init_amp = ALC_INIT_GPIO1; |
| 1826 | break; |
| 1827 | case 3: |
| 1828 | spec->init_amp = ALC_INIT_GPIO2; |
| 1829 | break; |
| 1830 | case 7: |
| 1831 | spec->init_amp = ALC_INIT_GPIO3; |
| 1832 | break; |
| 1833 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1834 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1835 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1836 | break; |
| 1837 | } |
| 1838 | |
| 1839 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1840 | * when the external headphone out jack is plugged" |
| 1841 | */ |
| 1842 | if (!(ass & 0x8000)) |
| 1843 | return 1; |
| 1844 | /* |
| 1845 | * 10~8 : Jack location |
| 1846 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1847 | * 14~13: Resvered |
| 1848 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1849 | * when the external headphone out jack is plugged" |
| 1850 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1851 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1852 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1853 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1854 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1855 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1856 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1857 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1858 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1859 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1860 | else if (tmp == 3) |
| 1861 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1862 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1863 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1864 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1865 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1866 | return 1; |
| 1867 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1868 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1869 | return 1; |
| 1870 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1871 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1872 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1873 | hda_nid_t porta, hda_nid_t porte, |
| 1874 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1875 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1876 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1877 | struct alc_spec *spec = codec->spec; |
| 1878 | snd_printd("realtek: " |
| 1879 | "Enable default setup for auto mode as fallback\n"); |
| 1880 | spec->init_amp = ALC_INIT_DEFAULT; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1881 | } |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1882 | |
| 1883 | alc_init_auto_hp(codec); |
| 1884 | alc_init_auto_mic(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1885 | } |
| 1886 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1887 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1888 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1889 | */ |
| 1890 | |
| 1891 | struct alc_pincfg { |
| 1892 | hda_nid_t nid; |
| 1893 | u32 val; |
| 1894 | }; |
| 1895 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1896 | struct alc_model_fixup { |
| 1897 | const int id; |
| 1898 | const char *name; |
| 1899 | }; |
| 1900 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1901 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1902 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1903 | bool chained; |
| 1904 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1905 | union { |
| 1906 | unsigned int sku; |
| 1907 | const struct alc_pincfg *pins; |
| 1908 | const struct hda_verb *verbs; |
| 1909 | void (*func)(struct hda_codec *codec, |
| 1910 | const struct alc_fixup *fix, |
| 1911 | int action); |
| 1912 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1913 | }; |
| 1914 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1915 | enum { |
| 1916 | ALC_FIXUP_INVALID, |
| 1917 | ALC_FIXUP_SKU, |
| 1918 | ALC_FIXUP_PINS, |
| 1919 | ALC_FIXUP_VERBS, |
| 1920 | ALC_FIXUP_FUNC, |
| 1921 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1922 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1923 | enum { |
| 1924 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1925 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1926 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1927 | }; |
| 1928 | |
| 1929 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1930 | { |
| 1931 | struct alc_spec *spec = codec->spec; |
| 1932 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1933 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1934 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1935 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1936 | int depth = 0; |
| 1937 | |
| 1938 | if (!spec->fixup_list) |
| 1939 | return; |
| 1940 | |
| 1941 | while (id >= 0) { |
| 1942 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1943 | const struct alc_pincfg *cfg; |
| 1944 | |
| 1945 | switch (fix->type) { |
| 1946 | case ALC_FIXUP_SKU: |
| 1947 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1948 | break;; |
| 1949 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1950 | "Apply sku override for %s\n", |
| 1951 | codec->chip_name, modelname); |
| 1952 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1953 | spec->cdefine.fixup = 1; |
| 1954 | break; |
| 1955 | case ALC_FIXUP_PINS: |
| 1956 | cfg = fix->v.pins; |
| 1957 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1958 | break; |
| 1959 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1960 | "Apply pincfg for %s\n", |
| 1961 | codec->chip_name, modelname); |
| 1962 | for (; cfg->nid; cfg++) |
| 1963 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1964 | cfg->val); |
| 1965 | break; |
| 1966 | case ALC_FIXUP_VERBS: |
| 1967 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1968 | break; |
| 1969 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1970 | "Apply fix-verbs for %s\n", |
| 1971 | codec->chip_name, modelname); |
| 1972 | add_verb(codec->spec, fix->v.verbs); |
| 1973 | break; |
| 1974 | case ALC_FIXUP_FUNC: |
| 1975 | if (!fix->v.func) |
| 1976 | break; |
| 1977 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1978 | "Apply fix-func for %s\n", |
| 1979 | codec->chip_name, modelname); |
| 1980 | fix->v.func(codec, fix, action); |
| 1981 | break; |
| 1982 | default: |
| 1983 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1984 | "Invalid fixup type %d\n", |
| 1985 | codec->chip_name, fix->type); |
| 1986 | break; |
| 1987 | } |
Takashi Iwai | 24af2b1 | 2011-05-02 13:55:36 +0200 | [diff] [blame] | 1988 | if (!fix->chained) |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1989 | break; |
| 1990 | if (++depth > 10) |
| 1991 | break; |
Takashi Iwai | 24af2b1 | 2011-05-02 13:55:36 +0200 | [diff] [blame] | 1992 | id = fix->chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1993 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1994 | } |
| 1995 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1996 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1997 | const struct alc_model_fixup *models, |
| 1998 | const struct snd_pci_quirk *quirk, |
| 1999 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 2000 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 2001 | struct alc_spec *spec = codec->spec; |
| 2002 | int id = -1; |
| 2003 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 2004 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 2005 | if (codec->modelname && models) { |
| 2006 | while (models->name) { |
| 2007 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 2008 | id = models->id; |
| 2009 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 2010 | break; |
| 2011 | } |
| 2012 | models++; |
| 2013 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 2014 | } |
| 2015 | if (id < 0) { |
| 2016 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 2017 | if (quirk) { |
| 2018 | id = quirk->value; |
| 2019 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 2020 | name = quirk->name; |
| 2021 | #endif |
| 2022 | } |
| 2023 | } |
| 2024 | |
| 2025 | spec->fixup_id = id; |
| 2026 | if (id >= 0) { |
| 2027 | spec->fixup_list = fixlist; |
| 2028 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 2029 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 2030 | } |
| 2031 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 2032 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 2033 | unsigned int coef_idx) |
| 2034 | { |
| 2035 | unsigned int val; |
| 2036 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 2037 | coef_idx); |
| 2038 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 2039 | AC_VERB_GET_PROC_COEF, 0); |
| 2040 | return val; |
| 2041 | } |
| 2042 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 2043 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 2044 | unsigned int coef_val) |
| 2045 | { |
| 2046 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 2047 | coef_idx); |
| 2048 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 2049 | coef_val); |
| 2050 | } |
| 2051 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 2052 | /* set right pin controls for digital I/O */ |
| 2053 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 2054 | { |
| 2055 | struct alc_spec *spec = codec->spec; |
| 2056 | int i; |
| 2057 | hda_nid_t pin; |
| 2058 | |
| 2059 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 2060 | pin = spec->autocfg.dig_out_pins[i]; |
| 2061 | if (pin) { |
| 2062 | snd_hda_codec_write(codec, pin, 0, |
| 2063 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2064 | PIN_OUT); |
| 2065 | } |
| 2066 | } |
| 2067 | pin = spec->autocfg.dig_in_pin; |
| 2068 | if (pin) |
| 2069 | snd_hda_codec_write(codec, pin, 0, |
| 2070 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2071 | PIN_IN); |
| 2072 | } |
| 2073 | |
| 2074 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 2075 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 2076 | { |
| 2077 | struct alc_spec *spec = codec->spec; |
| 2078 | int i, err; |
| 2079 | hda_nid_t dig_nid; |
| 2080 | |
| 2081 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 2082 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 2083 | err = snd_hda_get_connections(codec, |
| 2084 | spec->autocfg.dig_out_pins[i], |
| 2085 | &dig_nid, 1); |
| 2086 | if (err < 0) |
| 2087 | continue; |
| 2088 | if (!i) { |
| 2089 | spec->multiout.dig_out_nid = dig_nid; |
| 2090 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 2091 | } else { |
| 2092 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 2093 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 2094 | break; |
| 2095 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 2096 | } |
| 2097 | } |
| 2098 | |
| 2099 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 2100 | dig_nid = codec->start_nid; |
| 2101 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 2102 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 2103 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 2104 | continue; |
| 2105 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 2106 | continue; |
| 2107 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 2108 | continue; |
| 2109 | err = get_connection_index(codec, dig_nid, |
| 2110 | spec->autocfg.dig_in_pin); |
| 2111 | if (err >= 0) { |
| 2112 | spec->dig_in_nid = dig_nid; |
| 2113 | break; |
| 2114 | } |
| 2115 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 2116 | } |
| 2117 | } |
| 2118 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 2119 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2120 | * ALC888 |
| 2121 | */ |
| 2122 | |
| 2123 | /* |
| 2124 | * 2ch mode |
| 2125 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2126 | static const struct hda_verb alc888_4ST_ch2_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2127 | /* Mic-in jack as mic in */ |
| 2128 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2129 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2130 | /* Line-in jack as Line in */ |
| 2131 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2132 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2133 | /* Line-Out as Front */ |
| 2134 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2135 | { } /* end */ |
| 2136 | }; |
| 2137 | |
| 2138 | /* |
| 2139 | * 4ch mode |
| 2140 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2141 | static const struct hda_verb alc888_4ST_ch4_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2142 | /* Mic-in jack as mic in */ |
| 2143 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2144 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2145 | /* Line-in jack as Surround */ |
| 2146 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2147 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2148 | /* Line-Out as Front */ |
| 2149 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2150 | { } /* end */ |
| 2151 | }; |
| 2152 | |
| 2153 | /* |
| 2154 | * 6ch mode |
| 2155 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2156 | static const struct hda_verb alc888_4ST_ch6_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2157 | /* Mic-in jack as CLFE */ |
| 2158 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2159 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2160 | /* Line-in jack as Surround */ |
| 2161 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2162 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2163 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 2164 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2165 | { } /* end */ |
| 2166 | }; |
| 2167 | |
| 2168 | /* |
| 2169 | * 8ch mode |
| 2170 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2171 | static const struct hda_verb alc888_4ST_ch8_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2172 | /* Mic-in jack as CLFE */ |
| 2173 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2174 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2175 | /* Line-in jack as Surround */ |
| 2176 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2177 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2178 | /* Line-Out as Side */ |
| 2179 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2180 | { } /* end */ |
| 2181 | }; |
| 2182 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2183 | static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2184 | { 2, alc888_4ST_ch2_intel_init }, |
| 2185 | { 4, alc888_4ST_ch4_intel_init }, |
| 2186 | { 6, alc888_4ST_ch6_intel_init }, |
| 2187 | { 8, alc888_4ST_ch8_intel_init }, |
| 2188 | }; |
| 2189 | |
| 2190 | /* |
| 2191 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 2192 | */ |
| 2193 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2194 | static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2195 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2196 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2197 | /* Connect Internal HP to Front */ |
| 2198 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2199 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2200 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2201 | /* Connect Bass HP to Front */ |
| 2202 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2204 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2205 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 2206 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2207 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2208 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2209 | /* Connect Mic jack to CLFE */ |
| 2210 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2211 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2212 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2213 | /* Connect Line-in jack to Surround */ |
| 2214 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2215 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2216 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2217 | /* Connect HP out jack to Front */ |
| 2218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2219 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2220 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2221 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2222 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2223 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2224 | {} |
| 2225 | }; |
| 2226 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2227 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2228 | { |
| 2229 | struct alc_spec *spec = codec->spec; |
| 2230 | |
| 2231 | spec->autocfg.hp_pins[0] = 0x15; |
| 2232 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2233 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2234 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2235 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2236 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2237 | spec->automute = 1; |
| 2238 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2239 | } |
| 2240 | |
| 2241 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2242 | { |
| 2243 | alc889_coef_init(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2244 | alc_hp_automute(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2245 | } |
| 2246 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2247 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2248 | { |
| 2249 | struct alc_spec *spec = codec->spec; |
| 2250 | |
| 2251 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2252 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2253 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2254 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2255 | spec->automute = 1; |
| 2256 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2257 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2258 | |
| 2259 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2260 | * ALC888 Acer Aspire 4930G model |
| 2261 | */ |
| 2262 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2263 | static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2264 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2265 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2266 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2268 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2269 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2270 | /* Connect Internal HP to front */ |
| 2271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2272 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2273 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2274 | /* Connect HP out to front */ |
| 2275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2276 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2277 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2278 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2279 | { } |
| 2280 | }; |
| 2281 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2282 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2283 | * ALC888 Acer Aspire 6530G model |
| 2284 | */ |
| 2285 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2286 | static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2287 | /* Route to built-in subwoofer as well as speakers */ |
| 2288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2290 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2291 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2292 | /* Bias voltage on for external mic port */ |
| 2293 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2294 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2295 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2296 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2297 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2298 | /* Enable unsolicited event for HP jack */ |
| 2299 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2300 | /* Enable speaker output */ |
| 2301 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2302 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2303 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2304 | /* Enable headphone output */ |
| 2305 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2306 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2307 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2308 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2309 | { } |
| 2310 | }; |
| 2311 | |
| 2312 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2313 | *ALC888 Acer Aspire 7730G model |
| 2314 | */ |
| 2315 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2316 | static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2317 | /* Bias voltage on for external mic port */ |
| 2318 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2319 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2320 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2321 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2322 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2323 | /* Enable unsolicited event for HP jack */ |
| 2324 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2325 | /* Enable speaker output */ |
| 2326 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2327 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2328 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2329 | /* Enable headphone output */ |
| 2330 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2331 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2332 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2333 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2334 | /*Enable internal subwoofer */ |
| 2335 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2336 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2337 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2338 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2339 | { } |
| 2340 | }; |
| 2341 | |
| 2342 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2343 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2344 | */ |
| 2345 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2346 | static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2347 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2348 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2349 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2350 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2351 | /* Enable unsolicited event for HP jack */ |
| 2352 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2353 | /* Connect Internal Front to Front */ |
| 2354 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2355 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2356 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2357 | /* Connect Internal Rear to Rear */ |
| 2358 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2359 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2360 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2361 | /* Connect Internal CLFE to CLFE */ |
| 2362 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2363 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2364 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2365 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2366 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2367 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2368 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2369 | /* Enable all DACs */ |
| 2370 | /* DAC DISABLE/MUTE 1? */ |
| 2371 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2372 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2373 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2374 | /* DAC DISABLE/MUTE 2? */ |
| 2375 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2376 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2377 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2378 | /* DMIC fix |
| 2379 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2380 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2381 | * makes the signal become a difference/sum signal instead of standard |
| 2382 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2383 | * codec replicate the sum signal to both channels, turning it into a |
| 2384 | * normal mono mic. |
| 2385 | */ |
| 2386 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2387 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2388 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2389 | { } |
| 2390 | }; |
| 2391 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2392 | static const struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2393 | /* Front mic only available on one ADC */ |
| 2394 | { |
| 2395 | .num_items = 4, |
| 2396 | .items = { |
| 2397 | { "Mic", 0x0 }, |
| 2398 | { "Line", 0x2 }, |
| 2399 | { "CD", 0x4 }, |
| 2400 | { "Front Mic", 0xb }, |
| 2401 | }, |
| 2402 | }, |
| 2403 | { |
| 2404 | .num_items = 3, |
| 2405 | .items = { |
| 2406 | { "Mic", 0x0 }, |
| 2407 | { "Line", 0x2 }, |
| 2408 | { "CD", 0x4 }, |
| 2409 | }, |
| 2410 | } |
| 2411 | }; |
| 2412 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2413 | static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2414 | /* Interal mic only available on one ADC */ |
| 2415 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2416 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2417 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2418 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2419 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2420 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2421 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2422 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2423 | }, |
| 2424 | }, |
| 2425 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2426 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2427 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2428 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2429 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2430 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2431 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2432 | }, |
| 2433 | } |
| 2434 | }; |
| 2435 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2436 | static const struct hda_input_mux alc889_capture_sources[3] = { |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2437 | /* Digital mic only available on first "ADC" */ |
| 2438 | { |
| 2439 | .num_items = 5, |
| 2440 | .items = { |
| 2441 | { "Mic", 0x0 }, |
| 2442 | { "Line", 0x2 }, |
| 2443 | { "CD", 0x4 }, |
| 2444 | { "Front Mic", 0xb }, |
| 2445 | { "Input Mix", 0xa }, |
| 2446 | }, |
| 2447 | }, |
| 2448 | { |
| 2449 | .num_items = 4, |
| 2450 | .items = { |
| 2451 | { "Mic", 0x0 }, |
| 2452 | { "Line", 0x2 }, |
| 2453 | { "CD", 0x4 }, |
| 2454 | { "Input Mix", 0xa }, |
| 2455 | }, |
| 2456 | }, |
| 2457 | { |
| 2458 | .num_items = 4, |
| 2459 | .items = { |
| 2460 | { "Mic", 0x0 }, |
| 2461 | { "Line", 0x2 }, |
| 2462 | { "CD", 0x4 }, |
| 2463 | { "Input Mix", 0xa }, |
| 2464 | }, |
| 2465 | } |
| 2466 | }; |
| 2467 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2468 | static const struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2469 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2470 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2471 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2472 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2473 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2474 | HDA_OUTPUT), |
| 2475 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2476 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2477 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2478 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2479 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2480 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2481 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2482 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2483 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2485 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2486 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2487 | { } /* end */ |
| 2488 | }; |
| 2489 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2490 | static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2491 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2492 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2493 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2494 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2495 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2496 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2497 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2498 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2499 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2500 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2501 | HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2502 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2503 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2505 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2507 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2508 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2509 | { } /* end */ |
| 2510 | }; |
| 2511 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2512 | static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2513 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2514 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2515 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2516 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2517 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2518 | HDA_OUTPUT), |
| 2519 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2520 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2521 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2522 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2523 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2525 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2526 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2527 | { } /* end */ |
| 2528 | }; |
| 2529 | |
| 2530 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2531 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2532 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2533 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2534 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2535 | spec->autocfg.hp_pins[0] = 0x15; |
| 2536 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2537 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2538 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2539 | spec->automute = 1; |
| 2540 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2541 | } |
| 2542 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2543 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2544 | { |
| 2545 | struct alc_spec *spec = codec->spec; |
| 2546 | |
| 2547 | spec->autocfg.hp_pins[0] = 0x15; |
| 2548 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2549 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2550 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2551 | spec->automute = 1; |
| 2552 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2553 | } |
| 2554 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2555 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2556 | { |
| 2557 | struct alc_spec *spec = codec->spec; |
| 2558 | |
| 2559 | spec->autocfg.hp_pins[0] = 0x15; |
| 2560 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2561 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2562 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2563 | spec->automute = 1; |
| 2564 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2565 | } |
| 2566 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2567 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2568 | { |
| 2569 | struct alc_spec *spec = codec->spec; |
| 2570 | |
| 2571 | spec->autocfg.hp_pins[0] = 0x15; |
| 2572 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2573 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2574 | spec->autocfg.speaker_pins[2] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2575 | spec->automute = 1; |
| 2576 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2577 | } |
| 2578 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2579 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2580 | * ALC880 3-stack model |
| 2581 | * |
| 2582 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2583 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2584 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2585 | */ |
| 2586 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2587 | static const hda_nid_t alc880_dac_nids[4] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2588 | /* front, rear, clfe, rear_surr */ |
| 2589 | 0x02, 0x05, 0x04, 0x03 |
| 2590 | }; |
| 2591 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2592 | static const hda_nid_t alc880_adc_nids[3] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2593 | /* ADC0-2 */ |
| 2594 | 0x07, 0x08, 0x09, |
| 2595 | }; |
| 2596 | |
| 2597 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2598 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2599 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2600 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2601 | static const hda_nid_t alc880_adc_nids_alt[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2602 | /* ADC1-2 */ |
| 2603 | 0x08, 0x09, |
| 2604 | }; |
| 2605 | |
| 2606 | #define ALC880_DIGOUT_NID 0x06 |
| 2607 | #define ALC880_DIGIN_NID 0x0a |
| 2608 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2609 | static const struct hda_input_mux alc880_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2610 | .num_items = 4, |
| 2611 | .items = { |
| 2612 | { "Mic", 0x0 }, |
| 2613 | { "Front Mic", 0x3 }, |
| 2614 | { "Line", 0x2 }, |
| 2615 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2616 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2617 | }; |
| 2618 | |
| 2619 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2620 | /* 2ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2621 | static const struct hda_verb alc880_threestack_ch2_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2622 | /* set line-in to input, mute it */ |
| 2623 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2624 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2625 | /* set mic-in to input vref 80%, mute it */ |
| 2626 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2627 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2628 | { } /* end */ |
| 2629 | }; |
| 2630 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2631 | /* 6ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2632 | static const struct hda_verb alc880_threestack_ch6_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2633 | /* set line-in to output, unmute it */ |
| 2634 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2635 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2636 | /* set mic-in to output, unmute it */ |
| 2637 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2638 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2639 | { } /* end */ |
| 2640 | }; |
| 2641 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2642 | static const struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2643 | { 2, alc880_threestack_ch2_init }, |
| 2644 | { 6, alc880_threestack_ch6_init }, |
| 2645 | }; |
| 2646 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2647 | static const struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2649 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2650 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2651 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2652 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2653 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2654 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2655 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2656 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2657 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2658 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2659 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2660 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2661 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2662 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2663 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2664 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2665 | { |
| 2666 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2667 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2668 | .info = alc_ch_mode_info, |
| 2669 | .get = alc_ch_mode_get, |
| 2670 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2671 | }, |
| 2672 | { } /* end */ |
| 2673 | }; |
| 2674 | |
| 2675 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2676 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2677 | struct snd_ctl_elem_info *uinfo) |
| 2678 | { |
| 2679 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2680 | struct alc_spec *spec = codec->spec; |
| 2681 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2682 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2683 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2684 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2685 | HDA_INPUT); |
| 2686 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2687 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2688 | return err; |
| 2689 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2690 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2691 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2692 | unsigned int size, unsigned int __user *tlv) |
| 2693 | { |
| 2694 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2695 | struct alc_spec *spec = codec->spec; |
| 2696 | int err; |
| 2697 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2698 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2699 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2700 | HDA_INPUT); |
| 2701 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2702 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2703 | return err; |
| 2704 | } |
| 2705 | |
| 2706 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2707 | struct snd_ctl_elem_value *ucontrol); |
| 2708 | |
| 2709 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2710 | struct snd_ctl_elem_value *ucontrol, |
| 2711 | getput_call_t func) |
| 2712 | { |
| 2713 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2714 | struct alc_spec *spec = codec->spec; |
| 2715 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2716 | int err; |
| 2717 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2718 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2719 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2720 | 3, 0, HDA_INPUT); |
| 2721 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2722 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2723 | return err; |
| 2724 | } |
| 2725 | |
| 2726 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2727 | struct snd_ctl_elem_value *ucontrol) |
| 2728 | { |
| 2729 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2730 | snd_hda_mixer_amp_volume_get); |
| 2731 | } |
| 2732 | |
| 2733 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2734 | struct snd_ctl_elem_value *ucontrol) |
| 2735 | { |
| 2736 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2737 | snd_hda_mixer_amp_volume_put); |
| 2738 | } |
| 2739 | |
| 2740 | /* capture mixer elements */ |
| 2741 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2742 | |
| 2743 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2744 | struct snd_ctl_elem_value *ucontrol) |
| 2745 | { |
| 2746 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2747 | snd_hda_mixer_amp_switch_get); |
| 2748 | } |
| 2749 | |
| 2750 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2751 | struct snd_ctl_elem_value *ucontrol) |
| 2752 | { |
| 2753 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2754 | snd_hda_mixer_amp_switch_put); |
| 2755 | } |
| 2756 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2757 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2758 | { \ |
| 2759 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2760 | .name = "Capture Switch", \ |
| 2761 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2762 | .count = num, \ |
| 2763 | .info = alc_cap_sw_info, \ |
| 2764 | .get = alc_cap_sw_get, \ |
| 2765 | .put = alc_cap_sw_put, \ |
| 2766 | }, \ |
| 2767 | { \ |
| 2768 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2769 | .name = "Capture Volume", \ |
| 2770 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2771 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2772 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2773 | .count = num, \ |
| 2774 | .info = alc_cap_vol_info, \ |
| 2775 | .get = alc_cap_vol_get, \ |
| 2776 | .put = alc_cap_vol_put, \ |
| 2777 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2778 | } |
| 2779 | |
| 2780 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2781 | { \ |
| 2782 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2783 | /* .name = "Capture Source", */ \ |
| 2784 | .name = "Input Source", \ |
| 2785 | .count = num, \ |
| 2786 | .info = alc_mux_enum_info, \ |
| 2787 | .get = alc_mux_enum_get, \ |
| 2788 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2789 | } |
| 2790 | |
| 2791 | #define DEFINE_CAPMIX(num) \ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2792 | static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2793 | _DEFINE_CAPMIX(num), \ |
| 2794 | _DEFINE_CAPSRC(num), \ |
| 2795 | { } /* end */ \ |
| 2796 | } |
| 2797 | |
| 2798 | #define DEFINE_CAPMIX_NOSRC(num) \ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2799 | static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2800 | _DEFINE_CAPMIX(num), \ |
| 2801 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2802 | } |
| 2803 | |
| 2804 | /* up to three ADCs */ |
| 2805 | DEFINE_CAPMIX(1); |
| 2806 | DEFINE_CAPMIX(2); |
| 2807 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2808 | DEFINE_CAPMIX_NOSRC(1); |
| 2809 | DEFINE_CAPMIX_NOSRC(2); |
| 2810 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2811 | |
| 2812 | /* |
| 2813 | * ALC880 5-stack model |
| 2814 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2815 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2816 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2817 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2818 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2819 | */ |
| 2820 | |
| 2821 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2822 | static const struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2823 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2824 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2825 | { } /* end */ |
| 2826 | }; |
| 2827 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2828 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2829 | /* 6ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2830 | static const struct hda_verb alc880_fivestack_ch6_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2831 | /* set line-in to input, mute it */ |
| 2832 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2833 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2834 | { } /* end */ |
| 2835 | }; |
| 2836 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2837 | /* 8ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2838 | static const struct hda_verb alc880_fivestack_ch8_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2839 | /* set line-in to output, unmute it */ |
| 2840 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2841 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2842 | { } /* end */ |
| 2843 | }; |
| 2844 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2845 | static const struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2846 | { 6, alc880_fivestack_ch6_init }, |
| 2847 | { 8, alc880_fivestack_ch8_init }, |
| 2848 | }; |
| 2849 | |
| 2850 | |
| 2851 | /* |
| 2852 | * ALC880 6-stack model |
| 2853 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2854 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2855 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2856 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2857 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2858 | */ |
| 2859 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2860 | static const hda_nid_t alc880_6st_dac_nids[4] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2861 | /* front, rear, clfe, rear_surr */ |
| 2862 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2863 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2864 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2865 | static const struct hda_input_mux alc880_6stack_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2866 | .num_items = 4, |
| 2867 | .items = { |
| 2868 | { "Mic", 0x0 }, |
| 2869 | { "Front Mic", 0x1 }, |
| 2870 | { "Line", 0x2 }, |
| 2871 | { "CD", 0x4 }, |
| 2872 | }, |
| 2873 | }; |
| 2874 | |
| 2875 | /* fixed 8-channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2876 | static const struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2877 | { 8, NULL }, |
| 2878 | }; |
| 2879 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2880 | static const struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2881 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2882 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2883 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2884 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2885 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2886 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2887 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2888 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2889 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2890 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2891 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2892 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2893 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2894 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2897 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2898 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2899 | { |
| 2900 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2901 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2902 | .info = alc_ch_mode_info, |
| 2903 | .get = alc_ch_mode_get, |
| 2904 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2905 | }, |
| 2906 | { } /* end */ |
| 2907 | }; |
| 2908 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2909 | |
| 2910 | /* |
| 2911 | * ALC880 W810 model |
| 2912 | * |
| 2913 | * W810 has rear IO for: |
| 2914 | * Front (DAC 02) |
| 2915 | * Surround (DAC 03) |
| 2916 | * Center/LFE (DAC 04) |
| 2917 | * Digital out (06) |
| 2918 | * |
| 2919 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2920 | * 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] | 2921 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2922 | * There is a variable resistor to control the speaker or headphone |
| 2923 | * volume. This is a hardware-only device without a software API. |
| 2924 | * |
| 2925 | * Plugging headphones in will disable the internal speakers. This is |
| 2926 | * implemented in hardware, not via the driver using jack sense. In |
| 2927 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2928 | * disable both the speakers and headphones. |
| 2929 | * |
| 2930 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2931 | * These may not do anything useful with this driver yet, because I |
| 2932 | * haven't setup any initialization verbs for these yet... |
| 2933 | */ |
| 2934 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2935 | static const hda_nid_t alc880_w810_dac_nids[3] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2936 | /* front, rear/surround, clfe */ |
| 2937 | 0x02, 0x03, 0x04 |
| 2938 | }; |
| 2939 | |
| 2940 | /* fixed 6 channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2941 | static const struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2942 | { 6, NULL } |
| 2943 | }; |
| 2944 | |
| 2945 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2946 | static const struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2947 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2948 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2949 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2950 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2951 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2952 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2953 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2954 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2955 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2956 | { } /* end */ |
| 2957 | }; |
| 2958 | |
| 2959 | |
| 2960 | /* |
| 2961 | * Z710V model |
| 2962 | * |
| 2963 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2964 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2965 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2966 | */ |
| 2967 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2968 | static const hda_nid_t alc880_z71v_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2969 | 0x02 |
| 2970 | }; |
| 2971 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2972 | |
| 2973 | /* fixed 2 channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2974 | static const struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2975 | { 2, NULL } |
| 2976 | }; |
| 2977 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2978 | static const struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2981 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2982 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2983 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2984 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2985 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2986 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2987 | { } /* end */ |
| 2988 | }; |
| 2989 | |
| 2990 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2991 | /* |
| 2992 | * ALC880 F1734 model |
| 2993 | * |
| 2994 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2995 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2996 | */ |
| 2997 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2998 | static const hda_nid_t alc880_f1734_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2999 | 0x03 |
| 3000 | }; |
| 3001 | #define ALC880_F1734_HP_DAC 0x02 |
| 3002 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3003 | static const struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3004 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3005 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3006 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3007 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3008 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3009 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3011 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3012 | { } /* end */ |
| 3013 | }; |
| 3014 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3015 | static const struct hda_input_mux alc880_f1734_capture_source = { |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3016 | .num_items = 2, |
| 3017 | .items = { |
| 3018 | { "Mic", 0x1 }, |
| 3019 | { "CD", 0x4 }, |
| 3020 | }, |
| 3021 | }; |
| 3022 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3023 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3024 | /* |
| 3025 | * ALC880 ASUS model |
| 3026 | * |
| 3027 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 3028 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 3029 | * Mic = 0x18, Line = 0x1a |
| 3030 | */ |
| 3031 | |
| 3032 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 3033 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 3034 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3035 | static const struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3036 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3037 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3038 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3039 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3040 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3041 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3042 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3043 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3044 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3045 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 3046 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3047 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 3048 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3049 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3050 | { |
| 3051 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3052 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3053 | .info = alc_ch_mode_info, |
| 3054 | .get = alc_ch_mode_get, |
| 3055 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3056 | }, |
| 3057 | { } /* end */ |
| 3058 | }; |
| 3059 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3060 | /* |
| 3061 | * ALC880 ASUS W1V model |
| 3062 | * |
| 3063 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 3064 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 3065 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 3066 | */ |
| 3067 | |
| 3068 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3069 | static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3070 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 3071 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3072 | { } /* end */ |
| 3073 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3074 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3075 | /* TCL S700 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3076 | static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3077 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3078 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 3079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 3080 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 3081 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 3082 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 3083 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 3084 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 3085 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3086 | { } /* end */ |
| 3087 | }; |
| 3088 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3089 | /* Uniwill */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3090 | static const struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3091 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3092 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3093 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3094 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3095 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3096 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3097 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3098 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3099 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3100 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 3101 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3102 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 3103 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3104 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3105 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3106 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3107 | { |
| 3108 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3109 | .name = "Channel Mode", |
| 3110 | .info = alc_ch_mode_info, |
| 3111 | .get = alc_ch_mode_get, |
| 3112 | .put = alc_ch_mode_put, |
| 3113 | }, |
| 3114 | { } /* end */ |
| 3115 | }; |
| 3116 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3117 | static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3118 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3119 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3120 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3121 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3122 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3123 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 3124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 3126 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3127 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3128 | { } /* end */ |
| 3129 | }; |
| 3130 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3131 | static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3132 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3133 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3134 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3135 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3136 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3138 | { } /* end */ |
| 3139 | }; |
| 3140 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3141 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3142 | * virtual master controls |
| 3143 | */ |
| 3144 | |
| 3145 | /* |
| 3146 | * slave controls for virtual master |
| 3147 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3148 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3149 | "Front Playback Volume", |
| 3150 | "Surround Playback Volume", |
| 3151 | "Center Playback Volume", |
| 3152 | "LFE Playback Volume", |
| 3153 | "Side Playback Volume", |
| 3154 | "Headphone Playback Volume", |
| 3155 | "Speaker Playback Volume", |
| 3156 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3157 | "Line-Out Playback Volume", |
| 3158 | NULL, |
| 3159 | }; |
| 3160 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3161 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3162 | "Front Playback Switch", |
| 3163 | "Surround Playback Switch", |
| 3164 | "Center Playback Switch", |
| 3165 | "LFE Playback Switch", |
| 3166 | "Side Playback Switch", |
| 3167 | "Headphone Playback Switch", |
| 3168 | "Speaker Playback Switch", |
| 3169 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 3170 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 3171 | "Line-Out Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3172 | NULL, |
| 3173 | }; |
| 3174 | |
| 3175 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3176 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3177 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3178 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3179 | #define NID_MAPPING (-1) |
| 3180 | |
| 3181 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 3182 | #define SUBDEV_HP_ (1 << 6) |
| 3183 | #define SUBDEV_LINE_ (2 << 6) |
| 3184 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 3185 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 3186 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 3187 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3188 | static void alc_free_kctls(struct hda_codec *codec); |
| 3189 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3190 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3191 | /* additional beep mixers; the actual parameters are overwritten at build */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3192 | static const struct snd_kcontrol_new alc_beep_mixer[] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3193 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3194 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3195 | { } /* end */ |
| 3196 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3197 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3198 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3199 | static int alc_build_controls(struct hda_codec *codec) |
| 3200 | { |
| 3201 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 3202 | struct snd_kcontrol *kctl = NULL; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3203 | const struct snd_kcontrol_new *knew; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3204 | int i, j, err; |
| 3205 | unsigned int u; |
| 3206 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3207 | |
| 3208 | for (i = 0; i < spec->num_mixers; i++) { |
| 3209 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3210 | if (err < 0) |
| 3211 | return err; |
| 3212 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3213 | if (spec->cap_mixer) { |
| 3214 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3215 | if (err < 0) |
| 3216 | return err; |
| 3217 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3218 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3219 | err = snd_hda_create_spdif_out_ctls(codec, |
| 3220 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3221 | if (err < 0) |
| 3222 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3223 | if (!spec->no_analog) { |
| 3224 | err = snd_hda_create_spdif_share_sw(codec, |
| 3225 | &spec->multiout); |
| 3226 | if (err < 0) |
| 3227 | return err; |
| 3228 | spec->multiout.share_spdif = 1; |
| 3229 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3230 | } |
| 3231 | if (spec->dig_in_nid) { |
| 3232 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 3233 | if (err < 0) |
| 3234 | return err; |
| 3235 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3236 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3237 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3238 | /* create beep controls if needed */ |
| 3239 | if (spec->beep_amp) { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3240 | const struct snd_kcontrol_new *knew; |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3241 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 3242 | struct snd_kcontrol *kctl; |
| 3243 | kctl = snd_ctl_new1(knew, codec); |
| 3244 | if (!kctl) |
| 3245 | return -ENOMEM; |
| 3246 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 3247 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3248 | if (err < 0) |
| 3249 | return err; |
| 3250 | } |
| 3251 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3252 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3253 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3254 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3255 | if (!spec->no_analog && |
| 3256 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3257 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3258 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3259 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3260 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 3261 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3262 | if (err < 0) |
| 3263 | return err; |
| 3264 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3265 | if (!spec->no_analog && |
| 3266 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3267 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 3268 | NULL, alc_slave_sws); |
| 3269 | if (err < 0) |
| 3270 | return err; |
| 3271 | } |
| 3272 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3273 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3274 | if (spec->capsrc_nids || spec->adc_nids) { |
| 3275 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 3276 | if (!kctl) |
| 3277 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 3278 | for (i = 0; kctl && i < kctl->count; i++) { |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3279 | const hda_nid_t *nids = spec->capsrc_nids; |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 3280 | if (!nids) |
| 3281 | nids = spec->adc_nids; |
| 3282 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 3283 | if (err < 0) |
| 3284 | return err; |
| 3285 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3286 | } |
| 3287 | if (spec->cap_mixer) { |
| 3288 | const char *kname = kctl ? kctl->id.name : NULL; |
| 3289 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 3290 | if (kname && strcmp(knew->name, kname) == 0) |
| 3291 | continue; |
| 3292 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3293 | for (i = 0; kctl && i < kctl->count; i++) { |
| 3294 | err = snd_hda_add_nid(codec, kctl, i, |
| 3295 | spec->adc_nids[i]); |
| 3296 | if (err < 0) |
| 3297 | return err; |
| 3298 | } |
| 3299 | } |
| 3300 | } |
| 3301 | |
| 3302 | /* other nid->control mapping */ |
| 3303 | for (i = 0; i < spec->num_mixers; i++) { |
| 3304 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 3305 | if (knew->iface != NID_MAPPING) |
| 3306 | continue; |
| 3307 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 3308 | if (kctl == NULL) |
| 3309 | continue; |
| 3310 | u = knew->subdevice; |
| 3311 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3312 | nid = u & 0x3f; |
| 3313 | if (nid == 0) |
| 3314 | continue; |
| 3315 | switch (u & 0xc0) { |
| 3316 | case SUBDEV_SPEAKER_: |
| 3317 | nid = spec->autocfg.speaker_pins[nid]; |
| 3318 | break; |
| 3319 | case SUBDEV_LINE_: |
| 3320 | nid = spec->autocfg.line_out_pins[nid]; |
| 3321 | break; |
| 3322 | case SUBDEV_HP_: |
| 3323 | nid = spec->autocfg.hp_pins[nid]; |
| 3324 | break; |
| 3325 | default: |
| 3326 | continue; |
| 3327 | } |
| 3328 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3329 | if (err < 0) |
| 3330 | return err; |
| 3331 | } |
| 3332 | u = knew->private_value; |
| 3333 | for (j = 0; j < 4; j++, u >>= 8) { |
| 3334 | nid = u & 0xff; |
| 3335 | if (nid == 0) |
| 3336 | continue; |
| 3337 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 3338 | if (err < 0) |
| 3339 | return err; |
| 3340 | } |
| 3341 | } |
| 3342 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 3343 | |
| 3344 | alc_free_kctls(codec); /* no longer needed */ |
| 3345 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3346 | return 0; |
| 3347 | } |
| 3348 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3349 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3350 | /* |
| 3351 | * initialize the codec volumes, etc |
| 3352 | */ |
| 3353 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3354 | /* |
| 3355 | * generic initialization of ADC, input mixers and output mixers |
| 3356 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3357 | static const struct hda_verb alc880_volume_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3358 | /* |
| 3359 | * Unmute ADC0-2 and set the default input to mic-in |
| 3360 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3361 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3363 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3364 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3365 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3367 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3368 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 3369 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3370 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 3371 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3372 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3373 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3374 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3375 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3376 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3377 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 3379 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3382 | /* |
| 3383 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3384 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3385 | /* set vol=0 to output mixers */ |
| 3386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3387 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3388 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3389 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3390 | /* set up input amps for analog loopback */ |
| 3391 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3393 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3395 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3396 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3397 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3398 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3400 | |
| 3401 | { } |
| 3402 | }; |
| 3403 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3404 | /* |
| 3405 | * 3-stack pin configuration: |
| 3406 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 3407 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3408 | static const struct hda_verb alc880_pin_3stack_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3409 | /* |
| 3410 | * preset connection lists of input pins |
| 3411 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3412 | */ |
| 3413 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3414 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3415 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3416 | |
| 3417 | /* |
| 3418 | * Set pin mode and muting |
| 3419 | */ |
| 3420 | /* set front pin widgets 0x14 for output */ |
| 3421 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3422 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3423 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3424 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3425 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3426 | /* Mic2 (as headphone out) for HP output */ |
| 3427 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3428 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3429 | /* Line In pin widget for input */ |
| 3430 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3431 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3432 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3433 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3434 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3435 | /* CD pin widget for input */ |
| 3436 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3437 | |
| 3438 | { } |
| 3439 | }; |
| 3440 | |
| 3441 | /* |
| 3442 | * 5-stack pin configuration: |
| 3443 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 3444 | * line-in/side = 0x1a, f-mic = 0x1b |
| 3445 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3446 | static const struct hda_verb alc880_pin_5stack_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | /* |
| 3448 | * preset connection lists of input pins |
| 3449 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 3450 | */ |
| 3451 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3452 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 3453 | |
| 3454 | /* |
| 3455 | * Set pin mode and muting |
| 3456 | */ |
| 3457 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3459 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3460 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3461 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3462 | /* unmute pins for output (no gain on this amp) */ |
| 3463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3464 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3465 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3466 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3468 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3469 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3470 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3471 | /* Mic2 (as headphone out) for HP output */ |
| 3472 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3473 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3474 | /* Line In pin widget for input */ |
| 3475 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3476 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3477 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 3478 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3479 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3480 | /* CD pin widget for input */ |
| 3481 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3482 | |
| 3483 | { } |
| 3484 | }; |
| 3485 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3486 | /* |
| 3487 | * W810 pin configuration: |
| 3488 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 3489 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3490 | static const struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3491 | /* hphone/speaker input selector: front DAC */ |
| 3492 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 3493 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3494 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3495 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3497 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3498 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3499 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3500 | |
| 3501 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3502 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3503 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3504 | { } |
| 3505 | }; |
| 3506 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3507 | /* |
| 3508 | * Z71V pin configuration: |
| 3509 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 3510 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3511 | static const struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3512 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3513 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3514 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3515 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3516 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3517 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3518 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3519 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3520 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 3521 | |
| 3522 | { } |
| 3523 | }; |
| 3524 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3525 | /* |
| 3526 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3527 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 3528 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3529 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3530 | static const struct hda_verb alc880_pin_6stack_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3531 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3532 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3533 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3534 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3536 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3537 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3538 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3539 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3540 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3541 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3542 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3543 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3544 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3545 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3546 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3547 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3548 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3549 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3550 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3551 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3552 | { } |
| 3553 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3554 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3555 | /* |
| 3556 | * Uniwill pin configuration: |
| 3557 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 3558 | * line = 0x1a |
| 3559 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3560 | static const struct hda_verb alc880_uniwill_init_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3561 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3562 | |
| 3563 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3564 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3565 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3566 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3567 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3568 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3569 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3570 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3571 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3572 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3573 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3574 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3575 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3576 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3577 | |
| 3578 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3579 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3580 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3581 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3582 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3583 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3584 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 3585 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 3586 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3587 | |
| 3588 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3589 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 3590 | |
| 3591 | { } |
| 3592 | }; |
| 3593 | |
| 3594 | /* |
| 3595 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3596 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3597 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3598 | static const struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3599 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3600 | |
| 3601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3603 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3605 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3606 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3608 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3609 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3610 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3612 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3613 | |
| 3614 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3615 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3616 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3617 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3618 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3619 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3620 | |
| 3621 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3622 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3623 | |
| 3624 | { } |
| 3625 | }; |
| 3626 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3627 | static const struct hda_verb alc880_beep_init_verbs[] = { |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3628 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3629 | { } |
| 3630 | }; |
| 3631 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3632 | /* auto-toggle front mic */ |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3633 | static void alc88x_simple_mic_automute(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3634 | { |
| 3635 | unsigned int present; |
| 3636 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3637 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3638 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3639 | bits = present ? HDA_AMP_MUTE : 0; |
| 3640 | 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] | 3641 | } |
| 3642 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3643 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3644 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3645 | struct alc_spec *spec = codec->spec; |
| 3646 | |
| 3647 | spec->autocfg.hp_pins[0] = 0x14; |
| 3648 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3649 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3650 | spec->automute = 1; |
| 3651 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3652 | } |
| 3653 | |
| 3654 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3655 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3656 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3657 | alc88x_simple_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3658 | } |
| 3659 | |
| 3660 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3661 | unsigned int res) |
| 3662 | { |
| 3663 | /* Looks like the unsol event is incompatible with the standard |
| 3664 | * definition. 4bit tag is placed at 28 bit! |
| 3665 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3666 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3667 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 3668 | alc88x_simple_mic_automute(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3669 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3670 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3671 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3672 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3673 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3674 | } |
| 3675 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3676 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3677 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3678 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3679 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3680 | spec->autocfg.hp_pins[0] = 0x14; |
| 3681 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3682 | spec->automute = 1; |
| 3683 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3684 | } |
| 3685 | |
| 3686 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3687 | { |
| 3688 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3689 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3690 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3691 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3692 | present &= HDA_AMP_VOLMASK; |
| 3693 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3694 | HDA_AMP_VOLMASK, present); |
| 3695 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3696 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3697 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3698 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3699 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3700 | unsigned int res) |
| 3701 | { |
| 3702 | /* Looks like the unsol event is incompatible with the standard |
| 3703 | * definition. 4bit tag is placed at 28 bit! |
| 3704 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3705 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3706 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3707 | else |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3708 | alc_sku_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3709 | } |
| 3710 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3711 | /* |
| 3712 | * F1734 pin configuration: |
| 3713 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3714 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3715 | static const struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3716 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3717 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3718 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3719 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3720 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3721 | |
| 3722 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3723 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3724 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3725 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3726 | |
| 3727 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3728 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3729 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3730 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3731 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3732 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3733 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3734 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3735 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3736 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3737 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3738 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3739 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3740 | { } |
| 3741 | }; |
| 3742 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3743 | /* |
| 3744 | * ASUS pin configuration: |
| 3745 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3746 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3747 | static const struct hda_verb alc880_pin_asus_init_verbs[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3748 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3749 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3750 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3751 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3752 | |
| 3753 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3754 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3756 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3757 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3759 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3761 | |
| 3762 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3763 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3764 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3765 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3766 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3770 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3771 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3772 | { } |
| 3773 | }; |
| 3774 | |
| 3775 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3776 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3777 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3778 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3779 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3780 | /* Clevo m520g init */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3781 | static const struct hda_verb alc880_pin_clevo_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3782 | /* headphone output */ |
| 3783 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3784 | /* line-out */ |
| 3785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3786 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3787 | /* Line-in */ |
| 3788 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3789 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3790 | /* CD */ |
| 3791 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3792 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3793 | /* Mic1 (rear panel) */ |
| 3794 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3795 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3796 | /* Mic2 (front panel) */ |
| 3797 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3798 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3799 | /* headphone */ |
| 3800 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3802 | /* change to EAPD mode */ |
| 3803 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3804 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3805 | |
| 3806 | { } |
| 3807 | }; |
| 3808 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3809 | static const struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3810 | /* change to EAPD mode */ |
| 3811 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3812 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3813 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3814 | /* Headphone output */ |
| 3815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3816 | /* Front output*/ |
| 3817 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3818 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3819 | |
| 3820 | /* Line In pin widget for input */ |
| 3821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3822 | /* CD pin widget for input */ |
| 3823 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3824 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3825 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3826 | |
| 3827 | /* change to EAPD mode */ |
| 3828 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3829 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3830 | |
| 3831 | { } |
| 3832 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3833 | |
| 3834 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3835 | * LG m1 express dual |
| 3836 | * |
| 3837 | * Pin assignment: |
| 3838 | * Rear Line-In/Out (blue): 0x14 |
| 3839 | * Build-in Mic-In: 0x15 |
| 3840 | * Speaker-out: 0x17 |
| 3841 | * HP-Out (green): 0x1b |
| 3842 | * Mic-In/Out (red): 0x19 |
| 3843 | * SPDIF-Out: 0x1e |
| 3844 | */ |
| 3845 | |
| 3846 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3847 | static const hda_nid_t alc880_lg_dac_nids[3] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3848 | 0x05, 0x02, 0x03 |
| 3849 | }; |
| 3850 | |
| 3851 | /* seems analog CD is not working */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3852 | static const struct hda_input_mux alc880_lg_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3853 | .num_items = 3, |
| 3854 | .items = { |
| 3855 | { "Mic", 0x1 }, |
| 3856 | { "Line", 0x5 }, |
| 3857 | { "Internal Mic", 0x6 }, |
| 3858 | }, |
| 3859 | }; |
| 3860 | |
| 3861 | /* 2,4,6 channel modes */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3862 | static const struct hda_verb alc880_lg_ch2_init[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3863 | /* set line-in and mic-in to input */ |
| 3864 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3865 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3866 | { } |
| 3867 | }; |
| 3868 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3869 | static const struct hda_verb alc880_lg_ch4_init[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3870 | /* set line-in to out and mic-in to input */ |
| 3871 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3872 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3873 | { } |
| 3874 | }; |
| 3875 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3876 | static const struct hda_verb alc880_lg_ch6_init[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3877 | /* set line-in and mic-in to output */ |
| 3878 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3879 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3880 | { } |
| 3881 | }; |
| 3882 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3883 | static const struct hda_channel_mode alc880_lg_ch_modes[3] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3884 | { 2, alc880_lg_ch2_init }, |
| 3885 | { 4, alc880_lg_ch4_init }, |
| 3886 | { 6, alc880_lg_ch6_init }, |
| 3887 | }; |
| 3888 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3889 | static const struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3890 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3891 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3892 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3893 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3894 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3895 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3896 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3897 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3900 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3901 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3902 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3903 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3904 | { |
| 3905 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3906 | .name = "Channel Mode", |
| 3907 | .info = alc_ch_mode_info, |
| 3908 | .get = alc_ch_mode_get, |
| 3909 | .put = alc_ch_mode_put, |
| 3910 | }, |
| 3911 | { } /* end */ |
| 3912 | }; |
| 3913 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3914 | static const struct hda_verb alc880_lg_init_verbs[] = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3915 | /* set capture source to mic-in */ |
| 3916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3917 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3918 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3919 | /* mute all amp mixer inputs */ |
| 3920 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3921 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3922 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3923 | /* line-in to input */ |
| 3924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3925 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3926 | /* built-in mic */ |
| 3927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3929 | /* speaker-out */ |
| 3930 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3931 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3932 | /* mic-in to input */ |
| 3933 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3935 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3936 | /* HP-out */ |
| 3937 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3939 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3940 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3941 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3942 | { } |
| 3943 | }; |
| 3944 | |
| 3945 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3946 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3947 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3948 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3949 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3950 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3951 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 3952 | spec->automute = 1; |
| 3953 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3954 | } |
| 3955 | |
| 3956 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3957 | * LG LW20 |
| 3958 | * |
| 3959 | * Pin assignment: |
| 3960 | * Speaker-out: 0x14 |
| 3961 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3962 | * Built-in Mic-In: 0x19 |
| 3963 | * Line-In: 0x1b |
| 3964 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3965 | * SPDIF-Out: 0x1e |
| 3966 | */ |
| 3967 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3968 | static const struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3969 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3970 | .items = { |
| 3971 | { "Mic", 0x0 }, |
| 3972 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3973 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3974 | }, |
| 3975 | }; |
| 3976 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3977 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3978 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3979 | static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3981 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3982 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3983 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3984 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3985 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3986 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3987 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3988 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3989 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3992 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3993 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3994 | { |
| 3995 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3996 | .name = "Channel Mode", |
| 3997 | .info = alc_ch_mode_info, |
| 3998 | .get = alc_ch_mode_get, |
| 3999 | .put = alc_ch_mode_put, |
| 4000 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4001 | { } /* end */ |
| 4002 | }; |
| 4003 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4004 | static const struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4005 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 4006 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 4007 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 4008 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4009 | /* set capture source to mic-in */ |
| 4010 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4011 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4012 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4014 | /* speaker-out */ |
| 4015 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4016 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4017 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4018 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4019 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4020 | /* mic-in to input */ |
| 4021 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4022 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4023 | /* built-in mic */ |
| 4024 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4025 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4026 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4027 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4028 | { } |
| 4029 | }; |
| 4030 | |
| 4031 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4032 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4033 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4034 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4035 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4036 | spec->autocfg.hp_pins[0] = 0x1b; |
| 4037 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4038 | spec->automute = 1; |
| 4039 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4040 | } |
| 4041 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4042 | static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4043 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4044 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4047 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4048 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4049 | { } /* end */ |
| 4050 | }; |
| 4051 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4052 | static const struct hda_input_mux alc880_medion_rim_capture_source = { |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4053 | .num_items = 2, |
| 4054 | .items = { |
| 4055 | { "Mic", 0x0 }, |
| 4056 | { "Internal Mic", 0x1 }, |
| 4057 | }, |
| 4058 | }; |
| 4059 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4060 | static const struct hda_verb alc880_medion_rim_init_verbs[] = { |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4061 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 4062 | |
| 4063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4064 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4065 | |
| 4066 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4067 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4068 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4069 | /* Mic2 (as headphone out) for HP output */ |
| 4070 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4071 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4072 | /* Internal Speaker */ |
| 4073 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4074 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4075 | |
| 4076 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4077 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 4078 | |
| 4079 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4080 | { } |
| 4081 | }; |
| 4082 | |
| 4083 | /* toggle speaker-output according to the hp-jack state */ |
| 4084 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 4085 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4086 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4087 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4088 | /* toggle EAPD */ |
| 4089 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4090 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 4091 | else |
| 4092 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 4093 | } |
| 4094 | |
| 4095 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 4096 | unsigned int res) |
| 4097 | { |
| 4098 | /* Looks like the unsol event is incompatible with the standard |
| 4099 | * definition. 4bit tag is placed at 28 bit! |
| 4100 | */ |
| 4101 | if ((res >> 28) == ALC880_HP_EVENT) |
| 4102 | alc880_medion_rim_automute(codec); |
| 4103 | } |
| 4104 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4105 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4106 | { |
| 4107 | struct alc_spec *spec = codec->spec; |
| 4108 | |
| 4109 | spec->autocfg.hp_pins[0] = 0x14; |
| 4110 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 4111 | spec->automute = 1; |
| 4112 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4113 | } |
| 4114 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4115 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4116 | static const struct hda_amp_list alc880_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4117 | { 0x0b, HDA_INPUT, 0 }, |
| 4118 | { 0x0b, HDA_INPUT, 1 }, |
| 4119 | { 0x0b, HDA_INPUT, 2 }, |
| 4120 | { 0x0b, HDA_INPUT, 3 }, |
| 4121 | { 0x0b, HDA_INPUT, 4 }, |
| 4122 | { } /* end */ |
| 4123 | }; |
| 4124 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4125 | static const struct hda_amp_list alc880_lg_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4126 | { 0x0b, HDA_INPUT, 1 }, |
| 4127 | { 0x0b, HDA_INPUT, 6 }, |
| 4128 | { 0x0b, HDA_INPUT, 7 }, |
| 4129 | { } /* end */ |
| 4130 | }; |
| 4131 | #endif |
| 4132 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4133 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4134 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4135 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4136 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 4137 | static void alc_init_special_input_src(struct hda_codec *codec); |
| 4138 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4139 | static int alc_init(struct hda_codec *codec) |
| 4140 | { |
| 4141 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4142 | unsigned int i; |
| 4143 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 4144 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4145 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 4146 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4147 | for (i = 0; i < spec->num_init_verbs; i++) |
| 4148 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 4149 | alc_init_special_input_src(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4150 | |
| 4151 | if (spec->init_hook) |
| 4152 | spec->init_hook(codec); |
| 4153 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 4154 | alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); |
| 4155 | |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4156 | hda_call_check_power_status(codec, 0x01); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4157 | return 0; |
| 4158 | } |
| 4159 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4160 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4161 | { |
| 4162 | struct alc_spec *spec = codec->spec; |
| 4163 | |
| 4164 | if (spec->unsol_event) |
| 4165 | spec->unsol_event(codec, res); |
| 4166 | } |
| 4167 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4168 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4169 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 4170 | { |
| 4171 | struct alc_spec *spec = codec->spec; |
| 4172 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 4173 | } |
| 4174 | #endif |
| 4175 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4176 | /* |
| 4177 | * Analog playback callbacks |
| 4178 | */ |
| 4179 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4180 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4181 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4182 | { |
| 4183 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 4184 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 4185 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4186 | } |
| 4187 | |
| 4188 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4189 | struct hda_codec *codec, |
| 4190 | unsigned int stream_tag, |
| 4191 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4192 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4193 | { |
| 4194 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4195 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 4196 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4197 | } |
| 4198 | |
| 4199 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4200 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4201 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4202 | { |
| 4203 | struct alc_spec *spec = codec->spec; |
| 4204 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 4205 | } |
| 4206 | |
| 4207 | /* |
| 4208 | * Digital out |
| 4209 | */ |
| 4210 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 4211 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4212 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4213 | { |
| 4214 | struct alc_spec *spec = codec->spec; |
| 4215 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 4216 | } |
| 4217 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4218 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4219 | struct hda_codec *codec, |
| 4220 | unsigned int stream_tag, |
| 4221 | unsigned int format, |
| 4222 | struct snd_pcm_substream *substream) |
| 4223 | { |
| 4224 | struct alc_spec *spec = codec->spec; |
| 4225 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 4226 | stream_tag, format, substream); |
| 4227 | } |
| 4228 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4229 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4230 | struct hda_codec *codec, |
| 4231 | struct snd_pcm_substream *substream) |
| 4232 | { |
| 4233 | struct alc_spec *spec = codec->spec; |
| 4234 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 4235 | } |
| 4236 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4237 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 4238 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4239 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4240 | { |
| 4241 | struct alc_spec *spec = codec->spec; |
| 4242 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 4243 | } |
| 4244 | |
| 4245 | /* |
| 4246 | * Analog capture |
| 4247 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4248 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4249 | struct hda_codec *codec, |
| 4250 | unsigned int stream_tag, |
| 4251 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4252 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4253 | { |
| 4254 | struct alc_spec *spec = codec->spec; |
| 4255 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4256 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4257 | stream_tag, 0, format); |
| 4258 | return 0; |
| 4259 | } |
| 4260 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4261 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4262 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4263 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4264 | { |
| 4265 | struct alc_spec *spec = codec->spec; |
| 4266 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 4267 | snd_hda_codec_cleanup_stream(codec, |
| 4268 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4269 | return 0; |
| 4270 | } |
| 4271 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4272 | /* analog capture with dynamic dual-adc changes */ |
| 4273 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 4274 | struct hda_codec *codec, |
| 4275 | unsigned int stream_tag, |
| 4276 | unsigned int format, |
| 4277 | struct snd_pcm_substream *substream) |
| 4278 | { |
| 4279 | struct alc_spec *spec = codec->spec; |
| 4280 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 4281 | spec->cur_adc_stream_tag = stream_tag; |
| 4282 | spec->cur_adc_format = format; |
| 4283 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 4284 | return 0; |
| 4285 | } |
| 4286 | |
| 4287 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 4288 | struct hda_codec *codec, |
| 4289 | struct snd_pcm_substream *substream) |
| 4290 | { |
| 4291 | struct alc_spec *spec = codec->spec; |
| 4292 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 4293 | spec->cur_adc = 0; |
| 4294 | return 0; |
| 4295 | } |
| 4296 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4297 | static const struct hda_pcm_stream dualmic_pcm_analog_capture = { |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 4298 | .substreams = 1, |
| 4299 | .channels_min = 2, |
| 4300 | .channels_max = 2, |
| 4301 | .nid = 0, /* fill later */ |
| 4302 | .ops = { |
| 4303 | .prepare = dualmic_capture_pcm_prepare, |
| 4304 | .cleanup = dualmic_capture_pcm_cleanup |
| 4305 | }, |
| 4306 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4307 | |
| 4308 | /* |
| 4309 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4310 | static const struct hda_pcm_stream alc880_pcm_analog_playback = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4311 | .substreams = 1, |
| 4312 | .channels_min = 2, |
| 4313 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4314 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4315 | .ops = { |
| 4316 | .open = alc880_playback_pcm_open, |
| 4317 | .prepare = alc880_playback_pcm_prepare, |
| 4318 | .cleanup = alc880_playback_pcm_cleanup |
| 4319 | }, |
| 4320 | }; |
| 4321 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4322 | static const struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4323 | .substreams = 1, |
| 4324 | .channels_min = 2, |
| 4325 | .channels_max = 2, |
| 4326 | /* NID is set in alc_build_pcms */ |
| 4327 | }; |
| 4328 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4329 | static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4330 | .substreams = 1, |
| 4331 | .channels_min = 2, |
| 4332 | .channels_max = 2, |
| 4333 | /* NID is set in alc_build_pcms */ |
| 4334 | }; |
| 4335 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4336 | static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4337 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4338 | .channels_min = 2, |
| 4339 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4340 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4341 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4342 | .prepare = alc880_alt_capture_pcm_prepare, |
| 4343 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4344 | }, |
| 4345 | }; |
| 4346 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4347 | static const struct hda_pcm_stream alc880_pcm_digital_playback = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4348 | .substreams = 1, |
| 4349 | .channels_min = 2, |
| 4350 | .channels_max = 2, |
| 4351 | /* NID is set in alc_build_pcms */ |
| 4352 | .ops = { |
| 4353 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 4354 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 4355 | .prepare = alc880_dig_playback_pcm_prepare, |
| 4356 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4357 | }, |
| 4358 | }; |
| 4359 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4360 | static const struct hda_pcm_stream alc880_pcm_digital_capture = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4361 | .substreams = 1, |
| 4362 | .channels_min = 2, |
| 4363 | .channels_max = 2, |
| 4364 | /* NID is set in alc_build_pcms */ |
| 4365 | }; |
| 4366 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4367 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4368 | static const struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4369 | .substreams = 0, |
| 4370 | .channels_min = 0, |
| 4371 | .channels_max = 0, |
| 4372 | }; |
| 4373 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4374 | static int alc_build_pcms(struct hda_codec *codec) |
| 4375 | { |
| 4376 | struct alc_spec *spec = codec->spec; |
| 4377 | struct hda_pcm *info = spec->pcm_rec; |
| 4378 | int i; |
| 4379 | |
| 4380 | codec->num_pcms = 1; |
| 4381 | codec->pcm_info = info; |
| 4382 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4383 | if (spec->no_analog) |
| 4384 | goto skip_analog; |
| 4385 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4386 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 4387 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4388 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 4389 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4390 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4391 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 4392 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4393 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 4394 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 4395 | } |
| 4396 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 4397 | if (snd_BUG_ON(!spec->adc_nids)) |
| 4398 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4399 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 4400 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 4401 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4402 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4403 | if (spec->channel_mode) { |
| 4404 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 4405 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 4406 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 4407 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 4408 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4409 | } |
| 4410 | } |
| 4411 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4412 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4413 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4414 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 4415 | snprintf(spec->stream_name_digital, |
| 4416 | sizeof(spec->stream_name_digital), |
| 4417 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4418 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 4419 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4420 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4421 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 4422 | if (spec->dig_out_type) |
| 4423 | info->pcm_type = spec->dig_out_type; |
| 4424 | else |
| 4425 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4426 | if (spec->multiout.dig_out_nid && |
| 4427 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4428 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 4429 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 4430 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4431 | if (spec->dig_in_nid && |
| 4432 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4433 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 4434 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 4435 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 4436 | /* FIXME: do we need this for all Realtek codec models? */ |
| 4437 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4438 | } |
| 4439 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 4440 | if (spec->no_analog) |
| 4441 | return 0; |
| 4442 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4443 | /* If the use of more than one ADC is requested for the current |
| 4444 | * model, configure a second analog capture-only PCM. |
| 4445 | */ |
| 4446 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4447 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 4448 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4449 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 4450 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4451 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4452 | if (spec->alt_dac_nid) { |
| 4453 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4454 | *spec->stream_analog_alt_playback; |
| 4455 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 4456 | spec->alt_dac_nid; |
| 4457 | } else { |
| 4458 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 4459 | alc_pcm_null_stream; |
| 4460 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 4461 | } |
Raymond Yau | ce85c9a | 2011-05-03 13:33:53 +0800 | [diff] [blame] | 4462 | if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4463 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4464 | *spec->stream_analog_alt_capture; |
| 4465 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 4466 | spec->adc_nids[1]; |
| 4467 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 4468 | spec->num_adc_nids - 1; |
| 4469 | } else { |
| 4470 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 4471 | alc_pcm_null_stream; |
| 4472 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 4473 | } |
| 4474 | } |
| 4475 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4476 | return 0; |
| 4477 | } |
| 4478 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4479 | static inline void alc_shutup(struct hda_codec *codec) |
| 4480 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4481 | struct alc_spec *spec = codec->spec; |
| 4482 | |
| 4483 | if (spec && spec->shutup) |
| 4484 | spec->shutup(codec); |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4485 | snd_hda_shutup_pins(codec); |
| 4486 | } |
| 4487 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4488 | static void alc_free_kctls(struct hda_codec *codec) |
| 4489 | { |
| 4490 | struct alc_spec *spec = codec->spec; |
| 4491 | |
| 4492 | if (spec->kctls.list) { |
| 4493 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4494 | int i; |
| 4495 | for (i = 0; i < spec->kctls.used; i++) |
| 4496 | kfree(kctl[i].name); |
| 4497 | } |
| 4498 | snd_array_free(&spec->kctls); |
| 4499 | } |
| 4500 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4501 | static void alc_free(struct hda_codec *codec) |
| 4502 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4503 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4504 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4505 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4506 | return; |
| 4507 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4508 | alc_shutup(codec); |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 4509 | snd_hda_input_jack_free(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4510 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4511 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4512 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4513 | } |
| 4514 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4515 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4516 | static void alc_power_eapd(struct hda_codec *codec) |
| 4517 | { |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 4518 | alc_auto_setup_eapd(codec, false); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4519 | } |
| 4520 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4521 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 4522 | { |
| 4523 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 4524 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4525 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4526 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4527 | return 0; |
| 4528 | } |
| 4529 | #endif |
| 4530 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4531 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4532 | static int alc_resume(struct hda_codec *codec) |
| 4533 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 4534 | msleep(150); /* to avoid pop noise */ |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4535 | codec->patch_ops.init(codec); |
| 4536 | snd_hda_codec_resume_amp(codec); |
| 4537 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 4538 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4539 | return 0; |
| 4540 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4541 | #endif |
| 4542 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4543 | /* |
| 4544 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4545 | static const struct hda_codec_ops alc_patch_ops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4546 | .build_controls = alc_build_controls, |
| 4547 | .build_pcms = alc_build_pcms, |
| 4548 | .init = alc_init, |
| 4549 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4550 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 4551 | #ifdef SND_HDA_NEEDS_RESUME |
| 4552 | .resume = alc_resume, |
| 4553 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4554 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 4555 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4556 | .check_power_status = alc_check_power_status, |
| 4557 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 4558 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4559 | }; |
| 4560 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 4561 | /* replace the codec chip_name with the given string */ |
| 4562 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 4563 | { |
| 4564 | kfree(codec->chip_name); |
| 4565 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 4566 | if (!codec->chip_name) { |
| 4567 | alc_free(codec); |
| 4568 | return -ENOMEM; |
| 4569 | } |
| 4570 | return 0; |
| 4571 | } |
| 4572 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4573 | /* |
| 4574 | * Test configuration for debugging |
| 4575 | * |
| 4576 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 4577 | * enum controls. |
| 4578 | */ |
| 4579 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4580 | static const hda_nid_t alc880_test_dac_nids[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4581 | 0x02, 0x03, 0x04, 0x05 |
| 4582 | }; |
| 4583 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4584 | static const struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4585 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4586 | .items = { |
| 4587 | { "In-1", 0x0 }, |
| 4588 | { "In-2", 0x1 }, |
| 4589 | { "In-3", 0x2 }, |
| 4590 | { "In-4", 0x3 }, |
| 4591 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4592 | { "Front", 0x5 }, |
| 4593 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4594 | }, |
| 4595 | }; |
| 4596 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4597 | static const struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4598 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4599 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4600 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 4601 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4602 | }; |
| 4603 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4604 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4605 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4606 | { |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4607 | static const char * const texts[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4608 | "N/A", "Line Out", "HP Out", |
| 4609 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4610 | }; |
| 4611 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4612 | uinfo->count = 1; |
| 4613 | uinfo->value.enumerated.items = 8; |
| 4614 | if (uinfo->value.enumerated.item >= 8) |
| 4615 | uinfo->value.enumerated.item = 7; |
| 4616 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4617 | return 0; |
| 4618 | } |
| 4619 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4620 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4621 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4622 | { |
| 4623 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4624 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4625 | unsigned int pin_ctl, item = 0; |
| 4626 | |
| 4627 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4628 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4629 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4630 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4631 | item = 2; |
| 4632 | else |
| 4633 | item = 1; |
| 4634 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4635 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4636 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4637 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4638 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4639 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4640 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4641 | } |
| 4642 | } |
| 4643 | ucontrol->value.enumerated.item[0] = item; |
| 4644 | return 0; |
| 4645 | } |
| 4646 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4647 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4648 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4649 | { |
| 4650 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4651 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4652 | static const unsigned int ctls[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4653 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4654 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4655 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4656 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4657 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4658 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4659 | }; |
| 4660 | unsigned int old_ctl, new_ctl; |
| 4661 | |
| 4662 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4663 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4664 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4665 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4666 | int val; |
| 4667 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4668 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4669 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4670 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4671 | HDA_AMP_MUTE : 0; |
| 4672 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4673 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4674 | return 1; |
| 4675 | } |
| 4676 | return 0; |
| 4677 | } |
| 4678 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4679 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4680 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4681 | { |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4682 | static const char * const texts[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4683 | "Front", "Surround", "CLFE", "Side" |
| 4684 | }; |
| 4685 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4686 | uinfo->count = 1; |
| 4687 | uinfo->value.enumerated.items = 4; |
| 4688 | if (uinfo->value.enumerated.item >= 4) |
| 4689 | uinfo->value.enumerated.item = 3; |
| 4690 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4691 | return 0; |
| 4692 | } |
| 4693 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4694 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4695 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4696 | { |
| 4697 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4698 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4699 | unsigned int sel; |
| 4700 | |
| 4701 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4702 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4703 | return 0; |
| 4704 | } |
| 4705 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4706 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4707 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4708 | { |
| 4709 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4710 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4711 | unsigned int sel; |
| 4712 | |
| 4713 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4714 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4715 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4716 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4717 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4718 | return 1; |
| 4719 | } |
| 4720 | return 0; |
| 4721 | } |
| 4722 | |
| 4723 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4724 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4725 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4726 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4727 | .info = alc_test_pin_ctl_info, \ |
| 4728 | .get = alc_test_pin_ctl_get, \ |
| 4729 | .put = alc_test_pin_ctl_put, \ |
| 4730 | .private_value = nid \ |
| 4731 | } |
| 4732 | |
| 4733 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4734 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4735 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4736 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4737 | .info = alc_test_pin_src_info, \ |
| 4738 | .get = alc_test_pin_src_get, \ |
| 4739 | .put = alc_test_pin_src_put, \ |
| 4740 | .private_value = nid \ |
| 4741 | } |
| 4742 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4743 | static const struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4744 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4745 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4746 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4747 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4748 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4749 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4750 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4751 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4752 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4753 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4754 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4755 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4756 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4757 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4758 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4759 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4760 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4761 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4762 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4763 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4764 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4765 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4766 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4767 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4768 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4769 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4770 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4771 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4772 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4773 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4774 | { |
| 4775 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4776 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4777 | .info = alc_ch_mode_info, |
| 4778 | .get = alc_ch_mode_get, |
| 4779 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4780 | }, |
| 4781 | { } /* end */ |
| 4782 | }; |
| 4783 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4784 | static const struct hda_verb alc880_test_init_verbs[] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4785 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4788 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4789 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4791 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4792 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4793 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4794 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4795 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4796 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4797 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4798 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4799 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4800 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4801 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4802 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4803 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4804 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4805 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4806 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4807 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4808 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4809 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4810 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4811 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4812 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4813 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4814 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4815 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4817 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4818 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4819 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4820 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4821 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4822 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4824 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4826 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4827 | /* Analog input/passthru */ |
| 4828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4829 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4830 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4833 | { } |
| 4834 | }; |
| 4835 | #endif |
| 4836 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4837 | /* |
| 4838 | */ |
| 4839 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 4840 | static const char * const alc880_models[ALC880_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4841 | [ALC880_3ST] = "3stack", |
| 4842 | [ALC880_TCL_S700] = "tcl", |
| 4843 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4844 | [ALC880_CLEVO] = "clevo", |
| 4845 | [ALC880_5ST] = "5stack", |
| 4846 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4847 | [ALC880_W810] = "w810", |
| 4848 | [ALC880_Z71V] = "z71v", |
| 4849 | [ALC880_6ST] = "6stack", |
| 4850 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4851 | [ALC880_ASUS] = "asus", |
| 4852 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4853 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4854 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4855 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4856 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4857 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4858 | [ALC880_F1734] = "F1734", |
| 4859 | [ALC880_LG] = "lg", |
| 4860 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4861 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4862 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4863 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4864 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4865 | [ALC880_AUTO] = "auto", |
| 4866 | }; |
| 4867 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4868 | static const struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4869 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4870 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4871 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4872 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4873 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4874 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4875 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4876 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4877 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4878 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4879 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4880 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4881 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4882 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4883 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4884 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4885 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4886 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4887 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4888 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4889 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4890 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4891 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4892 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4893 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4894 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4895 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4896 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4897 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4898 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4899 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4900 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4901 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4902 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4903 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4904 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4905 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4906 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4907 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4908 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Justin P. Mattock | a2e2bc2 | 2011-02-24 22:16:02 -0800 | [diff] [blame] | 4909 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4910 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4911 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4912 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4913 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4914 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4915 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4916 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4917 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4918 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4919 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4920 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4921 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4922 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4923 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4924 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4925 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4926 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4927 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4928 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4929 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4930 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4931 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4932 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4933 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4934 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4935 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4936 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4937 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4938 | /* default Intel */ |
| 4939 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4940 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4941 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4942 | {} |
| 4943 | }; |
| 4944 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4945 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4947 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4948 | static const struct alc_config_preset alc880_presets[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4949 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4950 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4951 | .init_verbs = { alc880_volume_init_verbs, |
| 4952 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4953 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4954 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4955 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4956 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4957 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4958 | .input_mux = &alc880_capture_source, |
| 4959 | }, |
| 4960 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4961 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4962 | .init_verbs = { alc880_volume_init_verbs, |
| 4963 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4964 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4965 | .dac_nids = alc880_dac_nids, |
| 4966 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4967 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4968 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4969 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4970 | .input_mux = &alc880_capture_source, |
| 4971 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4972 | [ALC880_TCL_S700] = { |
| 4973 | .mixers = { alc880_tcl_s700_mixer }, |
| 4974 | .init_verbs = { alc880_volume_init_verbs, |
| 4975 | alc880_pin_tcl_S700_init_verbs, |
| 4976 | alc880_gpio2_init_verbs }, |
| 4977 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4978 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4979 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4980 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4981 | .hp_nid = 0x03, |
| 4982 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4983 | .channel_mode = alc880_2_jack_modes, |
| 4984 | .input_mux = &alc880_capture_source, |
| 4985 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4986 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4987 | .mixers = { alc880_three_stack_mixer, |
| 4988 | alc880_five_stack_mixer}, |
| 4989 | .init_verbs = { alc880_volume_init_verbs, |
| 4990 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4991 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4992 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4993 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4994 | .channel_mode = alc880_fivestack_modes, |
| 4995 | .input_mux = &alc880_capture_source, |
| 4996 | }, |
| 4997 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4998 | .mixers = { alc880_three_stack_mixer, |
| 4999 | alc880_five_stack_mixer }, |
| 5000 | .init_verbs = { alc880_volume_init_verbs, |
| 5001 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5002 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5003 | .dac_nids = alc880_dac_nids, |
| 5004 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5005 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 5006 | .channel_mode = alc880_fivestack_modes, |
| 5007 | .input_mux = &alc880_capture_source, |
| 5008 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 5009 | [ALC880_6ST] = { |
| 5010 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5011 | .init_verbs = { alc880_volume_init_verbs, |
| 5012 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 5013 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 5014 | .dac_nids = alc880_6st_dac_nids, |
| 5015 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 5016 | .channel_mode = alc880_sixstack_modes, |
| 5017 | .input_mux = &alc880_6stack_capture_source, |
| 5018 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5019 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5020 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5021 | .init_verbs = { alc880_volume_init_verbs, |
| 5022 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5023 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 5024 | .dac_nids = alc880_6st_dac_nids, |
| 5025 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5026 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 5027 | .channel_mode = alc880_sixstack_modes, |
| 5028 | .input_mux = &alc880_6stack_capture_source, |
| 5029 | }, |
| 5030 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5031 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5032 | .init_verbs = { alc880_volume_init_verbs, |
| 5033 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5034 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5035 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 5036 | .dac_nids = alc880_w810_dac_nids, |
| 5037 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5038 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 5039 | .channel_mode = alc880_w810_modes, |
| 5040 | .input_mux = &alc880_capture_source, |
| 5041 | }, |
| 5042 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5043 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5044 | .init_verbs = { alc880_volume_init_verbs, |
| 5045 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5046 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 5047 | .dac_nids = alc880_z71v_dac_nids, |
| 5048 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5049 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5050 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5051 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5052 | .input_mux = &alc880_capture_source, |
| 5053 | }, |
| 5054 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5055 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5056 | .init_verbs = { alc880_volume_init_verbs, |
| 5057 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5058 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 5059 | .dac_nids = alc880_f1734_dac_nids, |
| 5060 | .hp_nid = 0x02, |
| 5061 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5062 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 5063 | .input_mux = &alc880_f1734_capture_source, |
| 5064 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5065 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5066 | .init_hook = alc_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5067 | }, |
| 5068 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5069 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5070 | .init_verbs = { alc880_volume_init_verbs, |
| 5071 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5072 | alc880_gpio1_init_verbs }, |
| 5073 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5074 | .dac_nids = alc880_asus_dac_nids, |
| 5075 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5076 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5077 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5078 | .input_mux = &alc880_capture_source, |
| 5079 | }, |
| 5080 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5081 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5082 | .init_verbs = { alc880_volume_init_verbs, |
| 5083 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5084 | alc880_gpio1_init_verbs }, |
| 5085 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5086 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5087 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5088 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5089 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5090 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5091 | .input_mux = &alc880_capture_source, |
| 5092 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5093 | [ALC880_ASUS_DIG2] = { |
| 5094 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5095 | .init_verbs = { alc880_volume_init_verbs, |
| 5096 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5097 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 5098 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5099 | .dac_nids = alc880_asus_dac_nids, |
| 5100 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5101 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5102 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5103 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5104 | .input_mux = &alc880_capture_source, |
| 5105 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5106 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5107 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5108 | .init_verbs = { alc880_volume_init_verbs, |
| 5109 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5110 | alc880_gpio1_init_verbs }, |
| 5111 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5112 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5113 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5114 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5115 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5116 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5117 | .input_mux = &alc880_capture_source, |
| 5118 | }, |
| 5119 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5120 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5121 | .init_verbs = { alc880_volume_init_verbs, |
| 5122 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5123 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5124 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5125 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5126 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5127 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5128 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5129 | .input_mux = &alc880_capture_source, |
| 5130 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5131 | [ALC880_UNIWILL] = { |
| 5132 | .mixers = { alc880_uniwill_mixer }, |
| 5133 | .init_verbs = { alc880_volume_init_verbs, |
| 5134 | alc880_uniwill_init_verbs }, |
| 5135 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5136 | .dac_nids = alc880_asus_dac_nids, |
| 5137 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5138 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5139 | .channel_mode = alc880_threestack_modes, |
| 5140 | .need_dac_fix = 1, |
| 5141 | .input_mux = &alc880_capture_source, |
| 5142 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5143 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 5144 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5145 | }, |
| 5146 | [ALC880_UNIWILL_P53] = { |
| 5147 | .mixers = { alc880_uniwill_p53_mixer }, |
| 5148 | .init_verbs = { alc880_volume_init_verbs, |
| 5149 | alc880_uniwill_p53_init_verbs }, |
| 5150 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5151 | .dac_nids = alc880_asus_dac_nids, |
| 5152 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5153 | .channel_mode = alc880_threestack_modes, |
| 5154 | .input_mux = &alc880_capture_source, |
| 5155 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5156 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5157 | .init_hook = alc_hp_automute, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5158 | }, |
| 5159 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5160 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5161 | .init_verbs = { alc880_volume_init_verbs, |
| 5162 | alc880_uniwill_p53_init_verbs, |
| 5163 | alc880_beep_init_verbs }, |
| 5164 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5165 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 5166 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5167 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5168 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5169 | .input_mux = &alc880_capture_source, |
| 5170 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5171 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5172 | .init_hook = alc_hp_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5173 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5174 | [ALC880_CLEVO] = { |
| 5175 | .mixers = { alc880_three_stack_mixer }, |
| 5176 | .init_verbs = { alc880_volume_init_verbs, |
| 5177 | alc880_pin_clevo_init_verbs }, |
| 5178 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5179 | .dac_nids = alc880_dac_nids, |
| 5180 | .hp_nid = 0x03, |
| 5181 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5182 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5183 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5184 | .input_mux = &alc880_capture_source, |
| 5185 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5186 | [ALC880_LG] = { |
| 5187 | .mixers = { alc880_lg_mixer }, |
| 5188 | .init_verbs = { alc880_volume_init_verbs, |
| 5189 | alc880_lg_init_verbs }, |
| 5190 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 5191 | .dac_nids = alc880_lg_dac_nids, |
| 5192 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5193 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 5194 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5195 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5196 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5197 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5198 | .setup = alc880_lg_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5199 | .init_hook = alc_hp_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5200 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5201 | .loopbacks = alc880_lg_loopbacks, |
| 5202 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5203 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5204 | [ALC880_LG_LW] = { |
| 5205 | .mixers = { alc880_lg_lw_mixer }, |
| 5206 | .init_verbs = { alc880_volume_init_verbs, |
| 5207 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5208 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5209 | .dac_nids = alc880_dac_nids, |
| 5210 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5211 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5212 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5213 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5214 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5215 | .setup = alc880_lg_lw_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5216 | .init_hook = alc_hp_automute, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5217 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5218 | [ALC880_MEDION_RIM] = { |
| 5219 | .mixers = { alc880_medion_rim_mixer }, |
| 5220 | .init_verbs = { alc880_volume_init_verbs, |
| 5221 | alc880_medion_rim_init_verbs, |
| 5222 | alc_gpio2_init_verbs }, |
| 5223 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5224 | .dac_nids = alc880_dac_nids, |
| 5225 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5226 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5227 | .channel_mode = alc880_2_jack_modes, |
| 5228 | .input_mux = &alc880_medion_rim_capture_source, |
| 5229 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5230 | .setup = alc880_medion_rim_setup, |
| 5231 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5232 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5233 | #ifdef CONFIG_SND_DEBUG |
| 5234 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5235 | .mixers = { alc880_test_mixer }, |
| 5236 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5237 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5238 | .dac_nids = alc880_test_dac_nids, |
| 5239 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5240 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5241 | .channel_mode = alc880_test_modes, |
| 5242 | .input_mux = &alc880_test_capture_source, |
| 5243 | }, |
| 5244 | #endif |
| 5245 | }; |
| 5246 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5247 | /* |
| 5248 | * Automatic parse of I/O pins from the BIOS configuration |
| 5249 | */ |
| 5250 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5251 | enum { |
| 5252 | ALC_CTL_WIDGET_VOL, |
| 5253 | ALC_CTL_WIDGET_MUTE, |
| 5254 | ALC_CTL_BIND_MUTE, |
| 5255 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5256 | static const struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5257 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5258 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5259 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5260 | }; |
| 5261 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5262 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) |
| 5263 | { |
| 5264 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
| 5265 | return snd_array_new(&spec->kctls); |
| 5266 | } |
| 5267 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5268 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5269 | static int add_control(struct alc_spec *spec, int type, const char *name, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5270 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5271 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5272 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5273 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5274 | knew = alc_kcontrol_new(spec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5275 | if (!knew) |
| 5276 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5277 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5278 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5279 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5280 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5281 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5282 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5283 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5284 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5285 | return 0; |
| 5286 | } |
| 5287 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5288 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5289 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5290 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5291 | { |
| 5292 | char name[32]; |
| 5293 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5294 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5295 | } |
| 5296 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5297 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5298 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5299 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5300 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5301 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5302 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5303 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5304 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5305 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5306 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5307 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5308 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5309 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5310 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5311 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5312 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5313 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5314 | #define ALC880_PIN_CD_NID 0x1c |
| 5315 | |
| 5316 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5317 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 5318 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5319 | { |
| 5320 | hda_nid_t nid; |
| 5321 | int assigned[4]; |
| 5322 | int i, j; |
| 5323 | |
| 5324 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5325 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5326 | |
| 5327 | /* check the pins hardwired to audio widget */ |
| 5328 | for (i = 0; i < cfg->line_outs; i++) { |
| 5329 | nid = cfg->line_out_pins[i]; |
| 5330 | if (alc880_is_fixed_pin(nid)) { |
| 5331 | int idx = alc880_fixed_pin_idx(nid); |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 5332 | spec->private_dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5333 | assigned[idx] = 1; |
| 5334 | } |
| 5335 | } |
| 5336 | /* left pins can be connect to any audio widget */ |
| 5337 | for (i = 0; i < cfg->line_outs; i++) { |
| 5338 | nid = cfg->line_out_pins[i]; |
| 5339 | if (alc880_is_fixed_pin(nid)) |
| 5340 | continue; |
| 5341 | /* search for an empty channel */ |
| 5342 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5343 | if (!assigned[j]) { |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 5344 | spec->private_dac_nids[i] = |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5345 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5346 | assigned[j] = 1; |
| 5347 | break; |
| 5348 | } |
| 5349 | } |
| 5350 | } |
| 5351 | spec->multiout.num_dacs = cfg->line_outs; |
| 5352 | return 0; |
| 5353 | } |
| 5354 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5355 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5356 | bool can_be_master) |
| 5357 | { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5358 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 5359 | |
| 5360 | if (cfg->line_outs == 1 && !spec->multi_ios && |
| 5361 | !cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5362 | return "Master"; |
| 5363 | |
| 5364 | switch (cfg->line_out_type) { |
| 5365 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5366 | if (cfg->line_outs == 1) |
| 5367 | return "Speaker"; |
| 5368 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5369 | case AUTO_PIN_HP_OUT: |
| 5370 | return "Headphone"; |
| 5371 | default: |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5372 | if (cfg->line_outs == 1 && !spec->multi_ios) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5373 | return "PCM"; |
| 5374 | break; |
| 5375 | } |
| 5376 | return NULL; |
| 5377 | } |
| 5378 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5379 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5380 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5381 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5382 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 5383 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5384 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5385 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5386 | const char *pfx = alc_get_line_out_pfx(spec, false); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5387 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5388 | int i, err, noutputs; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5389 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5390 | noutputs = cfg->line_outs; |
| 5391 | if (spec->multi_ios > 0) |
| 5392 | noutputs += spec->multi_ios; |
| 5393 | |
| 5394 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5395 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5396 | continue; |
| 5397 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5398 | if (!pfx && i == 2) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5399 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5400 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5401 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5402 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5403 | HDA_OUTPUT)); |
| 5404 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5405 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5406 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5407 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5408 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5409 | HDA_OUTPUT)); |
| 5410 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5411 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5412 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5413 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5414 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5415 | HDA_INPUT)); |
| 5416 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5417 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5418 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5419 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5420 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5421 | HDA_INPUT)); |
| 5422 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5423 | return err; |
| 5424 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5425 | const char *name = pfx; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5426 | int index = i; |
| 5427 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5428 | name = chname[i]; |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5429 | index = 0; |
| 5430 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5431 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5432 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5433 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5434 | HDA_OUTPUT)); |
| 5435 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5436 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5437 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5438 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5439 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5440 | HDA_INPUT)); |
| 5441 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5442 | return err; |
| 5443 | } |
| 5444 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5445 | return 0; |
| 5446 | } |
| 5447 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5448 | /* add playback controls for speaker and HP outputs */ |
| 5449 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5450 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5451 | { |
| 5452 | hda_nid_t nid; |
| 5453 | int err; |
| 5454 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5455 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5456 | return 0; |
| 5457 | |
| 5458 | if (alc880_is_fixed_pin(pin)) { |
| 5459 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5460 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5461 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5462 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5463 | else |
| 5464 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5465 | /* control HP volume/switch on the output mixer amp */ |
| 5466 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5467 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5468 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5469 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5470 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5471 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5472 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5473 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5474 | return err; |
| 5475 | } else if (alc880_is_multi_pin(pin)) { |
| 5476 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5477 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5478 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5479 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5480 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5481 | return err; |
| 5482 | } |
| 5483 | return 0; |
| 5484 | } |
| 5485 | |
| 5486 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5487 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5488 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5489 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5490 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5491 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5492 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5493 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5494 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5495 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5496 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5497 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5498 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5499 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5500 | return err; |
| 5501 | return 0; |
| 5502 | } |
| 5503 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5504 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5505 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5506 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5507 | return (pincap & AC_PINCAP_IN) != 0; |
| 5508 | } |
| 5509 | |
| 5510 | /* create playback/capture controls for input pins */ |
| 5511 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5512 | const struct auto_pin_cfg *cfg, |
| 5513 | hda_nid_t mixer, |
| 5514 | hda_nid_t cap1, hda_nid_t cap2) |
| 5515 | { |
| 5516 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5517 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5518 | int i, err, idx, type_idx = 0; |
| 5519 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5520 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5521 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5522 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5523 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5524 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5525 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5526 | if (!alc_is_input_pin(codec, pin)) |
| 5527 | continue; |
| 5528 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5529 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5530 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5531 | type_idx++; |
| 5532 | else |
| 5533 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5534 | prev_label = label; |
| 5535 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5536 | if (mixer) { |
| 5537 | idx = get_connection_index(codec, mixer, pin); |
| 5538 | if (idx >= 0) { |
| 5539 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5540 | label, type_idx, |
| 5541 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5542 | if (err < 0) |
| 5543 | return err; |
| 5544 | } |
| 5545 | } |
| 5546 | |
| 5547 | if (!cap1) |
| 5548 | continue; |
| 5549 | idx = get_connection_index(codec, cap1, pin); |
| 5550 | if (idx < 0 && cap2) |
| 5551 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5552 | if (idx >= 0) |
| 5553 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5554 | } |
| 5555 | return 0; |
| 5556 | } |
| 5557 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5558 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5559 | const struct auto_pin_cfg *cfg) |
| 5560 | { |
| 5561 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5562 | } |
| 5563 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5564 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5565 | unsigned int pin_type) |
| 5566 | { |
| 5567 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5568 | pin_type); |
| 5569 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5570 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5571 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5572 | } |
| 5573 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5574 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5575 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5576 | int dac_idx) |
| 5577 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5578 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5579 | /* need the manual connection? */ |
| 5580 | if (alc880_is_multi_pin(nid)) { |
| 5581 | struct alc_spec *spec = codec->spec; |
| 5582 | int idx = alc880_multi_pin_idx(nid); |
| 5583 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5584 | AC_VERB_SET_CONNECT_SEL, |
| 5585 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5586 | } |
| 5587 | } |
| 5588 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5589 | static int get_pin_type(int line_out_type) |
| 5590 | { |
| 5591 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5592 | return PIN_HP; |
| 5593 | else |
| 5594 | return PIN_OUT; |
| 5595 | } |
| 5596 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5597 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5598 | { |
| 5599 | struct alc_spec *spec = codec->spec; |
| 5600 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5601 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5602 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5603 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5604 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5605 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5606 | } |
| 5607 | } |
| 5608 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5609 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5610 | { |
| 5611 | struct alc_spec *spec = codec->spec; |
| 5612 | hda_nid_t pin; |
| 5613 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5614 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5615 | if (pin) /* connect to front */ |
| 5616 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5617 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5618 | if (pin) /* connect to front */ |
| 5619 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 5620 | } |
| 5621 | |
| 5622 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5623 | { |
| 5624 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5625 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5626 | int i; |
| 5627 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5628 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5629 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5630 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5631 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5632 | if (nid != ALC880_PIN_CD_NID && |
| 5633 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5634 | snd_hda_codec_write(codec, nid, 0, |
| 5635 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5636 | AMP_OUT_MUTE); |
| 5637 | } |
| 5638 | } |
| 5639 | } |
| 5640 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5641 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5642 | { |
| 5643 | struct alc_spec *spec = codec->spec; |
| 5644 | int c; |
| 5645 | |
| 5646 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5647 | unsigned int mux_idx; |
| 5648 | const struct hda_input_mux *imux; |
| 5649 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5650 | imux = &spec->input_mux[mux_idx]; |
| 5651 | if (!imux->num_items && mux_idx > 0) |
| 5652 | imux = &spec->input_mux[0]; |
| 5653 | if (imux) |
| 5654 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5655 | AC_VERB_SET_CONNECT_SEL, |
| 5656 | imux->items[0].index); |
| 5657 | } |
| 5658 | } |
| 5659 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5660 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec); |
| 5661 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5662 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5663 | /* return 1 if successful, 0 if the proper config is not found, |
| 5664 | * or a negative error code |
| 5665 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5666 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5667 | { |
| 5668 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5669 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5670 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5671 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5672 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5673 | alc880_ignore); |
| 5674 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5675 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5676 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5677 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5678 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5679 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5680 | if (err < 0) |
| 5681 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5682 | err = alc_auto_add_multi_channel_mode(codec); |
| 5683 | if (err < 0) |
| 5684 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5685 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5686 | if (err < 0) |
| 5687 | return err; |
| 5688 | err = alc880_auto_create_extra_out(spec, |
| 5689 | spec->autocfg.speaker_pins[0], |
| 5690 | "Speaker"); |
| 5691 | if (err < 0) |
| 5692 | return err; |
| 5693 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5694 | "Headphone"); |
| 5695 | if (err < 0) |
| 5696 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5697 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5698 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5699 | return err; |
| 5700 | |
| 5701 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5702 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5703 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5704 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5705 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5706 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5707 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5708 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5709 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5710 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5711 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5712 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5713 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5714 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5715 | return 1; |
| 5716 | } |
| 5717 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5718 | /* additional initialization for auto-configuration model */ |
| 5719 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5720 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5721 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5722 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5723 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5724 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5725 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5726 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5727 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5728 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5729 | } |
| 5730 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5731 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5732 | * one of two digital mic pins, e.g. on ALC272 |
| 5733 | */ |
| 5734 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5735 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5736 | struct alc_spec *spec = codec->spec; |
| 5737 | int i; |
| 5738 | |
| 5739 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5740 | hda_nid_t cap = spec->capsrc_nids ? |
| 5741 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5742 | int iidx, eidx; |
| 5743 | |
| 5744 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5745 | if (iidx < 0) |
| 5746 | continue; |
| 5747 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5748 | if (eidx < 0) |
| 5749 | continue; |
| 5750 | spec->int_mic.mux_idx = iidx; |
| 5751 | spec->ext_mic.mux_idx = eidx; |
| 5752 | if (spec->capsrc_nids) |
| 5753 | spec->capsrc_nids += i; |
| 5754 | spec->adc_nids += i; |
| 5755 | spec->num_adc_nids = 1; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5756 | /* optional dock-mic */ |
| 5757 | eidx = get_connection_index(codec, cap, spec->dock_mic.pin); |
| 5758 | if (eidx < 0) |
| 5759 | spec->dock_mic.pin = 0; |
| 5760 | else |
| 5761 | spec->dock_mic.mux_idx = eidx; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5762 | return; |
| 5763 | } |
| 5764 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5765 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5766 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5767 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5768 | } |
| 5769 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5770 | /* select or unmute the given capsrc route */ |
| 5771 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5772 | int idx) |
| 5773 | { |
| 5774 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5775 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5776 | HDA_AMP_MUTE, 0); |
| 5777 | } else { |
| 5778 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5779 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5780 | } |
| 5781 | } |
| 5782 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5783 | /* set the default connection to that pin */ |
| 5784 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5785 | { |
| 5786 | struct alc_spec *spec = codec->spec; |
| 5787 | int i; |
| 5788 | |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5789 | if (!pin) |
| 5790 | return 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5791 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5792 | hda_nid_t cap = spec->capsrc_nids ? |
| 5793 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5794 | int idx; |
| 5795 | |
| 5796 | idx = get_connection_index(codec, cap, pin); |
| 5797 | if (idx < 0) |
| 5798 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5799 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5800 | return i; /* return the found index */ |
| 5801 | } |
| 5802 | return -1; /* not found */ |
| 5803 | } |
| 5804 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5805 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5806 | static void fixup_single_adc(struct hda_codec *codec) |
| 5807 | { |
| 5808 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5809 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5810 | int i; |
| 5811 | |
| 5812 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5813 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5814 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5815 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5816 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5817 | /* use only this ADC */ |
| 5818 | if (spec->capsrc_nids) |
| 5819 | spec->capsrc_nids += i; |
| 5820 | spec->adc_nids += i; |
| 5821 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5822 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5823 | } |
| 5824 | } |
| 5825 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5826 | /* initialize dual adcs */ |
| 5827 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5828 | { |
| 5829 | struct alc_spec *spec = codec->spec; |
| 5830 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5831 | init_capsrc_for_pin(codec, spec->dock_mic.pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5832 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5833 | } |
| 5834 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5835 | /* initialize some special cases for input sources */ |
| 5836 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5837 | { |
| 5838 | struct alc_spec *spec = codec->spec; |
| 5839 | if (spec->dual_adc_switch) |
| 5840 | fixup_dual_adc_switch(codec); |
| 5841 | else if (spec->single_input_src) |
| 5842 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5843 | } |
| 5844 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5845 | static void set_capture_mixer(struct hda_codec *codec) |
| 5846 | { |
| 5847 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5848 | static const struct snd_kcontrol_new *caps[2][3] = { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5849 | { alc_capture_mixer_nosrc1, |
| 5850 | alc_capture_mixer_nosrc2, |
| 5851 | alc_capture_mixer_nosrc3 }, |
| 5852 | { alc_capture_mixer1, |
| 5853 | alc_capture_mixer2, |
| 5854 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5855 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5856 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5857 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5858 | int num_adcs = spec->num_adc_nids; |
| 5859 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5860 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5861 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5862 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5863 | else if (spec->input_mux) { |
| 5864 | if (spec->input_mux->num_items > 1) |
| 5865 | mux = 1; |
| 5866 | else if (spec->input_mux->num_items == 1) |
| 5867 | fixup_single_adc(codec); |
| 5868 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5869 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5870 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5871 | } |
| 5872 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5873 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5874 | static void fillup_priv_adc_nids(struct hda_codec *codec, const hda_nid_t *nids, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5875 | int num_nids) |
| 5876 | { |
| 5877 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5878 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5879 | int n; |
| 5880 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5881 | |
| 5882 | for (n = 0; n < num_nids; n++) { |
| 5883 | hda_nid_t adc, cap; |
| 5884 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5885 | int nconns, i, j; |
| 5886 | |
| 5887 | adc = nids[n]; |
| 5888 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5889 | continue; |
| 5890 | cap = adc; |
| 5891 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5892 | ARRAY_SIZE(conn)); |
| 5893 | if (nconns == 1) { |
| 5894 | cap = conn[0]; |
| 5895 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5896 | ARRAY_SIZE(conn)); |
| 5897 | } |
| 5898 | if (nconns <= 0) |
| 5899 | continue; |
| 5900 | if (!fallback_adc) { |
| 5901 | fallback_adc = adc; |
| 5902 | fallback_cap = cap; |
| 5903 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5904 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5905 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5906 | for (j = 0; j < nconns; j++) { |
| 5907 | if (conn[j] == nid) |
| 5908 | break; |
| 5909 | } |
| 5910 | if (j >= nconns) |
| 5911 | break; |
| 5912 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5913 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5914 | int num_adcs = spec->num_adc_nids; |
| 5915 | spec->private_adc_nids[num_adcs] = adc; |
| 5916 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5917 | spec->num_adc_nids++; |
| 5918 | spec->adc_nids = spec->private_adc_nids; |
| 5919 | if (adc != cap) |
| 5920 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5921 | } |
| 5922 | } |
| 5923 | if (!spec->num_adc_nids) { |
| 5924 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5925 | " using fallback 0x%x\n", |
| 5926 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5927 | spec->private_adc_nids[0] = fallback_adc; |
| 5928 | spec->adc_nids = spec->private_adc_nids; |
| 5929 | if (fallback_adc != fallback_cap) { |
| 5930 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5931 | spec->capsrc_nids = spec->private_adc_nids; |
| 5932 | } |
| 5933 | } |
| 5934 | } |
| 5935 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5936 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5937 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5938 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5939 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5940 | static const struct snd_pci_quirk beep_white_list[] = { |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5941 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5942 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Daniel Cordero | a7e985e | 2011-04-29 08:18:06 +0200 | [diff] [blame] | 5943 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), |
Madis Janson | 39dfe13 | 2011-05-19 18:32:41 +0200 | [diff] [blame] | 5944 | SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5945 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5946 | {} |
| 5947 | }; |
| 5948 | |
| 5949 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5950 | { |
| 5951 | struct alc_spec *spec = codec->spec; |
| 5952 | const struct snd_pci_quirk *q; |
| 5953 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5954 | if (q) |
| 5955 | return q->value; |
| 5956 | return spec->cdefine.enable_pcbeep; |
| 5957 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5958 | #else |
| 5959 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5960 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5961 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5962 | |
| 5963 | /* |
| 5964 | * OK, here we have finally the patch for ALC880 |
| 5965 | */ |
| 5966 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5967 | static int patch_alc880(struct hda_codec *codec) |
| 5968 | { |
| 5969 | struct alc_spec *spec; |
| 5970 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5971 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5972 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5973 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5974 | if (spec == NULL) |
| 5975 | return -ENOMEM; |
| 5976 | |
| 5977 | codec->spec = spec; |
| 5978 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5979 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5980 | alc880_models, |
| 5981 | alc880_cfg_tbl); |
| 5982 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5983 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5984 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5985 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5986 | } |
| 5987 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5988 | if (board_config == ALC880_AUTO) { |
| 5989 | /* automatic parse from the BIOS config */ |
| 5990 | err = alc880_parse_auto_config(codec); |
| 5991 | if (err < 0) { |
| 5992 | alc_free(codec); |
| 5993 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5994 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5995 | printk(KERN_INFO |
| 5996 | "hda_codec: Cannot set up configuration " |
| 5997 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5998 | board_config = ALC880_3ST; |
| 5999 | } |
| 6000 | } |
| 6001 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6002 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6003 | if (err < 0) { |
| 6004 | alc_free(codec); |
| 6005 | return err; |
| 6006 | } |
| 6007 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6009 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6010 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6011 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 6012 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6013 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6014 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6015 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 6016 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 6017 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6018 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6019 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 6020 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6021 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6022 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6023 | if (wcap != AC_WID_AUD_IN) { |
| 6024 | spec->adc_nids = alc880_adc_nids_alt; |
| 6025 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6026 | } else { |
| 6027 | spec->adc_nids = alc880_adc_nids; |
| 6028 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6029 | } |
| 6030 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6031 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6032 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6033 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6034 | spec->vmaster_nid = 0x0c; |
| 6035 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6036 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6037 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6038 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6039 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6040 | if (!spec->loopback.amplist) |
| 6041 | spec->loopback.amplist = alc880_loopbacks; |
| 6042 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6043 | |
| 6044 | return 0; |
| 6045 | } |
| 6046 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6047 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6048 | /* |
| 6049 | * ALC260 support |
| 6050 | */ |
| 6051 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6052 | static const hda_nid_t alc260_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6053 | /* front */ |
| 6054 | 0x02, |
| 6055 | }; |
| 6056 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6057 | static const hda_nid_t alc260_adc_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6058 | /* ADC0 */ |
| 6059 | 0x04, |
| 6060 | }; |
| 6061 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6062 | static const hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6063 | /* ADC1 */ |
| 6064 | 0x05, |
| 6065 | }; |
| 6066 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6067 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 6068 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 6069 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6070 | static const hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6071 | /* ADC0, ADC1 */ |
| 6072 | 0x04, 0x05 |
| 6073 | }; |
| 6074 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6075 | #define ALC260_DIGOUT_NID 0x03 |
| 6076 | #define ALC260_DIGIN_NID 0x06 |
| 6077 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6078 | static const struct hda_input_mux alc260_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6079 | .num_items = 4, |
| 6080 | .items = { |
| 6081 | { "Mic", 0x0 }, |
| 6082 | { "Front Mic", 0x1 }, |
| 6083 | { "Line", 0x2 }, |
| 6084 | { "CD", 0x4 }, |
| 6085 | }, |
| 6086 | }; |
| 6087 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6088 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6089 | * headphone jack and the internal CD lines since these are the only pins at |
| 6090 | * which audio can appear. For flexibility, also allow the option of |
| 6091 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 6092 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6093 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6094 | static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6095 | { |
| 6096 | .num_items = 3, |
| 6097 | .items = { |
| 6098 | { "Mic/Line", 0x0 }, |
| 6099 | { "CD", 0x4 }, |
| 6100 | { "Headphone", 0x2 }, |
| 6101 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6102 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6103 | { |
| 6104 | .num_items = 4, |
| 6105 | .items = { |
| 6106 | { "Mic/Line", 0x0 }, |
| 6107 | { "CD", 0x4 }, |
| 6108 | { "Headphone", 0x2 }, |
| 6109 | { "Mixer", 0x5 }, |
| 6110 | }, |
| 6111 | }, |
| 6112 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6113 | }; |
| 6114 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6115 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 6116 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6117 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6118 | static const struct hda_input_mux alc260_acer_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6119 | { |
| 6120 | .num_items = 4, |
| 6121 | .items = { |
| 6122 | { "Mic", 0x0 }, |
| 6123 | { "Line", 0x2 }, |
| 6124 | { "CD", 0x4 }, |
| 6125 | { "Headphone", 0x5 }, |
| 6126 | }, |
| 6127 | }, |
| 6128 | { |
| 6129 | .num_items = 5, |
| 6130 | .items = { |
| 6131 | { "Mic", 0x0 }, |
| 6132 | { "Line", 0x2 }, |
| 6133 | { "CD", 0x4 }, |
| 6134 | { "Headphone", 0x6 }, |
| 6135 | { "Mixer", 0x5 }, |
| 6136 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6137 | }, |
| 6138 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6139 | |
| 6140 | /* Maxdata Favorit 100XS */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6141 | static const struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6142 | { |
| 6143 | .num_items = 2, |
| 6144 | .items = { |
| 6145 | { "Line/Mic", 0x0 }, |
| 6146 | { "CD", 0x4 }, |
| 6147 | }, |
| 6148 | }, |
| 6149 | { |
| 6150 | .num_items = 3, |
| 6151 | .items = { |
| 6152 | { "Line/Mic", 0x0 }, |
| 6153 | { "CD", 0x4 }, |
| 6154 | { "Mixer", 0x5 }, |
| 6155 | }, |
| 6156 | }, |
| 6157 | }; |
| 6158 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6159 | /* |
| 6160 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 6161 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 6162 | * element which allows changing the channel mode, so the verb list is |
| 6163 | * never used. |
| 6164 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6165 | static const struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6166 | { 2, NULL }, |
| 6167 | }; |
| 6168 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6169 | |
| 6170 | /* Mixer combinations |
| 6171 | * |
| 6172 | * basic: base_output + input + pc_beep + capture |
| 6173 | * HP: base_output + input + capture_alt |
| 6174 | * HP_3013: hp_3013 + input + capture |
| 6175 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6176 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6177 | */ |
| 6178 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6179 | static const struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6180 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6181 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6182 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6183 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6184 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6185 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6186 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6187 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6188 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6189 | static const struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6190 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6191 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6192 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6193 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6194 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6195 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6196 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6197 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6198 | { } /* end */ |
| 6199 | }; |
| 6200 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6201 | /* update HP, line and mono out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6202 | static void alc260_hp_master_update(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6203 | { |
| 6204 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6205 | |
| 6206 | /* change HP pins */ |
| 6207 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 6208 | spec->autocfg.hp_pins, spec->master_mute, true); |
| 6209 | update_speakers(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6210 | } |
| 6211 | |
| 6212 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 6213 | struct snd_ctl_elem_value *ucontrol) |
| 6214 | { |
| 6215 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6216 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6217 | *ucontrol->value.integer.value = !spec->master_mute; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6218 | return 0; |
| 6219 | } |
| 6220 | |
| 6221 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6222 | struct snd_ctl_elem_value *ucontrol) |
| 6223 | { |
| 6224 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6225 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6226 | int val = !*ucontrol->value.integer.value; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6227 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6228 | if (val == spec->master_mute) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6229 | return 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6230 | spec->master_mute = val; |
| 6231 | alc260_hp_master_update(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6232 | return 1; |
| 6233 | } |
| 6234 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6235 | static const struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6236 | { |
| 6237 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6238 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6239 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6240 | .info = snd_ctl_boolean_mono_info, |
| 6241 | .get = alc260_hp_master_sw_get, |
| 6242 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6243 | }, |
| 6244 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6245 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6246 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6247 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6248 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6249 | HDA_OUTPUT), |
| 6250 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6251 | { } /* end */ |
| 6252 | }; |
| 6253 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6254 | static const struct hda_verb alc260_hp_unsol_verbs[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6255 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6256 | {}, |
| 6257 | }; |
| 6258 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6259 | static void alc260_hp_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6260 | { |
| 6261 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6262 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6263 | spec->autocfg.hp_pins[0] = 0x0f; |
| 6264 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6265 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6266 | spec->automute = 1; |
| 6267 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6268 | } |
| 6269 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6270 | static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6271 | { |
| 6272 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6273 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6274 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6275 | .info = snd_ctl_boolean_mono_info, |
| 6276 | .get = alc260_hp_master_sw_get, |
| 6277 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6278 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6279 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6280 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6281 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6282 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6283 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6284 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6285 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6286 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6287 | { } /* end */ |
| 6288 | }; |
| 6289 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6290 | static void alc260_hp_3013_setup(struct hda_codec *codec) |
| 6291 | { |
| 6292 | struct alc_spec *spec = codec->spec; |
| 6293 | |
| 6294 | spec->autocfg.hp_pins[0] = 0x15; |
| 6295 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6296 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6297 | spec->automute = 1; |
| 6298 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 6299 | } |
| 6300 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6301 | static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6302 | .ops = &snd_hda_bind_vol, |
| 6303 | .values = { |
| 6304 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6305 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6306 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6307 | 0 |
| 6308 | }, |
| 6309 | }; |
| 6310 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6311 | static const struct hda_bind_ctls alc260_dc7600_bind_switch = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6312 | .ops = &snd_hda_bind_sw, |
| 6313 | .values = { |
| 6314 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6315 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6316 | 0 |
| 6317 | }, |
| 6318 | }; |
| 6319 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6320 | static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6321 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6322 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6323 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6324 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6325 | { } /* end */ |
| 6326 | }; |
| 6327 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6328 | static const struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6329 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6330 | {}, |
| 6331 | }; |
| 6332 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6333 | static void alc260_hp_3012_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6334 | { |
| 6335 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6336 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6337 | spec->autocfg.hp_pins[0] = 0x10; |
| 6338 | spec->autocfg.speaker_pins[0] = 0x0f; |
| 6339 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6340 | spec->autocfg.speaker_pins[2] = 0x15; |
| 6341 | spec->automute = 1; |
| 6342 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6343 | } |
| 6344 | |
| 6345 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6346 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6347 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6348 | static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6349 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6350 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6351 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6352 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6353 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6354 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6355 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6356 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6357 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6358 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6359 | { } /* end */ |
| 6360 | }; |
| 6361 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6362 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6363 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6364 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6365 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6366 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6367 | * revisions available in early 2006. Therefore for now allow the |
| 6368 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6369 | * that the lack of mic bias for this NID is intentional we could change the |
| 6370 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6371 | * |
| 6372 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6373 | * don't appear to make the mic bias available from the "line" jack, even |
| 6374 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6375 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6376 | * and the output jack. If this turns out to be the case for all such |
| 6377 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6378 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6379 | * |
| 6380 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6381 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6382 | * controls for such models. On models without a "mono speaker" the control |
| 6383 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6384 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6385 | static const struct snd_kcontrol_new alc260_acer_mixer[] = { |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6386 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6387 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6388 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6389 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6390 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6391 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6392 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6393 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6394 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6395 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6396 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6397 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6398 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6399 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6400 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6401 | { } /* end */ |
| 6402 | }; |
| 6403 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6404 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6405 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6406 | static const struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6407 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6408 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6409 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6410 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6411 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6412 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6413 | { } /* end */ |
| 6414 | }; |
| 6415 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6416 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6417 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6418 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6419 | static const struct snd_kcontrol_new alc260_will_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6420 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6421 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6424 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6425 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6426 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6427 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6429 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6430 | { } /* end */ |
| 6431 | }; |
| 6432 | |
| 6433 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6434 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6435 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6436 | static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6437 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6438 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6440 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6441 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6442 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6443 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6444 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6445 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6446 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6447 | { } /* end */ |
| 6448 | }; |
| 6449 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6450 | /* |
| 6451 | * initialization verbs |
| 6452 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6453 | static const struct hda_verb alc260_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6454 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6455 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6456 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6457 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6458 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6459 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6460 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6461 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6462 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6463 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6464 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6465 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6466 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6467 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6468 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6469 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6470 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6471 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6472 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6473 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6474 | /* set connection select to line in (default select for this ADC) */ |
| 6475 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6476 | /* mute capture amp left and right */ |
| 6477 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6478 | /* set connection select to line in (default select for this ADC) */ |
| 6479 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6480 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6481 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6482 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6483 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6484 | /* set vol=0 HP mixer amp left and right */ |
| 6485 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6486 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6487 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6488 | /* set vol=0 Mono mixer amp left and right */ |
| 6489 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6490 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6491 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6492 | /* unmute LINE-2 out pin */ |
| 6493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6494 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6495 | * Line In 2 = 0x03 |
| 6496 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6497 | /* mute analog inputs */ |
| 6498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6503 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6504 | /* mute Front out path */ |
| 6505 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6506 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6507 | /* mute Headphone out path */ |
| 6508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6509 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6510 | /* mute Mono out path */ |
| 6511 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6512 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6513 | { } |
| 6514 | }; |
| 6515 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6516 | #if 0 /* should be identical with alc260_init_verbs? */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6517 | static const struct hda_verb alc260_hp_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6518 | /* Headphone and output */ |
| 6519 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6520 | /* mono output */ |
| 6521 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6522 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6523 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6524 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6525 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6526 | /* Line In pin widget for input */ |
| 6527 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6528 | /* Line-2 pin widget for output */ |
| 6529 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6530 | /* CD pin widget for input */ |
| 6531 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6532 | /* unmute amp left and right */ |
| 6533 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6534 | /* set connection select to line in (default select for this ADC) */ |
| 6535 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6536 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6537 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6538 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6540 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6541 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6542 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6543 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6544 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6545 | * Line In 2 = 0x03 |
| 6546 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6547 | /* mute analog inputs */ |
| 6548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6553 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6554 | /* Unmute Front out path */ |
| 6555 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6556 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6557 | /* Unmute Headphone out path */ |
| 6558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6559 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6560 | /* Unmute Mono out path */ |
| 6561 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6562 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6563 | { } |
| 6564 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6565 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6566 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6567 | static const struct hda_verb alc260_hp_3013_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6568 | /* Line out and output */ |
| 6569 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6570 | /* mono output */ |
| 6571 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6572 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6573 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6574 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6575 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6576 | /* Line In pin widget for input */ |
| 6577 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6578 | /* Headphone pin widget for output */ |
| 6579 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6580 | /* CD pin widget for input */ |
| 6581 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6582 | /* unmute amp left and right */ |
| 6583 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6584 | /* set connection select to line in (default select for this ADC) */ |
| 6585 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6586 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6587 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6588 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6589 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6590 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6591 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6592 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6593 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6594 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6595 | * Line In 2 = 0x03 |
| 6596 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6597 | /* mute analog inputs */ |
| 6598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6600 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6601 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6602 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6603 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6604 | /* Unmute Front out path */ |
| 6605 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6606 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6607 | /* Unmute Headphone out path */ |
| 6608 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6609 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6610 | /* Unmute Mono out path */ |
| 6611 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6612 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6613 | { } |
| 6614 | }; |
| 6615 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6616 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6617 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6618 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6619 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6620 | static const struct hda_verb alc260_fujitsu_init_verbs[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6621 | /* Disable all GPIOs */ |
| 6622 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6623 | /* Internal speaker is connected to headphone pin */ |
| 6624 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6625 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6627 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6628 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6629 | /* Ensure all other unused pins are disabled and muted. */ |
| 6630 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6631 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6632 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6633 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6634 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6635 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6636 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6637 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6638 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6639 | /* Disable digital (SPDIF) pins */ |
| 6640 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6641 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6642 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6643 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6644 | * when acting as an output. |
| 6645 | */ |
| 6646 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6647 | |
| 6648 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6649 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6650 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6651 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6652 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6653 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6654 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6655 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6656 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6657 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6658 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6659 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6660 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6661 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6662 | * If the pin mode is changed by the user the pin mode control will |
| 6663 | * take care of enabling the pin's input/output buffers as needed. |
| 6664 | * Therefore there's no need to enable the input buffer at this |
| 6665 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6666 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6667 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6668 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6669 | * mixer ctrl) |
| 6670 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6671 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6672 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6673 | /* Mute capture amp left and right */ |
| 6674 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6675 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6676 | * in (on mic1 pin) |
| 6677 | */ |
| 6678 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6679 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6680 | /* Do the same for the second ADC: mute capture input amp and |
| 6681 | * set ADC connection to line in (on mic1 pin) |
| 6682 | */ |
| 6683 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6684 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6685 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6686 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6689 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6690 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6692 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6694 | {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] | 6695 | |
| 6696 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6697 | }; |
| 6698 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6699 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6700 | * similar laptops (adapted from Fujitsu init verbs). |
| 6701 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6702 | static const struct hda_verb alc260_acer_init_verbs[] = { |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6703 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6704 | * the headphone jack. Turn this on and rely on the standard mute |
| 6705 | * methods whenever the user wants to turn these outputs off. |
| 6706 | */ |
| 6707 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6708 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6709 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6710 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6711 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6712 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6713 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6714 | /* Line In jack is connected to Line1 pin */ |
| 6715 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6716 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6717 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6718 | /* Ensure all other unused pins are disabled and muted. */ |
| 6719 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6720 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6721 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6722 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6724 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6725 | /* Disable digital (SPDIF) pins */ |
| 6726 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6727 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6728 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6729 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6730 | * bus when acting as outputs. |
| 6731 | */ |
| 6732 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6733 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6734 | |
| 6735 | /* Start with output sum widgets muted and their output gains at min */ |
| 6736 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6737 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6738 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6739 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6740 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6741 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6742 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6743 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6744 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6745 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6746 | /* Unmute Line-out pin widget amp left and right |
| 6747 | * (no equiv mixer ctrl) |
| 6748 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6749 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6750 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6751 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6752 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6753 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6754 | * will take care of enabling the pin's input/output buffers as needed. |
| 6755 | * Therefore there's no need to enable the input buffer at this |
| 6756 | * stage. |
| 6757 | */ |
| 6758 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6759 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6760 | |
| 6761 | /* Mute capture amp left and right */ |
| 6762 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6763 | /* Set ADC connection select to match default mixer setting - mic |
| 6764 | * (on mic1 pin) |
| 6765 | */ |
| 6766 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6767 | |
| 6768 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6769 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6770 | */ |
| 6771 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6772 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6773 | |
| 6774 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6775 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6776 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6777 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6778 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6779 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6780 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6781 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6782 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6783 | |
| 6784 | { } |
| 6785 | }; |
| 6786 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6787 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6788 | * (adapted from Acer init verbs). |
| 6789 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6790 | static const struct hda_verb alc260_favorit100_init_verbs[] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6791 | /* GPIO 0 enables the output jack. |
| 6792 | * Turn this on and rely on the standard mute |
| 6793 | * methods whenever the user wants to turn these outputs off. |
| 6794 | */ |
| 6795 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6796 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6797 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6798 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6799 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6800 | /* Ensure all other unused pins are disabled and muted. */ |
| 6801 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6802 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6803 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6804 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6805 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6806 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6809 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6811 | /* Disable digital (SPDIF) pins */ |
| 6812 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6813 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6814 | |
| 6815 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6816 | * bus when acting as outputs. |
| 6817 | */ |
| 6818 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6819 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6820 | |
| 6821 | /* Start with output sum widgets muted and their output gains at min */ |
| 6822 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6824 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6826 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6827 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6828 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6829 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6830 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6831 | |
| 6832 | /* Unmute Line-out pin widget amp left and right |
| 6833 | * (no equiv mixer ctrl) |
| 6834 | */ |
| 6835 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6836 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6837 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6838 | * will take care of enabling the pin's input/output buffers as needed. |
| 6839 | * Therefore there's no need to enable the input buffer at this |
| 6840 | * stage. |
| 6841 | */ |
| 6842 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6843 | |
| 6844 | /* Mute capture amp left and right */ |
| 6845 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6846 | /* Set ADC connection select to match default mixer setting - mic |
| 6847 | * (on mic1 pin) |
| 6848 | */ |
| 6849 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6850 | |
| 6851 | /* Do similar with the second ADC: mute capture input amp and |
| 6852 | * set ADC connection to mic to match ALSA's default state. |
| 6853 | */ |
| 6854 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6855 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6856 | |
| 6857 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6858 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6859 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6860 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6861 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6862 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6863 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6864 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6865 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6866 | |
| 6867 | { } |
| 6868 | }; |
| 6869 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6870 | static const struct hda_verb alc260_will_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6871 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6872 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6873 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6874 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6875 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6876 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6877 | {} |
| 6878 | }; |
| 6879 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6880 | static const struct hda_verb alc260_replacer_672v_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6881 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6882 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6883 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6884 | |
| 6885 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6886 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6887 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6888 | |
| 6889 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6890 | {} |
| 6891 | }; |
| 6892 | |
| 6893 | /* toggle speaker-output according to the hp-jack state */ |
| 6894 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6895 | { |
| 6896 | unsigned int present; |
| 6897 | |
| 6898 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6899 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6900 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6901 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6902 | AC_VERB_SET_GPIO_DATA, 1); |
| 6903 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6904 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6905 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6906 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6907 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6908 | AC_VERB_SET_GPIO_DATA, 0); |
| 6909 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6910 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6911 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6912 | } |
| 6913 | } |
| 6914 | |
| 6915 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6916 | unsigned int res) |
| 6917 | { |
| 6918 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6919 | alc260_replacer_672v_automute(codec); |
| 6920 | } |
| 6921 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6922 | static const struct hda_verb alc260_hp_dc7600_verbs[] = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6923 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6924 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6925 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6926 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6927 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6929 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6930 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6931 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6932 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6933 | {} |
| 6934 | }; |
| 6935 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6936 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6937 | * configuration. |
| 6938 | */ |
| 6939 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6940 | static const hda_nid_t alc260_test_dac_nids[1] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6941 | 0x02, |
| 6942 | }; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6943 | static const hda_nid_t alc260_test_adc_nids[2] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6944 | 0x04, 0x05, |
| 6945 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6946 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6947 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6948 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6949 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6950 | static const struct hda_input_mux alc260_test_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6951 | { |
| 6952 | .num_items = 7, |
| 6953 | .items = { |
| 6954 | { "MIC1 pin", 0x0 }, |
| 6955 | { "MIC2 pin", 0x1 }, |
| 6956 | { "LINE1 pin", 0x2 }, |
| 6957 | { "LINE2 pin", 0x3 }, |
| 6958 | { "CD pin", 0x4 }, |
| 6959 | { "LINE-OUT pin", 0x5 }, |
| 6960 | { "HP-OUT pin", 0x6 }, |
| 6961 | }, |
| 6962 | }, |
| 6963 | { |
| 6964 | .num_items = 8, |
| 6965 | .items = { |
| 6966 | { "MIC1 pin", 0x0 }, |
| 6967 | { "MIC2 pin", 0x1 }, |
| 6968 | { "LINE1 pin", 0x2 }, |
| 6969 | { "LINE2 pin", 0x3 }, |
| 6970 | { "CD pin", 0x4 }, |
| 6971 | { "Mixer", 0x5 }, |
| 6972 | { "LINE-OUT pin", 0x6 }, |
| 6973 | { "HP-OUT pin", 0x7 }, |
| 6974 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6975 | }, |
| 6976 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6977 | static const struct snd_kcontrol_new alc260_test_mixer[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6978 | /* Output driver widgets */ |
| 6979 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6980 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6981 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6982 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6983 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6984 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6985 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6986 | /* Modes for retasking pin widgets |
| 6987 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6988 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6989 | * mention this restriction. At this stage it's not clear whether |
| 6990 | * this behaviour is intentional or is a hardware bug in chip |
| 6991 | * revisions available at least up until early 2006. Therefore for |
| 6992 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6993 | * choices, but if it turns out that the lack of mic bias for these |
| 6994 | * NIDs is intentional we could change their modes from |
| 6995 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6996 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6997 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6998 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6999 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 7000 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 7001 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 7002 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 7003 | |
| 7004 | /* Loopback mixer controls */ |
| 7005 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 7006 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 7007 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 7008 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 7009 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 7010 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 7011 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 7012 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 7013 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 7014 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7015 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 7016 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 7018 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 7019 | |
| 7020 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 7021 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 7022 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 7023 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 7024 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 7025 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 7026 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 7027 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7028 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 7029 | */ |
| 7030 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 7031 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 7032 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 7033 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 7034 | * this output to turn on an external amplifier. |
| 7035 | */ |
| 7036 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 7037 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 7038 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7039 | { } /* end */ |
| 7040 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7041 | static const struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 7042 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 7043 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 7044 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 7045 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 7046 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7047 | /* Enable retasking pins as output, initially without power amp */ |
| 7048 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7049 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7050 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7051 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7052 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7053 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7054 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 7055 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 7056 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 7057 | * payload also sets the generation to 0, output to be in "consumer" |
| 7058 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 7059 | * control. |
| 7060 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7061 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 7062 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 7063 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7064 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7065 | * OUT1 sum bus when acting as an output. |
| 7066 | */ |
| 7067 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7068 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7069 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7070 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7071 | |
| 7072 | /* Start with output sum widgets muted and their output gains at min */ |
| 7073 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7074 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7075 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7076 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7077 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7078 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7079 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7080 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7081 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7082 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 7083 | /* Unmute retasking pin widget output buffers since the default |
| 7084 | * state appears to be output. As the pin mode is changed by the |
| 7085 | * user the pin mode control will take care of enabling the pin's |
| 7086 | * input/output buffers as needed. |
| 7087 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7088 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7089 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7091 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7092 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7093 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7094 | /* Also unmute the mono-out pin widget */ |
| 7095 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7096 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7097 | /* Mute capture amp left and right */ |
| 7098 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 7099 | /* Set ADC connection select to match default mixer setting (mic1 |
| 7100 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7101 | */ |
| 7102 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7103 | |
| 7104 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 7105 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7106 | */ |
| 7107 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7108 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7109 | |
| 7110 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 7111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 7112 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 7113 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 7114 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 7115 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 7116 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 7117 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 7118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 7119 | |
| 7120 | { } |
| 7121 | }; |
| 7122 | #endif |
| 7123 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7124 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 7125 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7126 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7127 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 7128 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 7129 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7130 | /* |
| 7131 | * for BIOS auto-configuration |
| 7132 | */ |
| 7133 | |
| 7134 | 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] | 7135 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7136 | { |
| 7137 | hda_nid_t nid_vol; |
| 7138 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7139 | int err; |
| 7140 | |
| 7141 | if (nid >= 0x0f && nid < 0x11) { |
| 7142 | nid_vol = nid - 0x7; |
| 7143 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 7144 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 7145 | } else if (nid == 0x11) { |
| 7146 | nid_vol = nid - 0x7; |
| 7147 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 7148 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 7149 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 7150 | nid_vol = 0x08; |
| 7151 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 7152 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 7153 | } else |
| 7154 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7155 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7156 | if (!(*vol_bits & (1 << nid_vol))) { |
| 7157 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7158 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7159 | if (err < 0) |
| 7160 | return err; |
| 7161 | *vol_bits |= (1 << nid_vol); |
| 7162 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7163 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7164 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7165 | return err; |
| 7166 | return 1; |
| 7167 | } |
| 7168 | |
| 7169 | /* add playback controls from the parsed DAC table */ |
| 7170 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7171 | const struct auto_pin_cfg *cfg) |
| 7172 | { |
| 7173 | hda_nid_t nid; |
| 7174 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7175 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7176 | |
| 7177 | spec->multiout.num_dacs = 1; |
| 7178 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 7179 | spec->private_dac_nids[0] = 0x02; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7180 | |
| 7181 | nid = cfg->line_out_pins[0]; |
| 7182 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 7183 | const char *pfx; |
| 7184 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 7185 | pfx = "Master"; |
| 7186 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 7187 | pfx = "Speaker"; |
| 7188 | else |
| 7189 | pfx = "Front"; |
| 7190 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | if (err < 0) |
| 7192 | return err; |
| 7193 | } |
| 7194 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7195 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7196 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7197 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7198 | if (err < 0) |
| 7199 | return err; |
| 7200 | } |
| 7201 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7202 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7203 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7204 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 7205 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7206 | if (err < 0) |
| 7207 | return err; |
| 7208 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7209 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7210 | } |
| 7211 | |
| 7212 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7213 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7214 | const struct auto_pin_cfg *cfg) |
| 7215 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7216 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7217 | } |
| 7218 | |
| 7219 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7220 | hda_nid_t nid, int pin_type, |
| 7221 | int sel_idx) |
| 7222 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7223 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7224 | /* need the manual connection? */ |
| 7225 | if (nid >= 0x12) { |
| 7226 | int idx = nid - 0x12; |
| 7227 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7228 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7229 | } |
| 7230 | } |
| 7231 | |
| 7232 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7233 | { |
| 7234 | struct alc_spec *spec = codec->spec; |
| 7235 | hda_nid_t nid; |
| 7236 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7237 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7238 | if (nid) { |
| 7239 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7240 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7241 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7242 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7243 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7244 | if (nid) |
| 7245 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7246 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7247 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7248 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7249 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7250 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7251 | |
| 7252 | #define ALC260_PIN_CD_NID 0x16 |
| 7253 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 7254 | { |
| 7255 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7256 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7257 | int i; |
| 7258 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 7259 | for (i = 0; i < cfg->num_inputs; i++) { |
| 7260 | hda_nid_t nid = cfg->inputs[i].pin; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7261 | if (nid >= 0x12) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 7262 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 7263 | if (nid != ALC260_PIN_CD_NID && |
| 7264 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7265 | snd_hda_codec_write(codec, nid, 0, |
| 7266 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7267 | AMP_OUT_MUTE); |
| 7268 | } |
| 7269 | } |
| 7270 | } |
| 7271 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7272 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7273 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7274 | /* |
| 7275 | * generic initialization of ADC, input mixers and output mixers |
| 7276 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7277 | static const struct hda_verb alc260_volume_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7278 | /* |
| 7279 | * Unmute ADC0-1 and set the default input to mic-in |
| 7280 | */ |
| 7281 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7282 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7283 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7284 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7286 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 7287 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7288 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7289 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7290 | */ |
| 7291 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7292 | /* mute analog inputs */ |
| 7293 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7294 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7295 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7296 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7297 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7298 | |
| 7299 | /* |
| 7300 | * Set up output mixers (0x08 - 0x0a) |
| 7301 | */ |
| 7302 | /* set vol=0 to output mixers */ |
| 7303 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7304 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7305 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7306 | /* set up input amps for analog loopback */ |
| 7307 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7308 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7309 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7310 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7311 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7312 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7313 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7314 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7315 | { } |
| 7316 | }; |
| 7317 | |
| 7318 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7319 | { |
| 7320 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7321 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7322 | static const hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7323 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7324 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7325 | alc260_ignore); |
| 7326 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7327 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7328 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7329 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7330 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7331 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7332 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7333 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7334 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7335 | return err; |
| 7336 | |
| 7337 | spec->multiout.max_channels = 2; |
| 7338 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7339 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7340 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7341 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7342 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7343 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7344 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7345 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7346 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7347 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7348 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7349 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7350 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7351 | return 1; |
| 7352 | } |
| 7353 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7354 | /* additional initialization for auto-configuration model */ |
| 7355 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7356 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7357 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7358 | alc260_auto_init_multi_out(codec); |
| 7359 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7360 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7361 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7362 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7363 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7364 | } |
| 7365 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7366 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7367 | static const struct hda_amp_list alc260_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7368 | { 0x07, HDA_INPUT, 0 }, |
| 7369 | { 0x07, HDA_INPUT, 1 }, |
| 7370 | { 0x07, HDA_INPUT, 2 }, |
| 7371 | { 0x07, HDA_INPUT, 3 }, |
| 7372 | { 0x07, HDA_INPUT, 4 }, |
| 7373 | { } /* end */ |
| 7374 | }; |
| 7375 | #endif |
| 7376 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7377 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7378 | * Pin config fixes |
| 7379 | */ |
| 7380 | enum { |
| 7381 | PINFIX_HP_DC5750, |
| 7382 | }; |
| 7383 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7384 | static const struct alc_fixup alc260_fixups[] = { |
| 7385 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7386 | .type = ALC_FIXUP_PINS, |
| 7387 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7388 | { 0x11, 0x90130110 }, /* speaker */ |
| 7389 | { } |
| 7390 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7391 | }, |
| 7392 | }; |
| 7393 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7394 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7395 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7396 | {} |
| 7397 | }; |
| 7398 | |
| 7399 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7400 | * ALC260 configurations |
| 7401 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7402 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7403 | [ALC260_BASIC] = "basic", |
| 7404 | [ALC260_HP] = "hp", |
| 7405 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7406 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7407 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7408 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7409 | [ALC260_WILL] = "will", |
| 7410 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7411 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7412 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7413 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7414 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7415 | [ALC260_AUTO] = "auto", |
| 7416 | }; |
| 7417 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7418 | static const struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7419 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7420 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7421 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7422 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7423 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7424 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7425 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7426 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7427 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7428 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7429 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7430 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7431 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7432 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7433 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7434 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7435 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7436 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7437 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7438 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7439 | {} |
| 7440 | }; |
| 7441 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7442 | static const struct alc_config_preset alc260_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7443 | [ALC260_BASIC] = { |
| 7444 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7445 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7446 | .init_verbs = { alc260_init_verbs }, |
| 7447 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7448 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7449 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7450 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7451 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7452 | .channel_mode = alc260_modes, |
| 7453 | .input_mux = &alc260_capture_source, |
| 7454 | }, |
| 7455 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7456 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7457 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7458 | .init_verbs = { alc260_init_verbs, |
| 7459 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7460 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7461 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7462 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7463 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7464 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7465 | .channel_mode = alc260_modes, |
| 7466 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7467 | .unsol_event = alc_sku_unsol_event, |
| 7468 | .setup = alc260_hp_setup, |
| 7469 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7470 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7471 | [ALC260_HP_DC7600] = { |
| 7472 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7473 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7474 | .init_verbs = { alc260_init_verbs, |
| 7475 | alc260_hp_dc7600_verbs }, |
| 7476 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7477 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7478 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7479 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7480 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7481 | .channel_mode = alc260_modes, |
| 7482 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7483 | .unsol_event = alc_sku_unsol_event, |
| 7484 | .setup = alc260_hp_3012_setup, |
| 7485 | .init_hook = alc_inithook, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7486 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7487 | [ALC260_HP_3013] = { |
| 7488 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7489 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7490 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7491 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7492 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7493 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7494 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7495 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7496 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7497 | .channel_mode = alc260_modes, |
| 7498 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7499 | .unsol_event = alc_sku_unsol_event, |
| 7500 | .setup = alc260_hp_3013_setup, |
| 7501 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7502 | }, |
| 7503 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7504 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7505 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7506 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7507 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7508 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7509 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7510 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7511 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7512 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7513 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7514 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7515 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7516 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7517 | .init_verbs = { alc260_acer_init_verbs }, |
| 7518 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7519 | .dac_nids = alc260_dac_nids, |
| 7520 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7521 | .adc_nids = alc260_dual_adc_nids, |
| 7522 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7523 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7524 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7525 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7526 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7527 | [ALC260_FAVORIT100] = { |
| 7528 | .mixers = { alc260_favorit100_mixer }, |
| 7529 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7530 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7531 | .dac_nids = alc260_dac_nids, |
| 7532 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7533 | .adc_nids = alc260_dual_adc_nids, |
| 7534 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7535 | .channel_mode = alc260_modes, |
| 7536 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7537 | .input_mux = alc260_favorit100_capture_sources, |
| 7538 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7539 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7540 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7541 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7542 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7543 | .dac_nids = alc260_dac_nids, |
| 7544 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7545 | .adc_nids = alc260_adc_nids, |
| 7546 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7547 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7548 | .channel_mode = alc260_modes, |
| 7549 | .input_mux = &alc260_capture_source, |
| 7550 | }, |
| 7551 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7552 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7553 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7554 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7555 | .dac_nids = alc260_dac_nids, |
| 7556 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7557 | .adc_nids = alc260_adc_nids, |
| 7558 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7559 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7560 | .channel_mode = alc260_modes, |
| 7561 | .input_mux = &alc260_capture_source, |
| 7562 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7563 | .init_hook = alc260_replacer_672v_automute, |
| 7564 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7565 | #ifdef CONFIG_SND_DEBUG |
| 7566 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7567 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7568 | .init_verbs = { alc260_test_init_verbs }, |
| 7569 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7570 | .dac_nids = alc260_test_dac_nids, |
| 7571 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7572 | .adc_nids = alc260_test_adc_nids, |
| 7573 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7574 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7575 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7576 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7577 | }, |
| 7578 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7579 | }; |
| 7580 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7581 | static int patch_alc260(struct hda_codec *codec) |
| 7582 | { |
| 7583 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7584 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7585 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7586 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7587 | if (spec == NULL) |
| 7588 | return -ENOMEM; |
| 7589 | |
| 7590 | codec->spec = spec; |
| 7591 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7592 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7593 | alc260_models, |
| 7594 | alc260_cfg_tbl); |
| 7595 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7596 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7597 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7598 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7599 | } |
| 7600 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7601 | if (board_config == ALC260_AUTO) { |
| 7602 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7603 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7604 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7605 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7606 | if (board_config == ALC260_AUTO) { |
| 7607 | /* automatic parse from the BIOS config */ |
| 7608 | err = alc260_parse_auto_config(codec); |
| 7609 | if (err < 0) { |
| 7610 | alc_free(codec); |
| 7611 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7612 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7613 | printk(KERN_INFO |
| 7614 | "hda_codec: Cannot set up configuration " |
| 7615 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7616 | board_config = ALC260_BASIC; |
| 7617 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7618 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7619 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7620 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7621 | if (err < 0) { |
| 7622 | alc_free(codec); |
| 7623 | return err; |
| 7624 | } |
| 7625 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7626 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7627 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7628 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7629 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7630 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7631 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7632 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7633 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7634 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7635 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7636 | if (!spec->adc_nids && spec->input_mux) { |
| 7637 | /* check whether NID 0x04 is valid */ |
| 7638 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7639 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7640 | /* get type */ |
| 7641 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7642 | spec->adc_nids = alc260_adc_nids_alt; |
| 7643 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7644 | } else { |
| 7645 | spec->adc_nids = alc260_adc_nids; |
| 7646 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7647 | } |
| 7648 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7649 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7650 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7651 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7652 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7653 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7654 | spec->vmaster_nid = 0x08; |
| 7655 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7656 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7657 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7658 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 7659 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7660 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7661 | if (!spec->loopback.amplist) |
| 7662 | spec->loopback.amplist = alc260_loopbacks; |
| 7663 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7664 | |
| 7665 | return 0; |
| 7666 | } |
| 7667 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7668 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7669 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7670 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7671 | * |
| 7672 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7673 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7674 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7675 | * 6-channel independent captures. |
| 7676 | * |
| 7677 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7678 | * driver yet). |
| 7679 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7680 | #define ALC882_DIGOUT_NID 0x06 |
| 7681 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7682 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7683 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7684 | #define ALC1200_DIGOUT_NID 0x10 |
| 7685 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7686 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7687 | static const struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7688 | { 8, NULL } |
| 7689 | }; |
| 7690 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7691 | /* DACs */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7692 | static const hda_nid_t alc882_dac_nids[4] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7693 | /* front, rear, clfe, rear_surr */ |
| 7694 | 0x02, 0x03, 0x04, 0x05 |
| 7695 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7696 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7697 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7698 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7699 | #define alc882_adc_nids alc880_adc_nids |
| 7700 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7701 | #define alc883_adc_nids alc882_adc_nids_alt |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7702 | static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7703 | static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7704 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7705 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7706 | static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7707 | static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7708 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7709 | static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7710 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7711 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7712 | /* input MUX */ |
| 7713 | /* FIXME: should be a matrix-type input source selection */ |
| 7714 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7715 | static const struct hda_input_mux alc882_capture_source = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7716 | .num_items = 4, |
| 7717 | .items = { |
| 7718 | { "Mic", 0x0 }, |
| 7719 | { "Front Mic", 0x1 }, |
| 7720 | { "Line", 0x2 }, |
| 7721 | { "CD", 0x4 }, |
| 7722 | }, |
| 7723 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7724 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7725 | #define alc883_capture_source alc882_capture_source |
| 7726 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7727 | static const struct hda_input_mux alc889_capture_source = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7728 | .num_items = 3, |
| 7729 | .items = { |
| 7730 | { "Front Mic", 0x0 }, |
| 7731 | { "Mic", 0x3 }, |
| 7732 | { "Line", 0x2 }, |
| 7733 | }, |
| 7734 | }; |
| 7735 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7736 | static const struct hda_input_mux mb5_capture_source = { |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7737 | .num_items = 3, |
| 7738 | .items = { |
| 7739 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7740 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7741 | { "CD", 0x4 }, |
| 7742 | }, |
| 7743 | }; |
| 7744 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7745 | static const struct hda_input_mux macmini3_capture_source = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7746 | .num_items = 2, |
| 7747 | .items = { |
| 7748 | { "Line", 0x2 }, |
| 7749 | { "CD", 0x4 }, |
| 7750 | }, |
| 7751 | }; |
| 7752 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7753 | static const struct hda_input_mux alc883_3stack_6ch_intel = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7754 | .num_items = 4, |
| 7755 | .items = { |
| 7756 | { "Mic", 0x1 }, |
| 7757 | { "Front Mic", 0x0 }, |
| 7758 | { "Line", 0x2 }, |
| 7759 | { "CD", 0x4 }, |
| 7760 | }, |
| 7761 | }; |
| 7762 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7763 | static const struct hda_input_mux alc883_lenovo_101e_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7764 | .num_items = 2, |
| 7765 | .items = { |
| 7766 | { "Mic", 0x1 }, |
| 7767 | { "Line", 0x2 }, |
| 7768 | }, |
| 7769 | }; |
| 7770 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7771 | static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7772 | .num_items = 4, |
| 7773 | .items = { |
| 7774 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7775 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7776 | { "Line", 0x2 }, |
| 7777 | { "CD", 0x4 }, |
| 7778 | }, |
| 7779 | }; |
| 7780 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7781 | static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7782 | .num_items = 2, |
| 7783 | .items = { |
| 7784 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7785 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7786 | }, |
| 7787 | }; |
| 7788 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7789 | static const struct hda_input_mux alc883_lenovo_sky_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7790 | .num_items = 3, |
| 7791 | .items = { |
| 7792 | { "Mic", 0x0 }, |
| 7793 | { "Front Mic", 0x1 }, |
| 7794 | { "Line", 0x4 }, |
| 7795 | }, |
| 7796 | }; |
| 7797 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7798 | static const struct hda_input_mux alc883_asus_eee1601_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7799 | .num_items = 2, |
| 7800 | .items = { |
| 7801 | { "Mic", 0x0 }, |
| 7802 | { "Line", 0x2 }, |
| 7803 | }, |
| 7804 | }; |
| 7805 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7806 | static const struct hda_input_mux alc889A_mb31_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7807 | .num_items = 2, |
| 7808 | .items = { |
| 7809 | { "Mic", 0x0 }, |
| 7810 | /* Front Mic (0x01) unused */ |
| 7811 | { "Line", 0x2 }, |
| 7812 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7813 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7814 | }, |
| 7815 | }; |
| 7816 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7817 | static const struct hda_input_mux alc889A_imac91_capture_source = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7818 | .num_items = 2, |
| 7819 | .items = { |
| 7820 | { "Mic", 0x01 }, |
| 7821 | { "Line", 0x2 }, /* Not sure! */ |
| 7822 | }, |
| 7823 | }; |
| 7824 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7825 | /* |
| 7826 | * 2ch mode |
| 7827 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7828 | static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7829 | { 2, NULL } |
| 7830 | }; |
| 7831 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7832 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7833 | * 2ch mode |
| 7834 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7835 | static const struct hda_verb alc882_3ST_ch2_init[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7836 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7837 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7838 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7839 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7840 | { } /* end */ |
| 7841 | }; |
| 7842 | |
| 7843 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7844 | * 4ch mode |
| 7845 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7846 | static const struct hda_verb alc882_3ST_ch4_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7847 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7848 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7849 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7850 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7851 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7852 | { } /* end */ |
| 7853 | }; |
| 7854 | |
| 7855 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7856 | * 6ch mode |
| 7857 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7858 | static const struct hda_verb alc882_3ST_ch6_init[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7859 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7860 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7861 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7862 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7863 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7864 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7865 | { } /* end */ |
| 7866 | }; |
| 7867 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7868 | static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7869 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7870 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7871 | { 6, alc882_3ST_ch6_init }, |
| 7872 | }; |
| 7873 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7874 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7875 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7876 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7877 | * 2ch mode |
| 7878 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7879 | static const struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7880 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7881 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7882 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7883 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7884 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7885 | { } /* end */ |
| 7886 | }; |
| 7887 | |
| 7888 | /* |
| 7889 | * 4ch mode |
| 7890 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7891 | static const struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7892 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7893 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7894 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7895 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7896 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7897 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7898 | { } /* end */ |
| 7899 | }; |
| 7900 | |
| 7901 | /* |
| 7902 | * 6ch mode |
| 7903 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7904 | static const struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7905 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7906 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7907 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7908 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7909 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7910 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7911 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7912 | { } /* end */ |
| 7913 | }; |
| 7914 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7915 | static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7916 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7917 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7918 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7919 | }; |
| 7920 | |
| 7921 | |
| 7922 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7923 | * 6ch mode |
| 7924 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7925 | static const struct hda_verb alc882_sixstack_ch6_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7926 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7927 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7928 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7929 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7930 | { } /* end */ |
| 7931 | }; |
| 7932 | |
| 7933 | /* |
| 7934 | * 8ch mode |
| 7935 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7936 | static const struct hda_verb alc882_sixstack_ch8_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7937 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7938 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7939 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7940 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7941 | { } /* end */ |
| 7942 | }; |
| 7943 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7944 | static const struct hda_channel_mode alc882_sixstack_modes[2] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7945 | { 6, alc882_sixstack_ch6_init }, |
| 7946 | { 8, alc882_sixstack_ch8_init }, |
| 7947 | }; |
| 7948 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7949 | |
| 7950 | /* Macbook Air 2,1 */ |
| 7951 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7952 | static const struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7953 | { 2, NULL }, |
| 7954 | }; |
| 7955 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7956 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7957 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7958 | */ |
| 7959 | |
| 7960 | /* |
| 7961 | * 2ch mode |
| 7962 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7963 | static const struct hda_verb alc885_mbp_ch2_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7964 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7965 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7966 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7967 | { } /* end */ |
| 7968 | }; |
| 7969 | |
| 7970 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7971 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7972 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7973 | static const struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7974 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7975 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7976 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7977 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7978 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7979 | { } /* end */ |
| 7980 | }; |
| 7981 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7982 | static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7983 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7984 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7985 | }; |
| 7986 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7987 | /* |
| 7988 | * 2ch |
| 7989 | * Speakers/Woofer/HP = Front |
| 7990 | * LineIn = Input |
| 7991 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7992 | static const struct hda_verb alc885_mb5_ch2_init[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7994 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7995 | { } /* end */ |
| 7996 | }; |
| 7997 | |
| 7998 | /* |
| 7999 | * 6ch mode |
| 8000 | * Speakers/HP = Front |
| 8001 | * Woofer = LFE |
| 8002 | * LineIn = Surround |
| 8003 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8004 | static const struct hda_verb alc885_mb5_ch6_init[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8005 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8006 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8007 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8008 | { } /* end */ |
| 8009 | }; |
| 8010 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8011 | static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8012 | { 2, alc885_mb5_ch2_init }, |
| 8013 | { 6, alc885_mb5_ch6_init }, |
| 8014 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8015 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 8016 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8017 | |
| 8018 | /* |
| 8019 | * 2ch mode |
| 8020 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8021 | static const struct hda_verb alc883_4ST_ch2_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8022 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8023 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8024 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8025 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8026 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8027 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8028 | { } /* end */ |
| 8029 | }; |
| 8030 | |
| 8031 | /* |
| 8032 | * 4ch mode |
| 8033 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8034 | static const struct hda_verb alc883_4ST_ch4_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8035 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8036 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8037 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8038 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8039 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8040 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8041 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8042 | { } /* end */ |
| 8043 | }; |
| 8044 | |
| 8045 | /* |
| 8046 | * 6ch mode |
| 8047 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8048 | static const struct hda_verb alc883_4ST_ch6_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8049 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8050 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8051 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8052 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8053 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8054 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8055 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8056 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8057 | { } /* end */ |
| 8058 | }; |
| 8059 | |
| 8060 | /* |
| 8061 | * 8ch mode |
| 8062 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8063 | static const struct hda_verb alc883_4ST_ch8_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8064 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8065 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8066 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8067 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8068 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8069 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8070 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8071 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8072 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8073 | { } /* end */ |
| 8074 | }; |
| 8075 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8076 | static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8077 | { 2, alc883_4ST_ch2_init }, |
| 8078 | { 4, alc883_4ST_ch4_init }, |
| 8079 | { 6, alc883_4ST_ch6_init }, |
| 8080 | { 8, alc883_4ST_ch8_init }, |
| 8081 | }; |
| 8082 | |
| 8083 | |
| 8084 | /* |
| 8085 | * 2ch mode |
| 8086 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8087 | static const struct hda_verb alc883_3ST_ch2_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8088 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8089 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8090 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8091 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8092 | { } /* end */ |
| 8093 | }; |
| 8094 | |
| 8095 | /* |
| 8096 | * 4ch mode |
| 8097 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8098 | static const struct hda_verb alc883_3ST_ch4_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8099 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8100 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8101 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8102 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8103 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8104 | { } /* end */ |
| 8105 | }; |
| 8106 | |
| 8107 | /* |
| 8108 | * 6ch mode |
| 8109 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8110 | static const struct hda_verb alc883_3ST_ch6_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8111 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8112 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8113 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8114 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8115 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8116 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8117 | { } /* end */ |
| 8118 | }; |
| 8119 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8120 | static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8121 | { 2, alc883_3ST_ch2_intel_init }, |
| 8122 | { 4, alc883_3ST_ch4_intel_init }, |
| 8123 | { 6, alc883_3ST_ch6_intel_init }, |
| 8124 | }; |
| 8125 | |
| 8126 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8127 | * 2ch mode |
| 8128 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8129 | static const struct hda_verb alc889_ch2_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8130 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8131 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8132 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8133 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8134 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8135 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8136 | { } /* end */ |
| 8137 | }; |
| 8138 | |
| 8139 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8140 | * 6ch mode |
| 8141 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8142 | static const struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8143 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8144 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8145 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8146 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8147 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8148 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8149 | { } /* end */ |
| 8150 | }; |
| 8151 | |
| 8152 | /* |
| 8153 | * 8ch mode |
| 8154 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8155 | static const struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8156 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8157 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8158 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8159 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8160 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8161 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8162 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8163 | { } /* end */ |
| 8164 | }; |
| 8165 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8166 | static const struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8167 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8168 | { 6, alc889_ch6_intel_init }, |
| 8169 | { 8, alc889_ch8_intel_init }, |
| 8170 | }; |
| 8171 | |
| 8172 | /* |
| 8173 | * 6ch mode |
| 8174 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8175 | static const struct hda_verb alc883_sixstack_ch6_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8176 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8177 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8178 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8179 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8180 | { } /* end */ |
| 8181 | }; |
| 8182 | |
| 8183 | /* |
| 8184 | * 8ch mode |
| 8185 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8186 | static const struct hda_verb alc883_sixstack_ch8_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8187 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8188 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8189 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8190 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8191 | { } /* end */ |
| 8192 | }; |
| 8193 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8194 | static const struct hda_channel_mode alc883_sixstack_modes[2] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8195 | { 6, alc883_sixstack_ch6_init }, |
| 8196 | { 8, alc883_sixstack_ch8_init }, |
| 8197 | }; |
| 8198 | |
| 8199 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8200 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 8201 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 8202 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8203 | static const struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8204 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8205 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8206 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8207 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8208 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8209 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8210 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8211 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8212 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8213 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8214 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8215 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8216 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8217 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8218 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8220 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8221 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8222 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8223 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8224 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8225 | { } /* end */ |
| 8226 | }; |
| 8227 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8228 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8229 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8230 | static const struct snd_kcontrol_new alc885_mba21_mixer[] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8231 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8232 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8233 | { } |
| 8234 | }; |
| 8235 | |
| 8236 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8237 | static const struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8238 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8239 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8240 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8241 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8242 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8243 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8244 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8245 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8246 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8247 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8248 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8249 | { } /* end */ |
| 8250 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8251 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8252 | static const struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8253 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8254 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8255 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8256 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8257 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8258 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8259 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8260 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8261 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8262 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8264 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8265 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8266 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8267 | { } /* end */ |
| 8268 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8269 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8270 | static const struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8271 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8272 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8273 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8274 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8275 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8276 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8277 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8278 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8279 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8280 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8281 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8282 | { } /* end */ |
| 8283 | }; |
| 8284 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8285 | static const struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8286 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8287 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8288 | { } /* end */ |
| 8289 | }; |
| 8290 | |
| 8291 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8292 | static const struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8293 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8294 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8295 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8296 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8297 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8298 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8299 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8300 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8301 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8302 | { } /* end */ |
| 8303 | }; |
| 8304 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8305 | static const struct snd_kcontrol_new alc882_targa_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8306 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8307 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8308 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8309 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8310 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8311 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8312 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8313 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8314 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8315 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8316 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8317 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8318 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8319 | { } /* end */ |
| 8320 | }; |
| 8321 | |
| 8322 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8323 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8324 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8325 | static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8326 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8327 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8328 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8329 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8330 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8331 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8334 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8335 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8336 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8337 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8338 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8339 | { } /* end */ |
| 8340 | }; |
| 8341 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8342 | static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8343 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8344 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8345 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8346 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8347 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8348 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8349 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8351 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8352 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8353 | { } /* end */ |
| 8354 | }; |
| 8355 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8356 | static const struct snd_kcontrol_new alc882_chmode_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8357 | { |
| 8358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8359 | .name = "Channel Mode", |
| 8360 | .info = alc_ch_mode_info, |
| 8361 | .get = alc_ch_mode_get, |
| 8362 | .put = alc_ch_mode_put, |
| 8363 | }, |
| 8364 | { } /* end */ |
| 8365 | }; |
| 8366 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8367 | static const struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8368 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8369 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8370 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8371 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8372 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8373 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8374 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8375 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8376 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8377 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8378 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8379 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8380 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8381 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8382 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8383 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8384 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8385 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8386 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8387 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8389 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8390 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8391 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8392 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8393 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8394 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8395 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8396 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8397 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8398 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8399 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8400 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8401 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8402 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8403 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8404 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8405 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8406 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8407 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8408 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8409 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8410 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8411 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8412 | |
| 8413 | /* FIXME: use matrix-type input source selection */ |
| 8414 | /* 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] | 8415 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8416 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8417 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8418 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8419 | /* ADC2: mute amp left and right */ |
| 8420 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8421 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8422 | /* ADC3: mute amp left and right */ |
| 8423 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8424 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8425 | |
| 8426 | { } |
| 8427 | }; |
| 8428 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8429 | static const struct hda_verb alc882_adc1_init_verbs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8430 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8431 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8432 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8433 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8434 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8435 | /* ADC1: mute amp left and right */ |
| 8436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8437 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8438 | { } |
| 8439 | }; |
| 8440 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8441 | static const struct hda_verb alc882_eapd_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8442 | /* change to EAPD mode */ |
| 8443 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8444 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8445 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8446 | }; |
| 8447 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8448 | static const struct hda_verb alc889_eapd_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8449 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8450 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8451 | { } |
| 8452 | }; |
| 8453 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8454 | static const struct hda_verb alc_hp15_unsol_verbs[] = { |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8455 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8457 | {} |
| 8458 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8459 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8460 | static const struct hda_verb alc885_init_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8461 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8464 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8466 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8467 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8468 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8470 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8471 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8472 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8473 | |
| 8474 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8475 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8476 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8477 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8478 | /* Front Pin: output 0 (0x0c) */ |
| 8479 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8480 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8481 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8482 | /* Rear Pin: output 1 (0x0d) */ |
| 8483 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8484 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8485 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8486 | /* CLFE Pin: output 2 (0x0e) */ |
| 8487 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8488 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8489 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8490 | /* Side Pin: output 3 (0x0f) */ |
| 8491 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8492 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8493 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8494 | /* Mic (rear) pin: input vref at 80% */ |
| 8495 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8496 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8497 | /* Front Mic pin: input vref at 80% */ |
| 8498 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8499 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8500 | /* Line In pin: input */ |
| 8501 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8502 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8503 | |
| 8504 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8505 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8506 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8507 | /* Input mixer2 */ |
| 8508 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8509 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8510 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8511 | /* ADC2: mute amp left and right */ |
| 8512 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8513 | /* ADC3: mute amp left and right */ |
| 8514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8515 | |
| 8516 | { } |
| 8517 | }; |
| 8518 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8519 | static const struct hda_verb alc885_init_input_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8520 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8521 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8522 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8523 | { } |
| 8524 | }; |
| 8525 | |
| 8526 | |
| 8527 | /* Unmute Selector 24h and set the default input to front mic */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8528 | static const struct hda_verb alc889_init_input_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8529 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8530 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8531 | { } |
| 8532 | }; |
| 8533 | |
| 8534 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8535 | #define alc883_init_verbs alc882_base_init_verbs |
| 8536 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8537 | /* Mac Pro test */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8538 | static const struct snd_kcontrol_new alc882_macpro_mixer[] = { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8539 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8540 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8541 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8544 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8545 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8546 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8547 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8548 | { } /* end */ |
| 8549 | }; |
| 8550 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8551 | static const struct hda_verb alc882_macpro_init_verbs[] = { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8552 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8555 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8556 | /* Front Pin: output 0 (0x0c) */ |
| 8557 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8558 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8559 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8560 | /* Front Mic pin: input vref at 80% */ |
| 8561 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8562 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8563 | /* Speaker: output */ |
| 8564 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8565 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8566 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8567 | /* Headphone output (output 0 - 0x0c) */ |
| 8568 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8570 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8571 | |
| 8572 | /* FIXME: use matrix-type input source selection */ |
| 8573 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8574 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8575 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8576 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8577 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8578 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8579 | /* Input mixer2 */ |
| 8580 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8581 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8582 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8583 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8584 | /* Input mixer3 */ |
| 8585 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8586 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8587 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8588 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8589 | /* ADC1: mute amp left and right */ |
| 8590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8591 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8592 | /* ADC2: mute amp left and right */ |
| 8593 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8594 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8595 | /* ADC3: mute amp left and right */ |
| 8596 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8597 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8598 | |
| 8599 | { } |
| 8600 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8601 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8602 | /* Macbook 5,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8603 | static const struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8604 | /* DACs */ |
| 8605 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8606 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8607 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8608 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8609 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8610 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8611 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8612 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8613 | /* Surround mixer */ |
| 8614 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8615 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8616 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8617 | /* LFE mixer */ |
| 8618 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8619 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8620 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8621 | /* HP mixer */ |
| 8622 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8624 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8625 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8626 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8627 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8628 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8629 | /* LFE Pin (0x0e) */ |
| 8630 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8631 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8632 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8633 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8634 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8635 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8636 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8637 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8638 | /* Front Mic pin: input vref at 80% */ |
| 8639 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8640 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8641 | /* Line In pin */ |
| 8642 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8643 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8644 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8645 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8646 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8647 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8648 | { } |
| 8649 | }; |
| 8650 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8651 | /* Macmini 3,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8652 | static const struct hda_verb alc885_macmini3_init_verbs[] = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8653 | /* DACs */ |
| 8654 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8655 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8656 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8657 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8658 | /* Front mixer */ |
| 8659 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8660 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8661 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8662 | /* Surround mixer */ |
| 8663 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8664 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8665 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8666 | /* LFE mixer */ |
| 8667 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8668 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8669 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8670 | /* HP mixer */ |
| 8671 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8672 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8673 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8674 | /* Front Pin (0x0c) */ |
| 8675 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8676 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8677 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8678 | /* LFE Pin (0x0e) */ |
| 8679 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8680 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8681 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8682 | /* HP Pin (0x0f) */ |
| 8683 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8684 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8685 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8686 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8687 | /* Line In pin */ |
| 8688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8690 | |
| 8691 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8692 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8693 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8694 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8695 | { } |
| 8696 | }; |
| 8697 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8698 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8699 | static const struct hda_verb alc885_mba21_init_verbs[] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8700 | /*Internal and HP Speaker Mixer*/ |
| 8701 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8702 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8704 | /*Internal Speaker Pin (0x0c)*/ |
| 8705 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8706 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8707 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8708 | /* HP Pin: output 0 (0x0e) */ |
| 8709 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8710 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8711 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8712 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8713 | /* Line in (is hp when jack connected)*/ |
| 8714 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8715 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8716 | |
| 8717 | { } |
| 8718 | }; |
| 8719 | |
| 8720 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8721 | /* Macbook Pro rev3 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8722 | static const struct hda_verb alc885_mbp3_init_verbs[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8723 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8726 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8727 | /* Rear mixer */ |
| 8728 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8729 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8730 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8731 | /* HP mixer */ |
| 8732 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8733 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8734 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8735 | /* Front Pin: output 0 (0x0c) */ |
| 8736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8737 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8738 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8739 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8742 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8743 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8744 | /* Mic (rear) pin: input vref at 80% */ |
| 8745 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8746 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8747 | /* Front Mic pin: input vref at 80% */ |
| 8748 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8749 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8750 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8751 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8753 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8754 | |
| 8755 | /* FIXME: use matrix-type input source selection */ |
| 8756 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8757 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8758 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8759 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8760 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8761 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8762 | /* Input mixer2 */ |
| 8763 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8764 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8765 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8766 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8767 | /* Input mixer3 */ |
| 8768 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8772 | /* ADC1: mute amp left and right */ |
| 8773 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8774 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8775 | /* ADC2: mute amp left and right */ |
| 8776 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8777 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8778 | /* ADC3: mute amp left and right */ |
| 8779 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8780 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8781 | |
| 8782 | { } |
| 8783 | }; |
| 8784 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8785 | /* iMac 9,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8786 | static const struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8787 | /* Internal Speaker Pin (0x0c) */ |
| 8788 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8789 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8790 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8791 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8792 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8793 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8794 | /* HP Pin: Rear */ |
| 8795 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8796 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8797 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8798 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8799 | /* Line in Rear */ |
| 8800 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8801 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8802 | /* Front Mic pin: input vref at 80% */ |
| 8803 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8804 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8805 | /* Rear mixer */ |
| 8806 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8807 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8808 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8809 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8813 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8814 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8815 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8816 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8817 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8818 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8819 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8820 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8821 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8822 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8823 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8824 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8825 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8826 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8827 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8828 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8830 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8831 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8832 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8833 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8834 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8835 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8836 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8837 | { } |
| 8838 | }; |
| 8839 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8840 | /* iMac 24 mixer. */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8841 | static const struct snd_kcontrol_new alc885_imac24_mixer[] = { |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8842 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8843 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8844 | { } /* end */ |
| 8845 | }; |
| 8846 | |
| 8847 | /* iMac 24 init verbs. */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8848 | static const struct hda_verb alc885_imac24_init_verbs[] = { |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8849 | /* Internal speakers: output 0 (0x0c) */ |
| 8850 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8851 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8852 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8853 | /* Internal speakers: output 0 (0x0c) */ |
| 8854 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8855 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8856 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8857 | /* Headphone: output 0 (0x0c) */ |
| 8858 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8859 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8860 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8861 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8862 | /* Front Mic: input vref at 80% */ |
| 8863 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8864 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8865 | { } |
| 8866 | }; |
| 8867 | |
| 8868 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8869 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8870 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8871 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8872 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8873 | spec->autocfg.hp_pins[0] = 0x14; |
| 8874 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8875 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8876 | spec->automute = 1; |
| 8877 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8878 | } |
| 8879 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8880 | #define alc885_mb5_setup alc885_imac24_setup |
| 8881 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8882 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8883 | /* Macbook Air 2,1 */ |
| 8884 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8885 | { |
| 8886 | struct alc_spec *spec = codec->spec; |
| 8887 | |
| 8888 | spec->autocfg.hp_pins[0] = 0x14; |
| 8889 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8890 | spec->automute = 1; |
| 8891 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8892 | } |
| 8893 | |
| 8894 | |
| 8895 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8896 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8897 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8898 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8899 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8900 | spec->autocfg.hp_pins[0] = 0x15; |
| 8901 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8902 | spec->automute = 1; |
| 8903 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8904 | } |
| 8905 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8906 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8907 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8908 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8909 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8910 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8911 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8912 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8913 | spec->automute = 1; |
| 8914 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8915 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8916 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8917 | static const struct hda_verb alc882_targa_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8919 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8920 | |
| 8921 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8922 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8923 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8924 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8925 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8926 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8927 | |
| 8928 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8929 | { } /* end */ |
| 8930 | }; |
| 8931 | |
| 8932 | /* toggle speaker-output according to the hp-jack state */ |
| 8933 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8934 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8935 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8936 | alc_hp_automute(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8937 | 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] | 8938 | spec->jack_present ? 1 : 3); |
| 8939 | } |
| 8940 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8941 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8942 | { |
| 8943 | struct alc_spec *spec = codec->spec; |
| 8944 | |
| 8945 | spec->autocfg.hp_pins[0] = 0x14; |
| 8946 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8947 | spec->automute = 1; |
| 8948 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8949 | } |
| 8950 | |
| 8951 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8952 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8953 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8954 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8955 | } |
| 8956 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8957 | static const struct hda_verb alc882_asus_a7j_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8960 | |
| 8961 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8962 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8963 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8964 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8965 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8966 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8967 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8968 | |
| 8969 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8970 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8971 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8972 | { } /* end */ |
| 8973 | }; |
| 8974 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8975 | static const struct hda_verb alc882_asus_a7m_verbs[] = { |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8976 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8977 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8978 | |
| 8979 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8981 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8982 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8983 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8984 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8985 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8986 | |
| 8987 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8988 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8989 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8990 | { } /* end */ |
| 8991 | }; |
| 8992 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8993 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8994 | { |
| 8995 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8996 | |
| 8997 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8998 | AC_VERB_GET_GPIO_DATA, 0); |
| 8999 | |
| 9000 | if (!muted) |
| 9001 | gpiostate |= (1 << pin); |
| 9002 | else |
| 9003 | gpiostate &= ~(1 << pin); |
| 9004 | |
| 9005 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 9006 | AC_VERB_GET_GPIO_MASK, 0); |
| 9007 | gpiomask |= (1 << pin); |
| 9008 | |
| 9009 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 9010 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 9011 | gpiodir |= (1 << pin); |
| 9012 | |
| 9013 | |
| 9014 | snd_hda_codec_write(codec, codec->afg, 0, |
| 9015 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 9016 | snd_hda_codec_write(codec, codec->afg, 0, |
| 9017 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 9018 | |
| 9019 | msleep(1); |
| 9020 | |
| 9021 | snd_hda_codec_write(codec, codec->afg, 0, |
| 9022 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 9023 | } |
| 9024 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 9025 | /* set up GPIO at initialization */ |
| 9026 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 9027 | { |
| 9028 | alc882_gpio_mute(codec, 0, 0); |
| 9029 | alc882_gpio_mute(codec, 1, 0); |
| 9030 | } |
| 9031 | |
| 9032 | /* set up GPIO and update auto-muting at initialization */ |
| 9033 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 9034 | { |
| 9035 | alc885_macpro_init_hook(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9036 | alc_hp_automute(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 9037 | } |
| 9038 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9039 | /* |
| 9040 | * generic initialization of ADC, input mixers and output mixers |
| 9041 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9042 | static const struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9043 | /* |
| 9044 | * Unmute ADC0-2 and set the default input to mic-in |
| 9045 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9046 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9047 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9048 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9049 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9050 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9051 | /* |
| 9052 | * Set up output mixers (0x0c - 0x0f) |
| 9053 | */ |
| 9054 | /* set vol=0 to output mixers */ |
| 9055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9056 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9057 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9058 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9059 | /* set up input amps for analog loopback */ |
| 9060 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9061 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9063 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9065 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9066 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9067 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9068 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9069 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9070 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9071 | |
| 9072 | /* FIXME: use matrix-type input source selection */ |
| 9073 | /* 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] | 9074 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 9075 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9076 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 9077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9078 | { } |
| 9079 | }; |
| 9080 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9081 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9082 | static const struct hda_verb alc889A_mb31_ch2_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9083 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 9084 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9085 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 9086 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 9087 | { } /* end */ |
| 9088 | }; |
| 9089 | |
| 9090 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9091 | static const struct hda_verb alc889A_mb31_ch4_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9092 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 9093 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9094 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 9095 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 9096 | { } /* end */ |
| 9097 | }; |
| 9098 | |
| 9099 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9100 | static const struct hda_verb alc889A_mb31_ch5_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9101 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 9102 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9103 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 9104 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 9105 | { } /* end */ |
| 9106 | }; |
| 9107 | |
| 9108 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9109 | static const struct hda_verb alc889A_mb31_ch6_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 9111 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 9112 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 9113 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 9114 | { } /* end */ |
| 9115 | }; |
| 9116 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9117 | static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9118 | { 2, alc889A_mb31_ch2_init }, |
| 9119 | { 4, alc889A_mb31_ch4_init }, |
| 9120 | { 5, alc889A_mb31_ch5_init }, |
| 9121 | { 6, alc889A_mb31_ch6_init }, |
| 9122 | }; |
| 9123 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9124 | static const struct hda_verb alc883_medion_eapd_verbs[] = { |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9125 | /* eanable EAPD on medion laptop */ |
| 9126 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9127 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9128 | { } |
| 9129 | }; |
| 9130 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9131 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9132 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9133 | static const struct snd_kcontrol_new alc883_mitac_mixer[] = { |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9135 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9136 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9137 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9138 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9139 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9140 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9142 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9144 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9145 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9146 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9147 | { } /* end */ |
| 9148 | }; |
| 9149 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9150 | static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9151 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9152 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9153 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9154 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9156 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9158 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9159 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9160 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9161 | { } /* end */ |
| 9162 | }; |
| 9163 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9164 | static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9165 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9166 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9167 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9168 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9170 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9172 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9173 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9174 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9175 | { } /* end */ |
| 9176 | }; |
| 9177 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9178 | static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9179 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9180 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9181 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9182 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9183 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9184 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9185 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9186 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9187 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9188 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9189 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9190 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9191 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9192 | { } /* end */ |
| 9193 | }; |
| 9194 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9195 | static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9196 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9197 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9198 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9199 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9200 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9201 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9202 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9203 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9204 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9205 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9206 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9207 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9208 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9209 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9210 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9212 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9213 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9214 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9215 | { } /* end */ |
| 9216 | }; |
| 9217 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9218 | static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9220 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9221 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9222 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9223 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9224 | HDA_OUTPUT), |
| 9225 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9226 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9227 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9228 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9229 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9230 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9231 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9232 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9233 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9234 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9236 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9237 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9238 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9239 | { } /* end */ |
| 9240 | }; |
| 9241 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9242 | static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9243 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9244 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9245 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9246 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9247 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9248 | HDA_OUTPUT), |
| 9249 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9250 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9251 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9252 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9253 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9255 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9256 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9258 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9259 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9260 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9261 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9262 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9263 | { } /* end */ |
| 9264 | }; |
| 9265 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9266 | static const struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9267 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9268 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9269 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9270 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9271 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9272 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9273 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9274 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9275 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9276 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9277 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9278 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9279 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9281 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9282 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9283 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9284 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9285 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9286 | { } /* end */ |
| 9287 | }; |
| 9288 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9289 | static const struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9291 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9292 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9293 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9294 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9295 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9296 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9297 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9298 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9299 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9300 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9301 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9302 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9303 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9305 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9306 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9307 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9308 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9309 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9310 | static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9311 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9312 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9314 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9315 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9316 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9317 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9318 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9319 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9320 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9321 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9322 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9323 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9324 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9325 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9326 | static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9327 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9328 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9329 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9330 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9331 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9332 | { } /* end */ |
| 9333 | }; |
| 9334 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9335 | static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9336 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9337 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9338 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9339 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9340 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9341 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9342 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9343 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9344 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9345 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9346 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9347 | static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9348 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9349 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9351 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9352 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9355 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9356 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9357 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9358 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9359 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9360 | static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9361 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9362 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9363 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9364 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9365 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9366 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9367 | { } /* end */ |
| 9368 | }; |
| 9369 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9370 | static const struct hda_verb alc883_medion_wim2160_verbs[] = { |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9371 | /* Unmute front mixer */ |
| 9372 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9373 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9374 | |
| 9375 | /* Set speaker pin to front mixer */ |
| 9376 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9377 | |
| 9378 | /* Init headphone pin */ |
| 9379 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9380 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9381 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9382 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9383 | |
| 9384 | { } /* end */ |
| 9385 | }; |
| 9386 | |
| 9387 | /* toggle speaker-output according to the hp-jack state */ |
| 9388 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9389 | { |
| 9390 | struct alc_spec *spec = codec->spec; |
| 9391 | |
| 9392 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9393 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9394 | spec->automute = 1; |
| 9395 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9396 | } |
| 9397 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9398 | static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9399 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9400 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9401 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9402 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9403 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9404 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9405 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9406 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9407 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9408 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9409 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9410 | static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9411 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9412 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9413 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9414 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9415 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9416 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9417 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9418 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9419 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9420 | { } /* end */ |
| 9421 | }; |
| 9422 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9423 | static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9424 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9425 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9426 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9427 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9428 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9429 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9430 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9431 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9432 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9433 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9434 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9435 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9436 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9437 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9438 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9439 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9440 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9441 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9442 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9443 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9444 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9445 | { } /* end */ |
| 9446 | }; |
| 9447 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9448 | static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9449 | /* Output mixers */ |
| 9450 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9451 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9452 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9453 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9454 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9455 | HDA_OUTPUT), |
| 9456 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9457 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9458 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9459 | /* Output switches */ |
| 9460 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9461 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9462 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9463 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9464 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9465 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9466 | /* Input mixers */ |
| 9467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9469 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9470 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9471 | { } /* end */ |
| 9472 | }; |
| 9473 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9474 | static const struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9475 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9476 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9477 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9479 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9480 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9481 | { } /* end */ |
| 9482 | }; |
| 9483 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9484 | static const struct hda_bind_ctls alc883_bind_cap_vol = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9485 | .ops = &snd_hda_bind_vol, |
| 9486 | .values = { |
| 9487 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9488 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9489 | 0 |
| 9490 | }, |
| 9491 | }; |
| 9492 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9493 | static const struct hda_bind_ctls alc883_bind_cap_switch = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9494 | .ops = &snd_hda_bind_sw, |
| 9495 | .values = { |
| 9496 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9497 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9498 | 0 |
| 9499 | }, |
| 9500 | }; |
| 9501 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9502 | static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9503 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9504 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9505 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9506 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9507 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9508 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9509 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9510 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9511 | { } /* end */ |
| 9512 | }; |
| 9513 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9514 | static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9515 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9516 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9517 | { |
| 9518 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9519 | /* .name = "Capture Source", */ |
| 9520 | .name = "Input Source", |
| 9521 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9522 | .info = alc_mux_enum_info, |
| 9523 | .get = alc_mux_enum_get, |
| 9524 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9525 | }, |
| 9526 | { } /* end */ |
| 9527 | }; |
| 9528 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9529 | static const struct snd_kcontrol_new alc883_chmode_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9530 | { |
| 9531 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9532 | .name = "Channel Mode", |
| 9533 | .info = alc_ch_mode_info, |
| 9534 | .get = alc_ch_mode_get, |
| 9535 | .put = alc_ch_mode_put, |
| 9536 | }, |
| 9537 | { } /* end */ |
| 9538 | }; |
| 9539 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9540 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9541 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9542 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9543 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9544 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9545 | spec->autocfg.hp_pins[0] = 0x15; |
| 9546 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9547 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9548 | spec->automute = 1; |
| 9549 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9550 | } |
| 9551 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9552 | static const struct hda_verb alc883_mitac_verbs[] = { |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9553 | /* HP */ |
| 9554 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9555 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9556 | /* Subwoofer */ |
| 9557 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9558 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9559 | |
| 9560 | /* enable unsolicited event */ |
| 9561 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9562 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9563 | |
| 9564 | { } /* end */ |
| 9565 | }; |
| 9566 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9567 | static const struct hda_verb alc883_clevo_m540r_verbs[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9568 | /* HP */ |
| 9569 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9570 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9571 | /* Int speaker */ |
| 9572 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9573 | |
| 9574 | /* enable unsolicited event */ |
| 9575 | /* |
| 9576 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9577 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9578 | */ |
| 9579 | |
| 9580 | { } /* end */ |
| 9581 | }; |
| 9582 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9583 | static const struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9584 | /* HP */ |
| 9585 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9586 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9587 | /* Int speaker */ |
| 9588 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9589 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9590 | |
| 9591 | /* enable unsolicited event */ |
| 9592 | {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] | 9593 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9594 | |
| 9595 | { } /* end */ |
| 9596 | }; |
| 9597 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9598 | static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9599 | /* HP */ |
| 9600 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9602 | /* Subwoofer */ |
| 9603 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9604 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9605 | |
| 9606 | /* enable unsolicited event */ |
| 9607 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9608 | |
| 9609 | { } /* end */ |
| 9610 | }; |
| 9611 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9612 | static const struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9613 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9614 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9615 | |
| 9616 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9617 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9618 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9619 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9620 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9621 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9622 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9623 | /* Connect Mic jack to CLFE */ |
| 9624 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9626 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9627 | /* Connect Line-in jack to Surround */ |
| 9628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9629 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9630 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9631 | /* Connect HP out jack to Front */ |
| 9632 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9633 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9634 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9635 | |
| 9636 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9637 | |
| 9638 | { } /* end */ |
| 9639 | }; |
| 9640 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9641 | static const struct hda_verb alc883_lenovo_101e_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9642 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9643 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9644 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9645 | { } /* end */ |
| 9646 | }; |
| 9647 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9648 | static const struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9649 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9650 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9651 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9652 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9653 | { } /* end */ |
| 9654 | }; |
| 9655 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9656 | static const struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9657 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9658 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9659 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9660 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9661 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9662 | { } /* end */ |
| 9663 | }; |
| 9664 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9665 | static const struct hda_verb alc883_haier_w66_verbs[] = { |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9666 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9667 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9668 | |
| 9669 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9670 | |
| 9671 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9672 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9673 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9674 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9675 | { } /* end */ |
| 9676 | }; |
| 9677 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9678 | static const struct hda_verb alc888_lenovo_sky_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9679 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9681 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9682 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9683 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9684 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9685 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9686 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9687 | { } /* end */ |
| 9688 | }; |
| 9689 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9690 | static const struct hda_verb alc888_6st_dell_verbs[] = { |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9691 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9692 | { } |
| 9693 | }; |
| 9694 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9695 | static const struct hda_verb alc883_vaiott_verbs[] = { |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9696 | /* HP */ |
| 9697 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9698 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9699 | |
| 9700 | /* enable unsolicited event */ |
| 9701 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9702 | |
| 9703 | { } /* end */ |
| 9704 | }; |
| 9705 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9706 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9707 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9708 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9709 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9710 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9711 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9712 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9713 | spec->autocfg.speaker_pins[2] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9714 | spec->automute = 1; |
| 9715 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9716 | } |
| 9717 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9718 | static const struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9719 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9720 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9721 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9722 | {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] | 9723 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9724 | }; |
| 9725 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9726 | /* |
| 9727 | * 2ch mode |
| 9728 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9729 | static const struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9730 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9731 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9732 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9733 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9734 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9735 | }; |
| 9736 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9737 | /* |
| 9738 | * 4ch mode |
| 9739 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9740 | static const struct hda_verb alc888_3st_hp_4ch_init[] = { |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9741 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9742 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9743 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9744 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9745 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9746 | { } /* end */ |
| 9747 | }; |
| 9748 | |
| 9749 | /* |
| 9750 | * 6ch mode |
| 9751 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9752 | static const struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9753 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9754 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9755 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9756 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9757 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9758 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9759 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9760 | }; |
| 9761 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9762 | static const struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9763 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9764 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9765 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9766 | }; |
| 9767 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9768 | static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9769 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9770 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9771 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9772 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9773 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9774 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9775 | spec->automute = 1; |
| 9776 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9777 | } |
| 9778 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9779 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9780 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9781 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9782 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9783 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9784 | spec->autocfg.hp_pins[0] = 0x14; |
| 9785 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9786 | spec->automute = 1; |
| 9787 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9788 | } |
| 9789 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9790 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9791 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9792 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9793 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9794 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9795 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9796 | struct alc_spec *spec = codec->spec; |
| 9797 | |
| 9798 | spec->autocfg.hp_pins[0] = 0x15; |
| 9799 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9800 | spec->automute = 1; |
| 9801 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9802 | } |
| 9803 | |
| 9804 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9805 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9806 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9807 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9808 | } |
| 9809 | |
| 9810 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9811 | unsigned int res) |
| 9812 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9813 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9814 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9815 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9816 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9817 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9818 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9819 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9820 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9821 | } |
| 9822 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9823 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9824 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9825 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9826 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9827 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9828 | spec->autocfg.hp_pins[0] = 0x14; |
| 9829 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9830 | spec->automute = 1; |
| 9831 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9832 | } |
| 9833 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9834 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9835 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9836 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9837 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9838 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9839 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9840 | spec->automute = 1; |
| 9841 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9842 | } |
| 9843 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9844 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9845 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9846 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9847 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9848 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9849 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9850 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9851 | spec->automute = 1; |
| 9852 | spec->detect_line = 1; |
| 9853 | spec->automute_lines = 1; |
| 9854 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9855 | } |
| 9856 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9857 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9858 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9859 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9860 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9861 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9862 | spec->autocfg.hp_pins[0] = 0x14; |
| 9863 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9864 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9865 | spec->automute = 1; |
| 9866 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9867 | } |
| 9868 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9869 | static const struct hda_verb alc883_acer_eapd_verbs[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9870 | /* HP Pin: output 0 (0x0c) */ |
| 9871 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9872 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9873 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9874 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9875 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9876 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9877 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9878 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9879 | /* eanable EAPD on medion laptop */ |
| 9880 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9881 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9882 | /* enable unsolicited event */ |
| 9883 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9884 | { } |
| 9885 | }; |
| 9886 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9887 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9888 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9889 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9890 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9891 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9892 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9893 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9894 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9895 | spec->autocfg.speaker_pins[3] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9896 | spec->automute = 1; |
| 9897 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9898 | } |
| 9899 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9900 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9901 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9902 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9903 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9904 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9905 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9906 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9907 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9908 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9909 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9910 | spec->automute = 1; |
| 9911 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9912 | } |
| 9913 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9914 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9915 | { |
| 9916 | struct alc_spec *spec = codec->spec; |
| 9917 | |
| 9918 | spec->autocfg.hp_pins[0] = 0x15; |
| 9919 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9920 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9921 | spec->automute = 1; |
| 9922 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9923 | } |
| 9924 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9925 | static const struct hda_verb alc888_asus_m90v_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9927 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9929 | /* enable unsolicited event */ |
| 9930 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9931 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9932 | { } /* end */ |
| 9933 | }; |
| 9934 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9935 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9936 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9937 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9938 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9939 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9940 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9941 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9942 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9943 | spec->ext_mic.pin = 0x18; |
| 9944 | spec->int_mic.pin = 0x19; |
| 9945 | spec->ext_mic.mux_idx = 0; |
| 9946 | spec->int_mic.mux_idx = 1; |
| 9947 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9948 | spec->automute = 1; |
| 9949 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9950 | } |
| 9951 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9952 | static const struct hda_verb alc888_asus_eee1601_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9953 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9954 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9956 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9957 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9958 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9959 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9960 | /* enable unsolicited event */ |
| 9961 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9962 | { } /* end */ |
| 9963 | }; |
| 9964 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9965 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9966 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9967 | struct alc_spec *spec = codec->spec; |
| 9968 | |
| 9969 | spec->autocfg.hp_pins[0] = 0x14; |
| 9970 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9971 | alc_hp_automute(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9972 | } |
| 9973 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9974 | static const struct hda_verb alc889A_mb31_verbs[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9975 | /* Init rear pin (used as headphone output) */ |
| 9976 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9977 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9978 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9979 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9980 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9981 | /* Init line 2 pin (used as headphone out by default) */ |
| 9982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9983 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9984 | { } /* end */ |
| 9985 | }; |
| 9986 | |
| 9987 | /* Mute speakers according to the headphone jack state */ |
| 9988 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9989 | { |
| 9990 | unsigned int present; |
| 9991 | |
| 9992 | /* Mute only in 2ch or 4ch mode */ |
| 9993 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9994 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9995 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9996 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9997 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9998 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9999 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 10000 | } |
| 10001 | } |
| 10002 | |
| 10003 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10004 | { |
| 10005 | if ((res >> 26) == ALC880_HP_EVENT) |
| 10006 | alc889A_mb31_automute(codec); |
| 10007 | } |
| 10008 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10009 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10010 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10011 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10012 | #endif |
| 10013 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 10014 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10015 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 10016 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 10017 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 10018 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 10019 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10020 | static const hda_nid_t alc883_slave_dig_outs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10021 | ALC1200_DIGOUT_NID, 0, |
| 10022 | }; |
| 10023 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10024 | static const hda_nid_t alc1200_slave_dig_outs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10025 | ALC883_DIGOUT_NID, 0, |
| 10026 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10027 | |
| 10028 | /* |
| 10029 | * configuration and preset |
| 10030 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 10031 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10032 | [ALC882_3ST_DIG] = "3stack-dig", |
| 10033 | [ALC882_6ST_DIG] = "6stack-dig", |
| 10034 | [ALC882_ARIMA] = "arima", |
| 10035 | [ALC882_W2JC] = "w2jc", |
| 10036 | [ALC882_TARGA] = "targa", |
| 10037 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 10038 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 10039 | [ALC885_MACPRO] = "macpro", |
| 10040 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10041 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10042 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10043 | [ALC885_MBP3] = "mbp3", |
| 10044 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10045 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10046 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10047 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 10048 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10049 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10050 | [ALC883_TARGA_DIG] = "targa-dig", |
| 10051 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10052 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10053 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10054 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10055 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 10056 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10057 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10058 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10059 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10060 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10061 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10062 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10063 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 10064 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10065 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10066 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10067 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10068 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10069 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10070 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10071 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10072 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10073 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10074 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10075 | [ALC889A_INTEL] = "intel-alc889a", |
| 10076 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10077 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10078 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10079 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10080 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10081 | }; |
| 10082 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10083 | static const struct snd_pci_quirk alc882_cfg_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10084 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 10085 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10086 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 10087 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 10088 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10089 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 10090 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 10091 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10092 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 10093 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 10094 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 10095 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10096 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 10097 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 10098 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 10099 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10100 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 10101 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 10102 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 10103 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 10104 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10105 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10106 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 10107 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 10108 | /* default Acer -- disabled as it causes more problems. |
| 10109 | * model=auto should work fine now |
| 10110 | */ |
| 10111 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10112 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10113 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10114 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 10115 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10116 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 10117 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 10118 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 10119 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 10120 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10121 | |
| 10122 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 10123 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 10124 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 10125 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10126 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 10127 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 10128 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10129 | 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] | 10130 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10131 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10132 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10133 | |
| 10134 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 10135 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10136 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10137 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10138 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 10139 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10140 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10141 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | ebb4724 | 2011-05-02 10:37:29 +0200 | [diff] [blame] | 10142 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10143 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10144 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 10145 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 10146 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10147 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 10148 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10149 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10150 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 10151 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10152 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 10153 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 10154 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 10155 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 10156 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 10157 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 10158 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10159 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 10160 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 10161 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 10162 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10163 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10164 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 10165 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 10166 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 10167 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 10168 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 10169 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 10170 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 10171 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 10172 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10173 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 10174 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10175 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10176 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 10177 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10178 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 10179 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10180 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10181 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 10182 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10183 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10184 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 10185 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 10186 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 10187 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10188 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10189 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10190 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10191 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 10192 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10193 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 10194 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 10195 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10196 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10197 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10198 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 10199 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10200 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10201 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 10202 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 10203 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 10204 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10205 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10206 | {} |
| 10207 | }; |
| 10208 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10209 | /* codec SSID table for Intel Mac */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10210 | static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10211 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 10212 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 10213 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 10214 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 10215 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 10216 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 10217 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 10218 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 10219 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), |
Justin P. Mattock | f53dae2 | 2010-06-06 16:09:51 -0700 | [diff] [blame] | 10220 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 10221 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10222 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10223 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10224 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10225 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10226 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10227 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10228 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10229 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10230 | */ |
| 10231 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10232 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10233 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10234 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10235 | }; |
| 10236 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10237 | static const struct alc_config_preset alc882_presets[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10238 | [ALC882_3ST_DIG] = { |
| 10239 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10240 | .init_verbs = { alc882_base_init_verbs, |
| 10241 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10242 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10243 | .dac_nids = alc882_dac_nids, |
| 10244 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10245 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10246 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10247 | .channel_mode = alc882_ch_modes, |
| 10248 | .need_dac_fix = 1, |
| 10249 | .input_mux = &alc882_capture_source, |
| 10250 | }, |
| 10251 | [ALC882_6ST_DIG] = { |
| 10252 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10253 | .init_verbs = { alc882_base_init_verbs, |
| 10254 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10255 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10256 | .dac_nids = alc882_dac_nids, |
| 10257 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10258 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10259 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10260 | .channel_mode = alc882_sixstack_modes, |
| 10261 | .input_mux = &alc882_capture_source, |
| 10262 | }, |
| 10263 | [ALC882_ARIMA] = { |
| 10264 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10265 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10266 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10267 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10268 | .dac_nids = alc882_dac_nids, |
| 10269 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10270 | .channel_mode = alc882_sixstack_modes, |
| 10271 | .input_mux = &alc882_capture_source, |
| 10272 | }, |
| 10273 | [ALC882_W2JC] = { |
| 10274 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10275 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10276 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10277 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10278 | .dac_nids = alc882_dac_nids, |
| 10279 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10280 | .channel_mode = alc880_threestack_modes, |
| 10281 | .need_dac_fix = 1, |
| 10282 | .input_mux = &alc882_capture_source, |
| 10283 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10284 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10285 | [ALC885_MBA21] = { |
| 10286 | .mixers = { alc885_mba21_mixer }, |
| 10287 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10288 | .num_dacs = 2, |
| 10289 | .dac_nids = alc882_dac_nids, |
| 10290 | .channel_mode = alc885_mba21_ch_modes, |
| 10291 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10292 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10293 | .unsol_event = alc_sku_unsol_event, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10294 | .setup = alc885_mba21_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10295 | .init_hook = alc_hp_automute, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10296 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10297 | [ALC885_MBP3] = { |
| 10298 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10299 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10300 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10301 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10302 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10303 | .hp_nid = 0x04, |
| 10304 | .channel_mode = alc885_mbp_4ch_modes, |
| 10305 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10306 | .input_mux = &alc882_capture_source, |
| 10307 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10308 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10309 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10310 | .setup = alc885_mbp3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10311 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10312 | }, |
| 10313 | [ALC885_MB5] = { |
| 10314 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10315 | .init_verbs = { alc885_mb5_init_verbs, |
| 10316 | alc880_gpio1_init_verbs }, |
| 10317 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10318 | .dac_nids = alc882_dac_nids, |
| 10319 | .channel_mode = alc885_mb5_6ch_modes, |
| 10320 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10321 | .input_mux = &mb5_capture_source, |
| 10322 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10323 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10324 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10325 | .setup = alc885_mb5_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10326 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10327 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10328 | [ALC885_MACMINI3] = { |
| 10329 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10330 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10331 | alc880_gpio1_init_verbs }, |
| 10332 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10333 | .dac_nids = alc882_dac_nids, |
| 10334 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10335 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10336 | .input_mux = &macmini3_capture_source, |
| 10337 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10338 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10339 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10340 | .setup = alc885_macmini3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10341 | .init_hook = alc_hp_automute, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10342 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10343 | [ALC885_MACPRO] = { |
| 10344 | .mixers = { alc882_macpro_mixer }, |
| 10345 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10346 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10347 | .dac_nids = alc882_dac_nids, |
| 10348 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10349 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10350 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10351 | .channel_mode = alc882_ch_modes, |
| 10352 | .input_mux = &alc882_capture_source, |
| 10353 | .init_hook = alc885_macpro_init_hook, |
| 10354 | }, |
| 10355 | [ALC885_IMAC24] = { |
| 10356 | .mixers = { alc885_imac24_mixer }, |
| 10357 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10358 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10359 | .dac_nids = alc882_dac_nids, |
| 10360 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10361 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10362 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10363 | .channel_mode = alc882_ch_modes, |
| 10364 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10365 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10366 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10367 | .init_hook = alc885_imac24_init_hook, |
| 10368 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10369 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10370 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10371 | .init_verbs = { alc885_imac91_init_verbs, |
| 10372 | alc880_gpio1_init_verbs }, |
| 10373 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10374 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10375 | .channel_mode = alc885_mba21_ch_modes, |
| 10376 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10377 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10378 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10379 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10380 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10381 | .setup = alc885_imac91_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10382 | .init_hook = alc_hp_automute, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10383 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10384 | [ALC882_TARGA] = { |
| 10385 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10386 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10387 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10388 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10389 | .dac_nids = alc882_dac_nids, |
| 10390 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10391 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10392 | .adc_nids = alc882_adc_nids, |
| 10393 | .capsrc_nids = alc882_capsrc_nids, |
| 10394 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10395 | .channel_mode = alc882_3ST_6ch_modes, |
| 10396 | .need_dac_fix = 1, |
| 10397 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10398 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10399 | .setup = alc882_targa_setup, |
| 10400 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10401 | }, |
| 10402 | [ALC882_ASUS_A7J] = { |
| 10403 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10404 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10405 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10406 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10407 | .dac_nids = alc882_dac_nids, |
| 10408 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10409 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10410 | .adc_nids = alc882_adc_nids, |
| 10411 | .capsrc_nids = alc882_capsrc_nids, |
| 10412 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10413 | .channel_mode = alc882_3ST_6ch_modes, |
| 10414 | .need_dac_fix = 1, |
| 10415 | .input_mux = &alc882_capture_source, |
| 10416 | }, |
| 10417 | [ALC882_ASUS_A7M] = { |
| 10418 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10419 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10420 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10421 | alc882_asus_a7m_verbs }, |
| 10422 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10423 | .dac_nids = alc882_dac_nids, |
| 10424 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10425 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10426 | .channel_mode = alc880_threestack_modes, |
| 10427 | .need_dac_fix = 1, |
| 10428 | .input_mux = &alc882_capture_source, |
| 10429 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10430 | [ALC883_3ST_2ch_DIG] = { |
| 10431 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10432 | .init_verbs = { alc883_init_verbs }, |
| 10433 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10434 | .dac_nids = alc883_dac_nids, |
| 10435 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10436 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10437 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10438 | .channel_mode = alc883_3ST_2ch_modes, |
| 10439 | .input_mux = &alc883_capture_source, |
| 10440 | }, |
| 10441 | [ALC883_3ST_6ch_DIG] = { |
| 10442 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10443 | .init_verbs = { alc883_init_verbs }, |
| 10444 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10445 | .dac_nids = alc883_dac_nids, |
| 10446 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10447 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10448 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10449 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10450 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10451 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10452 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10453 | [ALC883_3ST_6ch] = { |
| 10454 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10455 | .init_verbs = { alc883_init_verbs }, |
| 10456 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10457 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10458 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10459 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10460 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10461 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10462 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10463 | [ALC883_3ST_6ch_INTEL] = { |
| 10464 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10465 | .init_verbs = { alc883_init_verbs }, |
| 10466 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10467 | .dac_nids = alc883_dac_nids, |
| 10468 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10469 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10470 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10471 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10472 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10473 | .need_dac_fix = 1, |
| 10474 | .input_mux = &alc883_3stack_6ch_intel, |
| 10475 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10476 | [ALC889A_INTEL] = { |
| 10477 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10478 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10479 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10480 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10481 | .dac_nids = alc883_dac_nids, |
| 10482 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10483 | .adc_nids = alc889_adc_nids, |
| 10484 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10485 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10486 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10487 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10488 | .channel_mode = alc889_8ch_intel_modes, |
| 10489 | .capsrc_nids = alc889_capsrc_nids, |
| 10490 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10491 | .setup = alc889_automute_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10492 | .init_hook = alc_hp_automute, |
| 10493 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10494 | .need_dac_fix = 1, |
| 10495 | }, |
| 10496 | [ALC889_INTEL] = { |
| 10497 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10498 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10499 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10500 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10501 | .dac_nids = alc883_dac_nids, |
| 10502 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10503 | .adc_nids = alc889_adc_nids, |
| 10504 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10505 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10506 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10507 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10508 | .channel_mode = alc889_8ch_intel_modes, |
| 10509 | .capsrc_nids = alc889_capsrc_nids, |
| 10510 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10511 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10512 | .init_hook = alc889_intel_init_hook, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10513 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10514 | .need_dac_fix = 1, |
| 10515 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10516 | [ALC883_6ST_DIG] = { |
| 10517 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10518 | .init_verbs = { alc883_init_verbs }, |
| 10519 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10520 | .dac_nids = alc883_dac_nids, |
| 10521 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10522 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10523 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10524 | .channel_mode = alc883_sixstack_modes, |
| 10525 | .input_mux = &alc883_capture_source, |
| 10526 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10527 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10528 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10529 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10530 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10531 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10532 | .dac_nids = alc883_dac_nids, |
| 10533 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10534 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10535 | .channel_mode = alc883_3ST_6ch_modes, |
| 10536 | .need_dac_fix = 1, |
| 10537 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10538 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10539 | .setup = alc882_targa_setup, |
| 10540 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10541 | }, |
| 10542 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10543 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10544 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10545 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10546 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10547 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10548 | .adc_nids = alc883_adc_nids_alt, |
| 10549 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10550 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10551 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10552 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10553 | .channel_mode = alc883_3ST_2ch_modes, |
| 10554 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10555 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10556 | .setup = alc882_targa_setup, |
| 10557 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10558 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10559 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10560 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10561 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10562 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10563 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10564 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10565 | .dac_nids = alc883_dac_nids, |
| 10566 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10567 | .adc_nids = alc883_adc_nids_rev, |
| 10568 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10569 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10570 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10571 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10572 | .channel_mode = alc883_4ST_8ch_modes, |
| 10573 | .need_dac_fix = 1, |
| 10574 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10575 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10576 | .setup = alc882_targa_setup, |
| 10577 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10578 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10579 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10580 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10581 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10582 | * and the headphone jack. Turn this on and rely on the |
| 10583 | * standard mute methods whenever the user wants to turn |
| 10584 | * these outputs off. |
| 10585 | */ |
| 10586 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10587 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10588 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10589 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10590 | .channel_mode = alc883_3ST_2ch_modes, |
| 10591 | .input_mux = &alc883_capture_source, |
| 10592 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10593 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10594 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10595 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10596 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10597 | .dac_nids = alc883_dac_nids, |
| 10598 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10599 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10600 | .channel_mode = alc883_3ST_2ch_modes, |
| 10601 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10602 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10603 | .setup = alc883_acer_aspire_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10604 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10605 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10606 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10607 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10608 | alc883_chmode_mixer }, |
| 10609 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10610 | alc888_acer_aspire_4930g_verbs }, |
| 10611 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10612 | .dac_nids = alc883_dac_nids, |
| 10613 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10614 | .adc_nids = alc883_adc_nids_rev, |
| 10615 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10616 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10617 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10618 | .channel_mode = alc883_3ST_6ch_modes, |
| 10619 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10620 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10621 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10622 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10623 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10624 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10625 | .setup = alc888_acer_aspire_4930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10626 | .init_hook = alc_hp_automute, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10627 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10628 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10629 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10630 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10631 | alc888_acer_aspire_6530g_verbs }, |
| 10632 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10633 | .dac_nids = alc883_dac_nids, |
| 10634 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10635 | .adc_nids = alc883_adc_nids_rev, |
| 10636 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10637 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10638 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10639 | .channel_mode = alc883_3ST_2ch_modes, |
| 10640 | .num_mux_defs = |
| 10641 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10642 | .input_mux = alc888_acer_aspire_6530_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10643 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10644 | .setup = alc888_acer_aspire_6530g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10645 | .init_hook = alc_hp_automute, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10646 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10647 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10648 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10649 | alc883_chmode_mixer }, |
| 10650 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10651 | alc889_acer_aspire_8930g_verbs, |
| 10652 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10653 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10654 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10655 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10656 | .adc_nids = alc889_adc_nids, |
| 10657 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10658 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10659 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10660 | .channel_mode = alc883_3ST_6ch_modes, |
| 10661 | .need_dac_fix = 1, |
| 10662 | .const_channel_count = 6, |
| 10663 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10664 | ARRAY_SIZE(alc889_capture_sources), |
| 10665 | .input_mux = alc889_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10666 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10667 | .setup = alc889_acer_aspire_8930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10668 | .init_hook = alc_hp_automute, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10669 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10670 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10671 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10672 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10673 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10674 | .mixers = { alc883_3ST_6ch_mixer, |
| 10675 | alc883_chmode_mixer }, |
| 10676 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10677 | alc888_acer_aspire_7730G_verbs }, |
| 10678 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10679 | .dac_nids = alc883_dac_nids, |
| 10680 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10681 | .adc_nids = alc883_adc_nids_rev, |
| 10682 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10683 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10684 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10685 | .channel_mode = alc883_3ST_6ch_modes, |
| 10686 | .need_dac_fix = 1, |
| 10687 | .const_channel_count = 6, |
| 10688 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10689 | .unsol_event = alc_sku_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10690 | .setup = alc888_acer_aspire_7730g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10691 | .init_hook = alc_hp_automute, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10692 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10693 | [ALC883_MEDION] = { |
| 10694 | .mixers = { alc883_fivestack_mixer, |
| 10695 | alc883_chmode_mixer }, |
| 10696 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10697 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10698 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10699 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10700 | .adc_nids = alc883_adc_nids_alt, |
| 10701 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10702 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10703 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10704 | .channel_mode = alc883_sixstack_modes, |
| 10705 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10706 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10707 | [ALC883_MEDION_WIM2160] = { |
| 10708 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10709 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10710 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10711 | .dac_nids = alc883_dac_nids, |
| 10712 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10713 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10714 | .adc_nids = alc883_adc_nids, |
| 10715 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10716 | .channel_mode = alc883_3ST_2ch_modes, |
| 10717 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10718 | .unsol_event = alc_sku_unsol_event, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10719 | .setup = alc883_medion_wim2160_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10720 | .init_hook = alc_hp_automute, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10721 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10722 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10723 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10724 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10725 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10726 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10727 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10728 | .channel_mode = alc883_3ST_2ch_modes, |
| 10729 | .input_mux = &alc883_capture_source, |
| 10730 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10731 | [ALC883_CLEVO_M540R] = { |
| 10732 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10733 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10734 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10735 | .dac_nids = alc883_dac_nids, |
| 10736 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10737 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10738 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10739 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10740 | .need_dac_fix = 1, |
| 10741 | .input_mux = &alc883_capture_source, |
| 10742 | /* This machine has the hardware HP auto-muting, thus |
| 10743 | * we need no software mute via unsol event |
| 10744 | */ |
| 10745 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10746 | [ALC883_CLEVO_M720] = { |
| 10747 | .mixers = { alc883_clevo_m720_mixer }, |
| 10748 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10749 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10750 | .dac_nids = alc883_dac_nids, |
| 10751 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10752 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10753 | .channel_mode = alc883_3ST_2ch_modes, |
| 10754 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10755 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10756 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10757 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10758 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10759 | [ALC883_LENOVO_101E_2ch] = { |
| 10760 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10761 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10762 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10763 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10764 | .adc_nids = alc883_adc_nids_alt, |
| 10765 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10766 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10767 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10768 | .channel_mode = alc883_3ST_2ch_modes, |
| 10769 | .input_mux = &alc883_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10770 | .setup = alc883_lenovo_101e_setup, |
| 10771 | .unsol_event = alc_sku_unsol_event, |
| 10772 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10773 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10774 | [ALC883_LENOVO_NB0763] = { |
| 10775 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10776 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10777 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10778 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10779 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10780 | .channel_mode = alc883_3ST_2ch_modes, |
| 10781 | .need_dac_fix = 1, |
| 10782 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10783 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10784 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10785 | .init_hook = alc_hp_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10786 | }, |
| 10787 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10788 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10789 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10790 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10791 | .dac_nids = alc883_dac_nids, |
| 10792 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10793 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10794 | .channel_mode = alc883_3ST_6ch_modes, |
| 10795 | .need_dac_fix = 1, |
| 10796 | .input_mux = &alc883_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10797 | .unsol_event = alc_sku_unsol_event, |
| 10798 | .setup = alc888_lenovo_ms7195_setup, |
| 10799 | .init_hook = alc_inithook, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10800 | }, |
| 10801 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10802 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10803 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10804 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10805 | .dac_nids = alc883_dac_nids, |
| 10806 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10807 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10808 | .channel_mode = alc883_3ST_2ch_modes, |
| 10809 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10810 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10811 | .setup = alc883_haier_w66_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10812 | .init_hook = alc_hp_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10813 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10814 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10815 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10816 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10817 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10818 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10819 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10820 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10821 | .need_dac_fix = 1, |
| 10822 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10823 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10824 | .setup = alc888_3st_hp_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10825 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10826 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10827 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10828 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10829 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10830 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10831 | .dac_nids = alc883_dac_nids, |
| 10832 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10833 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10834 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10835 | .channel_mode = alc883_sixstack_modes, |
| 10836 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10837 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10838 | .setup = alc888_6st_dell_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10839 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10840 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10841 | [ALC883_MITAC] = { |
| 10842 | .mixers = { alc883_mitac_mixer }, |
| 10843 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10844 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10845 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10846 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10847 | .channel_mode = alc883_3ST_2ch_modes, |
| 10848 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10849 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10850 | .setup = alc883_mitac_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10851 | .init_hook = alc_hp_automute, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10852 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10853 | [ALC883_FUJITSU_PI2515] = { |
| 10854 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10855 | .init_verbs = { alc883_init_verbs, |
| 10856 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10857 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10858 | .dac_nids = alc883_dac_nids, |
| 10859 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10860 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10861 | .channel_mode = alc883_3ST_2ch_modes, |
| 10862 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10863 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10864 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10865 | .init_hook = alc_hp_automute, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10866 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10867 | [ALC888_FUJITSU_XA3530] = { |
| 10868 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10869 | .init_verbs = { alc883_init_verbs, |
| 10870 | alc888_fujitsu_xa3530_verbs }, |
| 10871 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10872 | .dac_nids = alc883_dac_nids, |
| 10873 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10874 | .adc_nids = alc883_adc_nids_rev, |
| 10875 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10876 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10877 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10878 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10879 | .num_mux_defs = |
| 10880 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10881 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10882 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10883 | .setup = alc888_fujitsu_xa3530_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10884 | .init_hook = alc_hp_automute, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10885 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10886 | [ALC888_LENOVO_SKY] = { |
| 10887 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10888 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10889 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10890 | .dac_nids = alc883_dac_nids, |
| 10891 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10892 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10893 | .channel_mode = alc883_sixstack_modes, |
| 10894 | .need_dac_fix = 1, |
| 10895 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10896 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10897 | .setup = alc888_lenovo_sky_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10898 | .init_hook = alc_hp_automute, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10899 | }, |
| 10900 | [ALC888_ASUS_M90V] = { |
| 10901 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10902 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10903 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10904 | .dac_nids = alc883_dac_nids, |
| 10905 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10906 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10907 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10908 | .channel_mode = alc883_3ST_6ch_modes, |
| 10909 | .need_dac_fix = 1, |
| 10910 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10911 | .unsol_event = alc_sku_unsol_event, |
| 10912 | .setup = alc883_mode2_setup, |
| 10913 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10914 | }, |
| 10915 | [ALC888_ASUS_EEE1601] = { |
| 10916 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10917 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10918 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10919 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10920 | .dac_nids = alc883_dac_nids, |
| 10921 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10922 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10923 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10924 | .channel_mode = alc883_3ST_2ch_modes, |
| 10925 | .need_dac_fix = 1, |
| 10926 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10927 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10928 | .init_hook = alc883_eee1601_inithook, |
| 10929 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10930 | [ALC1200_ASUS_P5Q] = { |
| 10931 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10932 | .init_verbs = { alc883_init_verbs }, |
| 10933 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10934 | .dac_nids = alc883_dac_nids, |
| 10935 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10936 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10937 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10938 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10939 | .channel_mode = alc883_sixstack_modes, |
| 10940 | .input_mux = &alc883_capture_source, |
| 10941 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10942 | [ALC889A_MB31] = { |
| 10943 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10944 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10945 | alc880_gpio1_init_verbs }, |
| 10946 | .adc_nids = alc883_adc_nids, |
| 10947 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10948 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10949 | .dac_nids = alc883_dac_nids, |
| 10950 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10951 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10952 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10953 | .input_mux = &alc889A_mb31_capture_source, |
| 10954 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10955 | .unsol_event = alc889A_mb31_unsol_event, |
| 10956 | .init_hook = alc889A_mb31_automute, |
| 10957 | }, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10958 | [ALC883_SONY_VAIO_TT] = { |
| 10959 | .mixers = { alc883_vaiott_mixer }, |
| 10960 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10961 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10962 | .dac_nids = alc883_dac_nids, |
| 10963 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10964 | .channel_mode = alc883_3ST_2ch_modes, |
| 10965 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10966 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10967 | .setup = alc883_vaiott_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10968 | .init_hook = alc_hp_automute, |
Guido Günther | 3e1647c5 | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10969 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10970 | }; |
| 10971 | |
| 10972 | |
| 10973 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10974 | * Pin config fixes |
| 10975 | */ |
| 10976 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10977 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10978 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10979 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10980 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10981 | }; |
| 10982 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10983 | static const struct alc_fixup alc882_fixups[] = { |
| 10984 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10985 | .type = ALC_FIXUP_PINS, |
| 10986 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10987 | { 0x15, 0x01080104 }, /* side */ |
| 10988 | { 0x16, 0x01011012 }, /* rear */ |
| 10989 | { 0x17, 0x01016011 }, /* clfe */ |
| 10990 | { } |
| 10991 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10992 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10993 | [PINFIX_LENOVO_Y530] = { |
| 10994 | .type = ALC_FIXUP_PINS, |
| 10995 | .v.pins = (const struct alc_pincfg[]) { |
| 10996 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10997 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10998 | { } |
| 10999 | } |
| 11000 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 11001 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11002 | .type = ALC_FIXUP_VERBS, |
| 11003 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 11004 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 11005 | {} |
| 11006 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 11007 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 11008 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11009 | .type = ALC_FIXUP_SKU, |
| 11010 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 11011 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11012 | }; |
| 11013 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11014 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 11015 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 11016 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11017 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 11018 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11019 | {} |
| 11020 | }; |
| 11021 | |
| 11022 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11023 | * BIOS auto configuration |
| 11024 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11025 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 11026 | const struct auto_pin_cfg *cfg) |
| 11027 | { |
| 11028 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 11029 | } |
| 11030 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11031 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11032 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11033 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11034 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11035 | int idx; |
| 11036 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11037 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11038 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11039 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11040 | if (dac == 0x25) |
| 11041 | idx = 4; |
| 11042 | else if (dac >= 0x02 && dac <= 0x05) |
| 11043 | idx = dac - 2; |
| 11044 | else |
| 11045 | return; |
| 11046 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11047 | } |
| 11048 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11049 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11050 | { |
| 11051 | struct alc_spec *spec = codec->spec; |
| 11052 | int i; |
| 11053 | |
| 11054 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11055 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11056 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11057 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11058 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11059 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11060 | } |
| 11061 | } |
| 11062 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11063 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11064 | { |
| 11065 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11066 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 11067 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11068 | |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 11069 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
| 11070 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 11071 | pin = spec->autocfg.hp_pins[i]; |
| 11072 | if (!pin) |
| 11073 | break; |
| 11074 | dac = spec->multiout.hp_nid; |
| 11075 | if (!dac) |
| 11076 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 11077 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 11078 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11079 | } |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 11080 | |
| 11081 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11082 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 11083 | pin = spec->autocfg.speaker_pins[i]; |
| 11084 | if (!pin) |
| 11085 | break; |
| 11086 | dac = spec->multiout.extra_out_nid[0]; |
| 11087 | if (!dac) |
| 11088 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 11089 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 11090 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11091 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11092 | } |
| 11093 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11094 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11095 | { |
| 11096 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11097 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11098 | int i; |
| 11099 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11100 | for (i = 0; i < cfg->num_inputs; i++) { |
| 11101 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 11102 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11103 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 11104 | snd_hda_codec_write(codec, nid, 0, |
| 11105 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11106 | AMP_OUT_MUTE); |
| 11107 | } |
| 11108 | } |
| 11109 | |
| 11110 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 11111 | { |
| 11112 | struct alc_spec *spec = codec->spec; |
| 11113 | int c; |
| 11114 | |
| 11115 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 11116 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 11117 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 11118 | unsigned int mux_idx; |
| 11119 | const struct hda_input_mux *imux; |
| 11120 | int conns, mute, idx, item; |
| 11121 | |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 11122 | /* mute ADC */ |
| 11123 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 11124 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11125 | AMP_IN_MUTE(0)); |
| 11126 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11127 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 11128 | ARRAY_SIZE(conn_list)); |
| 11129 | if (conns < 0) |
| 11130 | continue; |
| 11131 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 11132 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 11133 | if (!imux->num_items && mux_idx > 0) |
| 11134 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11135 | for (idx = 0; idx < conns; idx++) { |
| 11136 | /* if the current connection is the selected one, |
| 11137 | * unmute it as default - otherwise mute it |
| 11138 | */ |
| 11139 | mute = AMP_IN_MUTE(idx); |
| 11140 | for (item = 0; item < imux->num_items; item++) { |
| 11141 | if (imux->items[item].index == idx) { |
| 11142 | if (spec->cur_mux[c] == item) |
| 11143 | mute = AMP_IN_UNMUTE(idx); |
| 11144 | break; |
| 11145 | } |
| 11146 | } |
| 11147 | /* check if we have a selector or mixer |
| 11148 | * we could check for the widget type instead, but |
| 11149 | * just check for Amp-In presence (in case of mixer |
| 11150 | * without amp-in there is something wrong, this |
| 11151 | * function shouldn't be used or capsrc nid is wrong) |
| 11152 | */ |
| 11153 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11154 | snd_hda_codec_write(codec, nid, 0, |
| 11155 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11156 | mute); |
| 11157 | else if (mute != AMP_IN_MUTE(idx)) |
| 11158 | snd_hda_codec_write(codec, nid, 0, |
| 11159 | AC_VERB_SET_CONNECT_SEL, |
| 11160 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11161 | } |
| 11162 | } |
| 11163 | } |
| 11164 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11165 | /* add mic boosts if needed */ |
| 11166 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11167 | { |
| 11168 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11169 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11170 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11171 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11172 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11173 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11174 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11175 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 11176 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11177 | break; |
| 11178 | nid = cfg->inputs[i].pin; |
| 11179 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11180 | const char *label; |
| 11181 | char boost_label[32]; |
| 11182 | |
| 11183 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 11184 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11185 | type_idx++; |
| 11186 | else |
| 11187 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11188 | prev_label = label; |
| 11189 | |
| 11190 | snprintf(boost_label, sizeof(boost_label), |
| 11191 | "%s Boost Volume", label); |
| 11192 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11193 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11194 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11195 | if (err < 0) |
| 11196 | return err; |
| 11197 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11198 | } |
| 11199 | return 0; |
| 11200 | } |
| 11201 | |
| 11202 | /* almost identical with ALC880 parser... */ |
| 11203 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 11204 | { |
| 11205 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11206 | static const hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11207 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11208 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11209 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11210 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11211 | if (err < 0) |
| 11212 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11213 | if (!spec->autocfg.line_outs) |
| 11214 | return 0; /* can't find valid BIOS pin config */ |
| 11215 | |
| 11216 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11217 | if (err < 0) |
| 11218 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 11219 | err = alc_auto_add_multi_channel_mode(codec); |
| 11220 | if (err < 0) |
| 11221 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 11222 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11223 | if (err < 0) |
| 11224 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11225 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11226 | "Headphone"); |
| 11227 | if (err < 0) |
| 11228 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11229 | err = alc880_auto_create_extra_out(spec, |
| 11230 | spec->autocfg.speaker_pins[0], |
| 11231 | "Speaker"); |
| 11232 | if (err < 0) |
| 11233 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11234 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 11235 | if (err < 0) |
| 11236 | return err; |
| 11237 | |
| 11238 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11239 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11240 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11241 | |
| 11242 | if (spec->kctls.list) |
| 11243 | add_mixer(spec, spec->kctls.list); |
| 11244 | |
| 11245 | add_verb(spec, alc883_auto_init_verbs); |
| 11246 | /* if ADC 0x07 is available, initialize it, too */ |
| 11247 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 11248 | add_verb(spec, alc882_adc1_init_verbs); |
| 11249 | |
| 11250 | spec->num_mux_defs = 1; |
| 11251 | spec->input_mux = &spec->private_imux[0]; |
| 11252 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11253 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11254 | |
| 11255 | err = alc_auto_add_mic_boost(codec); |
| 11256 | if (err < 0) |
| 11257 | return err; |
| 11258 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11259 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11260 | } |
| 11261 | |
| 11262 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11263 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11264 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11265 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11266 | alc882_auto_init_multi_out(codec); |
| 11267 | alc882_auto_init_hp_out(codec); |
| 11268 | alc882_auto_init_analog_input(codec); |
| 11269 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11270 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11271 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11272 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11273 | } |
| 11274 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11275 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11276 | { |
| 11277 | struct alc_spec *spec; |
| 11278 | int err, board_config; |
| 11279 | |
| 11280 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11281 | if (spec == NULL) |
| 11282 | return -ENOMEM; |
| 11283 | |
| 11284 | codec->spec = spec; |
| 11285 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11286 | switch (codec->vendor_id) { |
| 11287 | case 0x10ec0882: |
| 11288 | case 0x10ec0885: |
| 11289 | break; |
| 11290 | default: |
| 11291 | /* ALC883 and variants */ |
| 11292 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11293 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11294 | } |
| 11295 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11296 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11297 | alc882_models, |
| 11298 | alc882_cfg_tbl); |
| 11299 | |
| 11300 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11301 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11302 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11303 | |
| 11304 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11305 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11306 | codec->chip_name); |
| 11307 | board_config = ALC882_AUTO; |
| 11308 | } |
| 11309 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11310 | if (board_config == ALC882_AUTO) { |
| 11311 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11312 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11313 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11314 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11315 | alc_auto_parse_customize_define(codec); |
| 11316 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11317 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11318 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11319 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11320 | if (err < 0) { |
| 11321 | alc_free(codec); |
| 11322 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11323 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11324 | printk(KERN_INFO |
| 11325 | "hda_codec: Cannot set up configuration " |
| 11326 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11327 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11328 | } |
| 11329 | } |
| 11330 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11331 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11332 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11333 | if (err < 0) { |
| 11334 | alc_free(codec); |
| 11335 | return err; |
| 11336 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11337 | } |
| 11338 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11339 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11340 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11341 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11342 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11343 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11344 | /* FIXME: setup DAC5 */ |
| 11345 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11346 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11347 | |
| 11348 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11349 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11350 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11351 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11352 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11353 | spec->num_adc_nids = 0; |
| 11354 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11355 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11356 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11357 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11358 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11359 | unsigned int wcap = get_wcaps(codec, nid); |
| 11360 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11361 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11362 | if (wcap != AC_WID_AUD_IN) |
| 11363 | continue; |
| 11364 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11365 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11366 | if (err < 0) |
| 11367 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11368 | err = snd_hda_get_connections(codec, cap, items, |
| 11369 | ARRAY_SIZE(items)); |
| 11370 | if (err < 0) |
| 11371 | continue; |
| 11372 | for (j = 0; j < imux->num_items; j++) |
| 11373 | if (imux->items[j].index >= err) |
| 11374 | break; |
| 11375 | if (j < imux->num_items) |
| 11376 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11377 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11378 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11379 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11380 | spec->adc_nids = spec->private_adc_nids; |
| 11381 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11382 | } |
| 11383 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11384 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11385 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11386 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11387 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11388 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11389 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11390 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11391 | spec->vmaster_nid = 0x0c; |
| 11392 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11393 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11394 | if (board_config == ALC882_AUTO) |
| 11395 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11396 | |
| 11397 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11398 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11399 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11400 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11401 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11402 | |
| 11403 | return 0; |
| 11404 | } |
| 11405 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11406 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11407 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11408 | * ALC262 support |
| 11409 | */ |
| 11410 | |
| 11411 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11412 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11413 | |
| 11414 | #define alc262_dac_nids alc260_dac_nids |
| 11415 | #define alc262_adc_nids alc882_adc_nids |
| 11416 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11417 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11418 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11419 | |
| 11420 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11421 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11422 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11423 | static const hda_nid_t alc262_dmic_adc_nids[1] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11424 | /* ADC0 */ |
| 11425 | 0x09 |
| 11426 | }; |
| 11427 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11428 | static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11429 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11430 | static const struct snd_kcontrol_new alc262_base_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11431 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11432 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11433 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11434 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11435 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11436 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11439 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11440 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11441 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11442 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11443 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11444 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11445 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11446 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11447 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11448 | }; |
| 11449 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11450 | /* update HP, line and mono-out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11451 | #define alc262_hp_master_update alc260_hp_master_update |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11452 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11453 | static void alc262_hp_bpc_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11454 | { |
| 11455 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11456 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11457 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11458 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11459 | spec->automute = 1; |
| 11460 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11461 | } |
| 11462 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11463 | static void alc262_hp_wildwest_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11464 | { |
| 11465 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11466 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11467 | spec->autocfg.hp_pins[0] = 0x15; |
| 11468 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11469 | spec->automute = 1; |
| 11470 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11471 | } |
| 11472 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11473 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11474 | #define alc262_hp_master_sw_put alc260_hp_master_sw_put |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11475 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11476 | #define ALC262_HP_MASTER_SWITCH \ |
| 11477 | { \ |
| 11478 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11479 | .name = "Master Playback Switch", \ |
| 11480 | .info = snd_ctl_boolean_mono_info, \ |
| 11481 | .get = alc262_hp_master_sw_get, \ |
| 11482 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11483 | }, \ |
| 11484 | { \ |
| 11485 | .iface = NID_MAPPING, \ |
| 11486 | .name = "Master Playback Switch", \ |
| 11487 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11488 | } |
| 11489 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11490 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11491 | static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11492 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11493 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11494 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11496 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11497 | HDA_OUTPUT), |
| 11498 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11499 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11502 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11504 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11505 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11506 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11507 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11508 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11509 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11510 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11511 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11512 | { } /* end */ |
| 11513 | }; |
| 11514 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11515 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11516 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11518 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11519 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11520 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11521 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11522 | HDA_OUTPUT), |
| 11523 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11524 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11525 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11526 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11527 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11528 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11529 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11530 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11531 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11532 | { } /* end */ |
| 11533 | }; |
| 11534 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11535 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11536 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11537 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11538 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11539 | { } /* end */ |
| 11540 | }; |
| 11541 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11542 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11543 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11544 | { |
| 11545 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11546 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11547 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11548 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11549 | spec->automute = 1; |
| 11550 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11551 | } |
| 11552 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11553 | static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11554 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11555 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11556 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11557 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11558 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11559 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11560 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11561 | { } /* end */ |
| 11562 | }; |
| 11563 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11564 | static const struct hda_verb alc262_hp_t5735_verbs[] = { |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11565 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11566 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11567 | |
| 11568 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11569 | { } |
| 11570 | }; |
| 11571 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11572 | static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11573 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11574 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11575 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11576 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11577 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11578 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11579 | { } /* end */ |
| 11580 | }; |
| 11581 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11582 | static const struct hda_verb alc262_hp_rp5700_verbs[] = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11583 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11584 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11585 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11586 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11587 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11588 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11589 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11590 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11591 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11592 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11593 | {} |
| 11594 | }; |
| 11595 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11596 | static const struct hda_input_mux alc262_hp_rp5700_capture_source = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11597 | .num_items = 1, |
| 11598 | .items = { |
| 11599 | { "Line", 0x1 }, |
| 11600 | }, |
| 11601 | }; |
| 11602 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11603 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11604 | #define alc262_hippo_master_update alc262_hp_master_update |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11605 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11606 | #define alc262_hippo_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11607 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11608 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11609 | { \ |
| 11610 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11611 | .name = "Master Playback Switch", \ |
| 11612 | .info = snd_ctl_boolean_mono_info, \ |
| 11613 | .get = alc262_hippo_master_sw_get, \ |
| 11614 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11615 | }, \ |
| 11616 | { \ |
| 11617 | .iface = NID_MAPPING, \ |
| 11618 | .name = "Master Playback Switch", \ |
| 11619 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11620 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11621 | } |
| 11622 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11623 | static const struct snd_kcontrol_new alc262_hippo_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11624 | ALC262_HIPPO_MASTER_SWITCH, |
| 11625 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11626 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11627 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11628 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11629 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11630 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11631 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11632 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11633 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11634 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11635 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11636 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11637 | { } /* end */ |
| 11638 | }; |
| 11639 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11640 | static const struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11641 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11642 | ALC262_HIPPO_MASTER_SWITCH, |
| 11643 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11644 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11646 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11647 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11649 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11650 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11651 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11652 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11653 | { } /* end */ |
| 11654 | }; |
| 11655 | |
| 11656 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11657 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11658 | { |
| 11659 | struct alc_spec *spec = codec->spec; |
| 11660 | |
| 11661 | spec->autocfg.hp_pins[0] = 0x15; |
| 11662 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11663 | spec->automute = 1; |
| 11664 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11665 | } |
| 11666 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11667 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11668 | { |
| 11669 | struct alc_spec *spec = codec->spec; |
| 11670 | |
| 11671 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11672 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11673 | spec->automute = 1; |
| 11674 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11675 | } |
| 11676 | |
| 11677 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11678 | static const struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11679 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11680 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11683 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11684 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11685 | { } /* end */ |
| 11686 | }; |
| 11687 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11688 | static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11689 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11690 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11691 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11692 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11694 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11695 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11696 | { } /* end */ |
| 11697 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11698 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11699 | static const struct snd_kcontrol_new alc262_tyan_mixer[] = { |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11700 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11701 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11702 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11703 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11704 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11705 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11708 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11709 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11710 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11711 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11712 | { } /* end */ |
| 11713 | }; |
| 11714 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11715 | static const struct hda_verb alc262_tyan_verbs[] = { |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11716 | /* Headphone automute */ |
| 11717 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11718 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11719 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11720 | |
| 11721 | /* P11 AUX_IN, white 4-pin connector */ |
| 11722 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11723 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11724 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11725 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11726 | |
| 11727 | {} |
| 11728 | }; |
| 11729 | |
| 11730 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11731 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11732 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11733 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11734 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11735 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11736 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11737 | spec->automute = 1; |
| 11738 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11739 | } |
| 11740 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11741 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11742 | #define alc262_capture_mixer alc882_capture_mixer |
| 11743 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11744 | |
| 11745 | /* |
| 11746 | * generic initialization of ADC, input mixers and output mixers |
| 11747 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11748 | static const struct hda_verb alc262_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11749 | /* |
| 11750 | * Unmute ADC0-2 and set the default input to mic-in |
| 11751 | */ |
| 11752 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11754 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11755 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11756 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11757 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11758 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11759 | /* 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] | 11760 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11761 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11762 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11763 | */ |
| 11764 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11770 | |
| 11771 | /* |
| 11772 | * Set up output mixers (0x0c - 0x0e) |
| 11773 | */ |
| 11774 | /* set vol=0 to output mixers */ |
| 11775 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11776 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11777 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11778 | /* set up input amps for analog loopback */ |
| 11779 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11782 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11783 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11784 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11785 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11786 | |
| 11787 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11789 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11790 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11791 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11792 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11793 | |
| 11794 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11795 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11796 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11797 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11798 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11800 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11801 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11802 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11803 | /* FIXME: use matrix-type input source selection */ |
| 11804 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11805 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11807 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11808 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11809 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11810 | /* Input mixer2 */ |
| 11811 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11812 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11813 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11814 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11815 | /* Input mixer3 */ |
| 11816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11817 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11818 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11820 | |
| 11821 | { } |
| 11822 | }; |
| 11823 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11824 | static const struct hda_verb alc262_eapd_verbs[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11825 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11826 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11827 | { } |
| 11828 | }; |
| 11829 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11830 | static const struct hda_verb alc262_hippo1_unsol_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11831 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11832 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11833 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11834 | |
| 11835 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11836 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11837 | {} |
| 11838 | }; |
| 11839 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11840 | static const struct hda_verb alc262_sony_unsol_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11841 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11842 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11843 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11844 | |
| 11845 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11847 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11848 | }; |
| 11849 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11850 | static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11851 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11852 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11853 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11854 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11855 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11856 | { } /* end */ |
| 11857 | }; |
| 11858 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11859 | static const struct hda_verb alc262_toshiba_s06_verbs[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11860 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11861 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11862 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11863 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11864 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11865 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11866 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11867 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11868 | {} |
| 11869 | }; |
| 11870 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11871 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11872 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11873 | struct alc_spec *spec = codec->spec; |
| 11874 | |
| 11875 | spec->autocfg.hp_pins[0] = 0x15; |
| 11876 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11877 | spec->ext_mic.pin = 0x18; |
| 11878 | spec->ext_mic.mux_idx = 0; |
| 11879 | spec->int_mic.pin = 0x12; |
| 11880 | spec->int_mic.mux_idx = 9; |
| 11881 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11882 | spec->automute = 1; |
| 11883 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11884 | } |
| 11885 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11886 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11887 | * nec model |
| 11888 | * 0x15 = headphone |
| 11889 | * 0x16 = internal speaker |
| 11890 | * 0x18 = external mic |
| 11891 | */ |
| 11892 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11893 | static const struct snd_kcontrol_new alc262_nec_mixer[] = { |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11894 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11895 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11896 | |
| 11897 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11899 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11900 | |
| 11901 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11902 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11903 | { } /* end */ |
| 11904 | }; |
| 11905 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11906 | static const struct hda_verb alc262_nec_verbs[] = { |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11907 | /* Unmute Speaker */ |
| 11908 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11909 | |
| 11910 | /* Headphone */ |
| 11911 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11912 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11913 | |
| 11914 | /* External mic to headphone */ |
| 11915 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11916 | /* External mic to speaker */ |
| 11917 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11918 | {} |
| 11919 | }; |
| 11920 | |
| 11921 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11922 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11923 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11924 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11925 | */ |
| 11926 | |
Takashi Iwai | 20f5e0b | 2011-06-10 09:31:54 +0200 | [diff] [blame^] | 11927 | #define ALC_HP_EVENT ALC880_HP_EVENT |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11928 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11929 | static const struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11930 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11931 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11932 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11933 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11934 | {} |
| 11935 | }; |
| 11936 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11937 | static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11938 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11939 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11940 | {} |
| 11941 | }; |
| 11942 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11943 | static const struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11944 | /* Front Mic pin: input vref at 50% */ |
| 11945 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11947 | {} |
| 11948 | }; |
| 11949 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11950 | static const struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11951 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11952 | .items = { |
| 11953 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11954 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11955 | { "CD", 0x4 }, |
| 11956 | }, |
| 11957 | }; |
| 11958 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11959 | static const struct hda_input_mux alc262_HP_capture_source = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11960 | .num_items = 5, |
| 11961 | .items = { |
| 11962 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11963 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11964 | { "Line", 0x2 }, |
| 11965 | { "CD", 0x4 }, |
| 11966 | { "AUX IN", 0x6 }, |
| 11967 | }, |
| 11968 | }; |
| 11969 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11970 | static const struct hda_input_mux alc262_HP_D7000_capture_source = { |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11971 | .num_items = 4, |
| 11972 | .items = { |
| 11973 | { "Mic", 0x0 }, |
| 11974 | { "Front Mic", 0x2 }, |
| 11975 | { "Line", 0x1 }, |
| 11976 | { "CD", 0x4 }, |
| 11977 | }, |
| 11978 | }; |
| 11979 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11980 | static void alc262_fujitsu_setup(struct hda_codec *codec) |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11981 | { |
| 11982 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11983 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11984 | spec->autocfg.hp_pins[0] = 0x14; |
| 11985 | spec->autocfg.hp_pins[1] = 0x1b; |
| 11986 | spec->autocfg.speaker_pins[0] = 0x15; |
| 11987 | spec->automute = 1; |
| 11988 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11989 | } |
| 11990 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11991 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11992 | static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11993 | .ops = &snd_hda_bind_vol, |
| 11994 | .values = { |
| 11995 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11996 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11997 | 0 |
| 11998 | }, |
| 11999 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12000 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12001 | static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 12002 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12003 | { |
| 12004 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12005 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12006 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 12007 | .info = snd_ctl_boolean_mono_info, |
| 12008 | .get = alc262_hp_master_sw_get, |
| 12009 | .put = alc262_hp_master_sw_put, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12010 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12011 | { |
| 12012 | .iface = NID_MAPPING, |
| 12013 | .name = "Master Playback Switch", |
| 12014 | .private_value = 0x1b, |
| 12015 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12016 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12017 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12018 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12019 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12020 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12021 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 12022 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12023 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12024 | { } /* end */ |
| 12025 | }; |
| 12026 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12027 | static void alc262_lenovo_3000_setup(struct hda_codec *codec) |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12028 | { |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12029 | struct alc_spec *spec = codec->spec; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12030 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12031 | spec->autocfg.hp_pins[0] = 0x1b; |
| 12032 | spec->autocfg.speaker_pins[0] = 0x14; |
| 12033 | spec->autocfg.speaker_pins[1] = 0x16; |
| 12034 | spec->automute = 1; |
| 12035 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12036 | } |
| 12037 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12038 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12039 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 12040 | { |
| 12041 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12042 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12043 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b, |
| 12044 | .info = snd_ctl_boolean_mono_info, |
| 12045 | .get = alc262_hp_master_sw_get, |
| 12046 | .put = alc262_hp_master_sw_put, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12047 | }, |
| 12048 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12049 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12050 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12052 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12053 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 12054 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12055 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12056 | { } /* end */ |
| 12057 | }; |
| 12058 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12059 | static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12060 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12061 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12064 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12065 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12066 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12067 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12068 | { } /* end */ |
| 12069 | }; |
| 12070 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12071 | /* additional init verbs for Benq laptops */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12072 | static const struct hda_verb alc262_EAPD_verbs[] = { |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12073 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12074 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 12075 | {} |
| 12076 | }; |
| 12077 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12078 | static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12079 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12080 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12081 | |
| 12082 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12083 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 12084 | {} |
| 12085 | }; |
| 12086 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12087 | /* Samsung Q1 Ultra Vista model setup */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12088 | static const struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12089 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 12090 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12091 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12092 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12093 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12094 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12095 | { } /* end */ |
| 12096 | }; |
| 12097 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12098 | static const struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12099 | /* output mixer */ |
| 12100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12103 | /* speaker */ |
| 12104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12106 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12107 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12108 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12110 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12111 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12112 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12113 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12114 | /* internal mic */ |
| 12115 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12117 | /* ADC, choose mic */ |
| 12118 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12119 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12120 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12121 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12122 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12123 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12124 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12125 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12126 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12127 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12128 | {} |
| 12129 | }; |
| 12130 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12131 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12132 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12133 | { |
| 12134 | struct alc_spec *spec = codec->spec; |
| 12135 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12136 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12137 | mute = 0; |
| 12138 | /* auto-mute only when HP is used as HP */ |
| 12139 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12140 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12141 | if (spec->jack_present) |
| 12142 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12143 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12144 | /* mute/unmute internal speaker */ |
| 12145 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12146 | HDA_AMP_MUTE, mute); |
| 12147 | /* mute/unmute HP */ |
| 12148 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12149 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12150 | } |
| 12151 | |
| 12152 | /* unsolicited event for HP jack sensing */ |
| 12153 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12154 | unsigned int res) |
| 12155 | { |
| 12156 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12157 | return; |
| 12158 | alc262_ultra_automute(codec); |
| 12159 | } |
| 12160 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12161 | static const struct hda_input_mux alc262_ultra_capture_source = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12162 | .num_items = 2, |
| 12163 | .items = { |
| 12164 | { "Mic", 0x1 }, |
| 12165 | { "Headphone", 0x7 }, |
| 12166 | }, |
| 12167 | }; |
| 12168 | |
| 12169 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12170 | struct snd_ctl_elem_value *ucontrol) |
| 12171 | { |
| 12172 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12173 | struct alc_spec *spec = codec->spec; |
| 12174 | int ret; |
| 12175 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12176 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12177 | if (!ret) |
| 12178 | return 0; |
| 12179 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12180 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12181 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12182 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12183 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12184 | return ret; |
| 12185 | } |
| 12186 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12187 | static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12188 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12189 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12190 | { |
| 12191 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12192 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12193 | .info = alc_mux_enum_info, |
| 12194 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12195 | .put = alc262_ultra_mux_enum_put, |
| 12196 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12197 | { |
| 12198 | .iface = NID_MAPPING, |
| 12199 | .name = "Capture Source", |
| 12200 | .private_value = 0x15, |
| 12201 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12202 | { } /* end */ |
| 12203 | }; |
| 12204 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12205 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12206 | * and thus it's bound with a different mixer. |
| 12207 | * This function returns which mixer amp should be used. |
| 12208 | */ |
| 12209 | static int alc262_check_volbit(hda_nid_t nid) |
| 12210 | { |
| 12211 | if (!nid) |
| 12212 | return 0; |
| 12213 | else if (nid == 0x16) |
| 12214 | return 2; |
| 12215 | else |
| 12216 | return 1; |
| 12217 | } |
| 12218 | |
| 12219 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12220 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12221 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12222 | unsigned long val; |
| 12223 | int vbit; |
| 12224 | |
| 12225 | vbit = alc262_check_volbit(nid); |
| 12226 | if (!vbit) |
| 12227 | return 0; |
| 12228 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12229 | return 0; |
| 12230 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12231 | if (vbit == 2) |
| 12232 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12233 | else |
| 12234 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12235 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12236 | } |
| 12237 | |
| 12238 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12239 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12240 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12241 | unsigned long val; |
| 12242 | |
| 12243 | if (!nid) |
| 12244 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12245 | if (nid == 0x16) |
| 12246 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12247 | else |
| 12248 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12249 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12250 | } |
| 12251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12252 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12253 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12254 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12255 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12256 | const char *pfx; |
| 12257 | int vbits; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12258 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12259 | |
| 12260 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12261 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 12262 | spec->private_dac_nids[0] = 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12263 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 12264 | pfx = alc_get_line_out_pfx(spec, true); |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 12265 | if (!pfx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12266 | pfx = "Front"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12267 | for (i = 0; i < 2; i++) { |
| 12268 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
| 12269 | if (err < 0) |
| 12270 | return err; |
| 12271 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12272 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12273 | "Speaker", i); |
| 12274 | if (err < 0) |
| 12275 | return err; |
| 12276 | } |
| 12277 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12278 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12279 | "Headphone", i); |
| 12280 | if (err < 0) |
| 12281 | return err; |
| 12282 | } |
| 12283 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12284 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12285 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12286 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12287 | alc262_check_volbit(cfg->hp_pins[0]); |
| 12288 | if (vbits == 1 || vbits == 2) |
| 12289 | pfx = "Master"; /* only one mixer is used */ |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12290 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12291 | for (i = 0; i < 2; i++) { |
| 12292 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12293 | &vbits, i); |
| 12294 | if (err < 0) |
| 12295 | return err; |
| 12296 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12297 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12298 | "Speaker", &vbits, i); |
| 12299 | if (err < 0) |
| 12300 | return err; |
| 12301 | } |
| 12302 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12303 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12304 | "Headphone", &vbits, i); |
| 12305 | if (err < 0) |
| 12306 | return err; |
| 12307 | } |
| 12308 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12309 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12310 | } |
| 12311 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12312 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12313 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12314 | |
| 12315 | /* |
| 12316 | * generic initialization of ADC, input mixers and output mixers |
| 12317 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12318 | static const struct hda_verb alc262_volume_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12319 | /* |
| 12320 | * Unmute ADC0-2 and set the default input to mic-in |
| 12321 | */ |
| 12322 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12324 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12325 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12326 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12328 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12329 | /* 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] | 12330 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12331 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12332 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12333 | */ |
| 12334 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12337 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12338 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12339 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12340 | |
| 12341 | /* |
| 12342 | * Set up output mixers (0x0c - 0x0f) |
| 12343 | */ |
| 12344 | /* set vol=0 to output mixers */ |
| 12345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12346 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12348 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12349 | /* set up input amps for analog loopback */ |
| 12350 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12351 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12352 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12353 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12354 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12355 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12356 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12357 | |
| 12358 | /* FIXME: use matrix-type input source selection */ |
| 12359 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12360 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12361 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12362 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12363 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12364 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12365 | /* Input mixer2 */ |
| 12366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12367 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12368 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12369 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12370 | /* Input mixer3 */ |
| 12371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12372 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12373 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12374 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12375 | |
| 12376 | { } |
| 12377 | }; |
| 12378 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12379 | static const struct hda_verb alc262_HP_BPC_init_verbs[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12380 | /* |
| 12381 | * Unmute ADC0-2 and set the default input to mic-in |
| 12382 | */ |
| 12383 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12385 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12386 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12387 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12388 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12389 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12390 | /* 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] | 12391 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12392 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12393 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12394 | */ |
| 12395 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12396 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12397 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12398 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12399 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12400 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12401 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12402 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12403 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12404 | /* |
| 12405 | * Set up output mixers (0x0c - 0x0e) |
| 12406 | */ |
| 12407 | /* set vol=0 to output mixers */ |
| 12408 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12409 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12411 | |
| 12412 | /* set up input amps for analog loopback */ |
| 12413 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12415 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12416 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12417 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12418 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12419 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12420 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12421 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12423 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12424 | |
| 12425 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12427 | |
| 12428 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12429 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12430 | |
| 12431 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12432 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12433 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12434 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12435 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12436 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12437 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12438 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12439 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12441 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12442 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12443 | |
| 12444 | |
| 12445 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12446 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12447 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12448 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12449 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12450 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12451 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12452 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12453 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12454 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12455 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12456 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12457 | /* Input mixer2 */ |
| 12458 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12459 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12460 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12461 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12462 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12463 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12464 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12465 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12466 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12467 | /* Input mixer3 */ |
| 12468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12471 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12472 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12473 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12475 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12476 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12477 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12478 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12479 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12480 | { } |
| 12481 | }; |
| 12482 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12483 | static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12484 | /* |
| 12485 | * Unmute ADC0-2 and set the default input to mic-in |
| 12486 | */ |
| 12487 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12488 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12489 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12491 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12493 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12494 | /* 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] | 12495 | * mixer widget |
| 12496 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12497 | * panel mic (mic 2) |
| 12498 | */ |
| 12499 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12500 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12505 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12506 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12507 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12508 | /* |
| 12509 | * Set up output mixers (0x0c - 0x0e) |
| 12510 | */ |
| 12511 | /* set vol=0 to output mixers */ |
| 12512 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12513 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12514 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12515 | |
| 12516 | /* set up input amps for analog loopback */ |
| 12517 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12520 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12523 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12524 | |
| 12525 | |
| 12526 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12527 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12528 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12529 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12530 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12531 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12532 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12533 | |
| 12534 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12535 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12536 | |
| 12537 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12538 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12539 | |
| 12540 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12541 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12542 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12543 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12544 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12545 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12546 | |
| 12547 | /* FIXME: use matrix-type input source selection */ |
| 12548 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12549 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12550 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12552 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12555 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12556 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12557 | /* Input mixer2 */ |
| 12558 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12559 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12560 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12561 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12562 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12563 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12565 | /* Input mixer3 */ |
| 12566 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12567 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12568 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12571 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12573 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12574 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12575 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12576 | { } |
| 12577 | }; |
| 12578 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12579 | static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12580 | |
| 12581 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12583 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12584 | |
| 12585 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12586 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12587 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12588 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12589 | |
| 12590 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12591 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12592 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12593 | {} |
| 12594 | }; |
| 12595 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12596 | /* |
| 12597 | * Pin config fixes |
| 12598 | */ |
| 12599 | enum { |
| 12600 | PINFIX_FSC_H270, |
| 12601 | }; |
| 12602 | |
| 12603 | static const struct alc_fixup alc262_fixups[] = { |
| 12604 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12605 | .type = ALC_FIXUP_PINS, |
| 12606 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12607 | { 0x14, 0x99130110 }, /* speaker */ |
| 12608 | { 0x15, 0x0221142f }, /* front HP */ |
| 12609 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12610 | { } |
| 12611 | } |
| 12612 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12613 | }; |
| 12614 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12615 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12616 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12617 | {} |
| 12618 | }; |
| 12619 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12620 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12621 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12622 | #define alc262_loopbacks alc880_loopbacks |
| 12623 | #endif |
| 12624 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12625 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12626 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12627 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12628 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12629 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12630 | |
| 12631 | /* |
| 12632 | * BIOS auto configuration |
| 12633 | */ |
| 12634 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12635 | { |
| 12636 | struct alc_spec *spec = codec->spec; |
| 12637 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12638 | static const hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12639 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12640 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12641 | alc262_ignore); |
| 12642 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12643 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12644 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12645 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12646 | spec->multiout.max_channels = 2; |
| 12647 | spec->no_analog = 1; |
| 12648 | goto dig_only; |
| 12649 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12650 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12651 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12652 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12653 | if (err < 0) |
| 12654 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12655 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12656 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12657 | return err; |
| 12658 | |
| 12659 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12660 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12661 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12662 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12663 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12664 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12665 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12666 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12667 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12668 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12669 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12670 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12671 | err = alc_auto_add_mic_boost(codec); |
| 12672 | if (err < 0) |
| 12673 | return err; |
| 12674 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12675 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12676 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12677 | return 1; |
| 12678 | } |
| 12679 | |
| 12680 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12681 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12682 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12683 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12684 | |
| 12685 | |
| 12686 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12687 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12688 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12689 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12690 | alc262_auto_init_multi_out(codec); |
| 12691 | alc262_auto_init_hp_out(codec); |
| 12692 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12693 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12694 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12695 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12696 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12697 | } |
| 12698 | |
| 12699 | /* |
| 12700 | * configuration and preset |
| 12701 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12702 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12703 | [ALC262_BASIC] = "basic", |
| 12704 | [ALC262_HIPPO] = "hippo", |
| 12705 | [ALC262_HIPPO_1] = "hippo_1", |
| 12706 | [ALC262_FUJITSU] = "fujitsu", |
| 12707 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12708 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12709 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12710 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12711 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12712 | [ALC262_BENQ_T31] = "benq-t31", |
| 12713 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12714 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12715 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12716 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12717 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12718 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12719 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12720 | [ALC262_AUTO] = "auto", |
| 12721 | }; |
| 12722 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12723 | static const struct snd_pci_quirk alc262_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12724 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12725 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12726 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12727 | ALC262_HP_BPC), |
| 12728 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12729 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12730 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12731 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12732 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12733 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12734 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12735 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12736 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12737 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12738 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12739 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12740 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12741 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12742 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12743 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12744 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12745 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12746 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12747 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12748 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12749 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12750 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12751 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12752 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12753 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12754 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12755 | #if 0 /* disable the quirk since model=auto works better in recent versions */ |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 12756 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12757 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12758 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12759 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12760 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12761 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12762 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12763 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12764 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12765 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12766 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12767 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12768 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12769 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12770 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12771 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12772 | {} |
| 12773 | }; |
| 12774 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12775 | static const struct alc_config_preset alc262_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12776 | [ALC262_BASIC] = { |
| 12777 | .mixers = { alc262_base_mixer }, |
| 12778 | .init_verbs = { alc262_init_verbs }, |
| 12779 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12780 | .dac_nids = alc262_dac_nids, |
| 12781 | .hp_nid = 0x03, |
| 12782 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12783 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12784 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12785 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12786 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12787 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12788 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12789 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12790 | .dac_nids = alc262_dac_nids, |
| 12791 | .hp_nid = 0x03, |
| 12792 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12793 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12794 | .channel_mode = alc262_modes, |
| 12795 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12796 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12797 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12798 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12799 | }, |
| 12800 | [ALC262_HIPPO_1] = { |
| 12801 | .mixers = { alc262_hippo1_mixer }, |
| 12802 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12803 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12804 | .dac_nids = alc262_dac_nids, |
| 12805 | .hp_nid = 0x02, |
| 12806 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12807 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12808 | .channel_mode = alc262_modes, |
| 12809 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12810 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12811 | .setup = alc262_hippo1_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12812 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12813 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12814 | [ALC262_FUJITSU] = { |
| 12815 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12816 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12817 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12818 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12819 | .dac_nids = alc262_dac_nids, |
| 12820 | .hp_nid = 0x03, |
| 12821 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12822 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12823 | .channel_mode = alc262_modes, |
| 12824 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12825 | .unsol_event = alc_sku_unsol_event, |
| 12826 | .setup = alc262_fujitsu_setup, |
| 12827 | .init_hook = alc_inithook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12828 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12829 | [ALC262_HP_BPC] = { |
| 12830 | .mixers = { alc262_HP_BPC_mixer }, |
| 12831 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12832 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12833 | .dac_nids = alc262_dac_nids, |
| 12834 | .hp_nid = 0x03, |
| 12835 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12836 | .channel_mode = alc262_modes, |
| 12837 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12838 | .unsol_event = alc_sku_unsol_event, |
| 12839 | .setup = alc262_hp_bpc_setup, |
| 12840 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12841 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12842 | [ALC262_HP_BPC_D7000_WF] = { |
| 12843 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12844 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12845 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12846 | .dac_nids = alc262_dac_nids, |
| 12847 | .hp_nid = 0x03, |
| 12848 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12849 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12850 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12851 | .unsol_event = alc_sku_unsol_event, |
| 12852 | .setup = alc262_hp_wildwest_setup, |
| 12853 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12854 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12855 | [ALC262_HP_BPC_D7000_WL] = { |
| 12856 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12857 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12858 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12859 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12860 | .dac_nids = alc262_dac_nids, |
| 12861 | .hp_nid = 0x03, |
| 12862 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12863 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12864 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12865 | .unsol_event = alc_sku_unsol_event, |
| 12866 | .setup = alc262_hp_wildwest_setup, |
| 12867 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12868 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12869 | [ALC262_HP_TC_T5735] = { |
| 12870 | .mixers = { alc262_hp_t5735_mixer }, |
| 12871 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12872 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12873 | .dac_nids = alc262_dac_nids, |
| 12874 | .hp_nid = 0x03, |
| 12875 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12876 | .channel_mode = alc262_modes, |
| 12877 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12878 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12879 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12880 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12881 | }, |
| 12882 | [ALC262_HP_RP5700] = { |
| 12883 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12884 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12885 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12886 | .dac_nids = alc262_dac_nids, |
| 12887 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12888 | .channel_mode = alc262_modes, |
| 12889 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12890 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12891 | [ALC262_BENQ_ED8] = { |
| 12892 | .mixers = { alc262_base_mixer }, |
| 12893 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12894 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12895 | .dac_nids = alc262_dac_nids, |
| 12896 | .hp_nid = 0x03, |
| 12897 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12898 | .channel_mode = alc262_modes, |
| 12899 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12900 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12901 | [ALC262_SONY_ASSAMD] = { |
| 12902 | .mixers = { alc262_sony_mixer }, |
| 12903 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12904 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12905 | .dac_nids = alc262_dac_nids, |
| 12906 | .hp_nid = 0x02, |
| 12907 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12908 | .channel_mode = alc262_modes, |
| 12909 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12910 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12911 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12912 | .init_hook = alc_inithook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12913 | }, |
| 12914 | [ALC262_BENQ_T31] = { |
| 12915 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12916 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12917 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12918 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12919 | .dac_nids = alc262_dac_nids, |
| 12920 | .hp_nid = 0x03, |
| 12921 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12922 | .channel_mode = alc262_modes, |
| 12923 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12924 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12925 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12926 | .init_hook = alc_inithook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12927 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12928 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12929 | .mixers = { alc262_ultra_mixer }, |
| 12930 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12931 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12932 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12933 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12934 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12935 | .channel_mode = alc262_modes, |
| 12936 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12937 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12938 | .capsrc_nids = alc262_capsrc_nids, |
| 12939 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12940 | .unsol_event = alc262_ultra_unsol_event, |
| 12941 | .init_hook = alc262_ultra_automute, |
| 12942 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12943 | [ALC262_LENOVO_3000] = { |
| 12944 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12945 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12946 | alc262_lenovo_3000_unsol_verbs, |
| 12947 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12948 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12949 | .dac_nids = alc262_dac_nids, |
| 12950 | .hp_nid = 0x03, |
| 12951 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12952 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12953 | .channel_mode = alc262_modes, |
| 12954 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12955 | .unsol_event = alc_sku_unsol_event, |
| 12956 | .setup = alc262_lenovo_3000_setup, |
| 12957 | .init_hook = alc_inithook, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12958 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12959 | [ALC262_NEC] = { |
| 12960 | .mixers = { alc262_nec_mixer }, |
| 12961 | .init_verbs = { alc262_nec_verbs }, |
| 12962 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12963 | .dac_nids = alc262_dac_nids, |
| 12964 | .hp_nid = 0x03, |
| 12965 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12966 | .channel_mode = alc262_modes, |
| 12967 | .input_mux = &alc262_capture_source, |
| 12968 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12969 | [ALC262_TOSHIBA_S06] = { |
| 12970 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12971 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12972 | alc262_eapd_verbs }, |
| 12973 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12974 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12975 | .dac_nids = alc262_dac_nids, |
| 12976 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12977 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12978 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12979 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12980 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12981 | .unsol_event = alc_sku_unsol_event, |
| 12982 | .setup = alc262_toshiba_s06_setup, |
| 12983 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12984 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12985 | [ALC262_TOSHIBA_RX1] = { |
| 12986 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12987 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12988 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12989 | .dac_nids = alc262_dac_nids, |
| 12990 | .hp_nid = 0x03, |
| 12991 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12992 | .channel_mode = alc262_modes, |
| 12993 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12994 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12995 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12996 | .init_hook = alc_inithook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12997 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12998 | [ALC262_TYAN] = { |
| 12999 | .mixers = { alc262_tyan_mixer }, |
| 13000 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 13001 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 13002 | .dac_nids = alc262_dac_nids, |
| 13003 | .hp_nid = 0x02, |
| 13004 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 13005 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 13006 | .channel_mode = alc262_modes, |
| 13007 | .input_mux = &alc262_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13008 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13009 | .setup = alc262_tyan_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13010 | .init_hook = alc_hp_automute, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 13011 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13012 | }; |
| 13013 | |
| 13014 | static int patch_alc262(struct hda_codec *codec) |
| 13015 | { |
| 13016 | struct alc_spec *spec; |
| 13017 | int board_config; |
| 13018 | int err; |
| 13019 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 13020 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13021 | if (spec == NULL) |
| 13022 | return -ENOMEM; |
| 13023 | |
| 13024 | codec->spec = spec; |
| 13025 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13026 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 13027 | * under-run |
| 13028 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13029 | { |
| 13030 | int tmp; |
| 13031 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 13032 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 13033 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 13034 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 13035 | } |
| 13036 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 13037 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13038 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13039 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 13040 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13041 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 13042 | alc262_models, |
| 13043 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 13044 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 13045 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13046 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13047 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13048 | board_config = ALC262_AUTO; |
| 13049 | } |
| 13050 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13051 | if (board_config == ALC262_AUTO) { |
| 13052 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 13053 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 13054 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13055 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13056 | if (board_config == ALC262_AUTO) { |
| 13057 | /* automatic parse from the BIOS config */ |
| 13058 | err = alc262_parse_auto_config(codec); |
| 13059 | if (err < 0) { |
| 13060 | alc_free(codec); |
| 13061 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13062 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13063 | printk(KERN_INFO |
| 13064 | "hda_codec: Cannot set up configuration " |
| 13065 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13066 | board_config = ALC262_BASIC; |
| 13067 | } |
| 13068 | } |
| 13069 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13070 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13071 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13072 | if (err < 0) { |
| 13073 | alc_free(codec); |
| 13074 | return err; |
| 13075 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13076 | } |
| 13077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13078 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13079 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13081 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 13082 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13083 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13084 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 13085 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 13086 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13087 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13088 | int i; |
| 13089 | /* check whether the digital-mic has to be supported */ |
| 13090 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 13091 | if (spec->input_mux->items[i].index >= 9) |
| 13092 | break; |
| 13093 | } |
| 13094 | if (i < spec->input_mux->num_items) { |
| 13095 | /* use only ADC0 */ |
| 13096 | spec->adc_nids = alc262_dmic_adc_nids; |
| 13097 | spec->num_adc_nids = 1; |
| 13098 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13099 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13100 | /* all analog inputs */ |
| 13101 | /* check whether NID 0x07 is valid */ |
| 13102 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 13103 | |
| 13104 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13105 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13106 | if (wcap != AC_WID_AUD_IN) { |
| 13107 | spec->adc_nids = alc262_adc_nids_alt; |
| 13108 | spec->num_adc_nids = |
| 13109 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13110 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13111 | } else { |
| 13112 | spec->adc_nids = alc262_adc_nids; |
| 13113 | spec->num_adc_nids = |
| 13114 | ARRAY_SIZE(alc262_adc_nids); |
| 13115 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13116 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13117 | } |
| 13118 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13119 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13120 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13121 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13122 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13123 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13124 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13125 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13126 | spec->vmaster_nid = 0x0c; |
| 13127 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13128 | codec->patch_ops = alc_patch_ops; |
| 13129 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13130 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 13131 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13132 | |
| 13133 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13134 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13135 | if (!spec->loopback.amplist) |
| 13136 | spec->loopback.amplist = alc262_loopbacks; |
| 13137 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13138 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13139 | return 0; |
| 13140 | } |
| 13141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13142 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13143 | * ALC268 channel source setting (2 channel) |
| 13144 | */ |
| 13145 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13146 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13147 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13148 | static const hda_nid_t alc268_dac_nids[2] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13149 | /* front, hp */ |
| 13150 | 0x02, 0x03 |
| 13151 | }; |
| 13152 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13153 | static const hda_nid_t alc268_adc_nids[2] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13154 | /* ADC0-1 */ |
| 13155 | 0x08, 0x07 |
| 13156 | }; |
| 13157 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13158 | static const hda_nid_t alc268_adc_nids_alt[1] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13159 | /* ADC0 */ |
| 13160 | 0x08 |
| 13161 | }; |
| 13162 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13163 | static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13164 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13165 | static const struct snd_kcontrol_new alc268_base_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13166 | /* output mixer control */ |
| 13167 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13168 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13169 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13170 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13171 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13172 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13173 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13174 | { } |
| 13175 | }; |
| 13176 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13177 | static const struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13178 | /* output mixer control */ |
| 13179 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13180 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13181 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13182 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13183 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13184 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13185 | { } |
| 13186 | }; |
| 13187 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13188 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13189 | static const struct hda_bind_ctls alc268_bind_beep_sw = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13190 | .ops = &snd_hda_bind_sw, |
| 13191 | .values = { |
| 13192 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13193 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13194 | 0 |
| 13195 | }, |
| 13196 | }; |
| 13197 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13198 | static const struct snd_kcontrol_new alc268_beep_mixer[] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13199 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13200 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13201 | { } |
| 13202 | }; |
| 13203 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13204 | static const struct hda_verb alc268_eapd_verbs[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13205 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13206 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13207 | { } |
| 13208 | }; |
| 13209 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13210 | /* Toshiba specific */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13211 | static const struct hda_verb alc268_toshiba_verbs[] = { |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13212 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13213 | { } /* end */ |
| 13214 | }; |
| 13215 | |
| 13216 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13217 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13218 | static const struct hda_bind_ctls alc268_acer_bind_master_vol = { |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13219 | .ops = &snd_hda_bind_vol, |
| 13220 | .values = { |
| 13221 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13222 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13223 | 0 |
| 13224 | }, |
| 13225 | }; |
| 13226 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13227 | static void alc268_acer_setup(struct hda_codec *codec) |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13228 | { |
| 13229 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13230 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13231 | spec->autocfg.hp_pins[0] = 0x14; |
| 13232 | spec->autocfg.speaker_pins[0] = 0x15; |
| 13233 | spec->automute = 1; |
| 13234 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13235 | } |
| 13236 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13237 | #define alc268_acer_master_sw_get alc262_hp_master_sw_get |
| 13238 | #define alc268_acer_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13239 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13240 | static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13241 | /* output mixer control */ |
| 13242 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13243 | { |
| 13244 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13245 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13246 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x15, |
| 13247 | .info = snd_ctl_boolean_mono_info, |
| 13248 | .get = alc268_acer_master_sw_get, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13249 | .put = alc268_acer_master_sw_put, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13250 | }, |
| 13251 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13252 | { } |
| 13253 | }; |
| 13254 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13255 | static const struct snd_kcontrol_new alc268_acer_mixer[] = { |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13256 | /* output mixer control */ |
| 13257 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13258 | { |
| 13259 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13260 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13261 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13262 | .info = snd_ctl_boolean_mono_info, |
| 13263 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13264 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13265 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13266 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13267 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13268 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13269 | { } |
| 13270 | }; |
| 13271 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13272 | static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13273 | /* output mixer control */ |
| 13274 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13275 | { |
| 13276 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13277 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13278 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13279 | .info = snd_ctl_boolean_mono_info, |
| 13280 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13281 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13282 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13283 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13284 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13285 | { } |
| 13286 | }; |
| 13287 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13288 | static const struct hda_verb alc268_acer_aspire_one_verbs[] = { |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13289 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13290 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13291 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13292 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13293 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13294 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13295 | { } |
| 13296 | }; |
| 13297 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13298 | static const struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13299 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13300 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13301 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13302 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13303 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13305 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13306 | { } |
| 13307 | }; |
| 13308 | |
| 13309 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13310 | #define alc268_toshiba_setup alc262_hippo_setup |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13311 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13312 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13313 | { |
| 13314 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13315 | spec->autocfg.hp_pins[0] = 0x15; |
| 13316 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13317 | spec->automute_mixer_nid[0] = 0x0f; |
| 13318 | spec->automute = 1; |
| 13319 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13320 | spec->ext_mic.pin = 0x18; |
| 13321 | spec->ext_mic.mux_idx = 0; |
| 13322 | spec->int_mic.pin = 0x12; |
| 13323 | spec->int_mic.mux_idx = 6; |
| 13324 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13325 | } |
| 13326 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13327 | static const struct snd_kcontrol_new alc268_dell_mixer[] = { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13328 | /* output mixer control */ |
| 13329 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13330 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13331 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13332 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13333 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13334 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13335 | { } |
| 13336 | }; |
| 13337 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13338 | static const struct hda_verb alc268_dell_verbs[] = { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13339 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13340 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13341 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13342 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13343 | { } |
| 13344 | }; |
| 13345 | |
| 13346 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13347 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13348 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13349 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13350 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13351 | spec->autocfg.hp_pins[0] = 0x15; |
| 13352 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13353 | spec->ext_mic.pin = 0x18; |
| 13354 | spec->ext_mic.mux_idx = 0; |
| 13355 | spec->int_mic.pin = 0x19; |
| 13356 | spec->int_mic.mux_idx = 1; |
| 13357 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13358 | spec->automute = 1; |
| 13359 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13360 | } |
| 13361 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13362 | static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13363 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13364 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13365 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13366 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13367 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13368 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13369 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13370 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13371 | { } |
| 13372 | }; |
| 13373 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13374 | static const struct hda_verb alc267_quanta_il1_verbs[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13375 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13376 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13377 | { } |
| 13378 | }; |
| 13379 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13380 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13381 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13382 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13383 | spec->autocfg.hp_pins[0] = 0x15; |
| 13384 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13385 | spec->ext_mic.pin = 0x18; |
| 13386 | spec->ext_mic.mux_idx = 0; |
| 13387 | spec->int_mic.pin = 0x19; |
| 13388 | spec->int_mic.mux_idx = 1; |
| 13389 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13390 | spec->automute = 1; |
| 13391 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13392 | } |
| 13393 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13394 | /* |
| 13395 | * generic initialization of ADC, input mixers and output mixers |
| 13396 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13397 | static const struct hda_verb alc268_base_init_verbs[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13398 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13399 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13400 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13401 | |
| 13402 | /* |
| 13403 | * Set up output mixers (0x0c - 0x0e) |
| 13404 | */ |
| 13405 | /* set vol=0 to output mixers */ |
| 13406 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13407 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13408 | |
| 13409 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13410 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13411 | |
| 13412 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13413 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13414 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13415 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13416 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13417 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13418 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13419 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13420 | |
| 13421 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13422 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13423 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13424 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13425 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13426 | |
| 13427 | /* set PCBEEP vol = 0, mute connections */ |
| 13428 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13429 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13430 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13431 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13432 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13433 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13434 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13435 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13436 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13437 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13438 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13439 | { } |
| 13440 | }; |
| 13441 | |
| 13442 | /* |
| 13443 | * generic initialization of ADC, input mixers and output mixers |
| 13444 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13445 | static const struct hda_verb alc268_volume_init_verbs[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13446 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13447 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13448 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13449 | |
| 13450 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13451 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13452 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13453 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13454 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13455 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13456 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13457 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13458 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13459 | |
| 13460 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13461 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13462 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13463 | /* set PCBEEP vol = 0, mute connections */ |
| 13464 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13466 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13467 | |
| 13468 | { } |
| 13469 | }; |
| 13470 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13471 | static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13472 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13473 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13474 | { } /* end */ |
| 13475 | }; |
| 13476 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13477 | static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13478 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13479 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13480 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13481 | { } /* end */ |
| 13482 | }; |
| 13483 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13484 | static const struct snd_kcontrol_new alc268_capture_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13485 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13486 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13487 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13488 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13489 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13490 | { } /* end */ |
| 13491 | }; |
| 13492 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13493 | static const struct hda_input_mux alc268_capture_source = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13494 | .num_items = 4, |
| 13495 | .items = { |
| 13496 | { "Mic", 0x0 }, |
| 13497 | { "Front Mic", 0x1 }, |
| 13498 | { "Line", 0x2 }, |
| 13499 | { "CD", 0x3 }, |
| 13500 | }, |
| 13501 | }; |
| 13502 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13503 | static const struct hda_input_mux alc268_acer_capture_source = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13504 | .num_items = 3, |
| 13505 | .items = { |
| 13506 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13507 | { "Internal Mic", 0x1 }, |
| 13508 | { "Line", 0x2 }, |
| 13509 | }, |
| 13510 | }; |
| 13511 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13512 | static const struct hda_input_mux alc268_acer_dmic_capture_source = { |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13513 | .num_items = 3, |
| 13514 | .items = { |
| 13515 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13516 | { "Internal Mic", 0x6 }, |
| 13517 | { "Line", 0x2 }, |
| 13518 | }, |
| 13519 | }; |
| 13520 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13521 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13522 | static const struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13523 | /* Volume widgets */ |
| 13524 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13525 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13526 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13527 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13528 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13529 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13530 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13531 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13532 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13533 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13534 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13535 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13536 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13537 | /* The below appears problematic on some hardwares */ |
| 13538 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13539 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13540 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13541 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13542 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13543 | |
| 13544 | /* Modes for retasking pin widgets */ |
| 13545 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13546 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13547 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13548 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13549 | |
| 13550 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13551 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13552 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13553 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13554 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13555 | |
| 13556 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13557 | * The ALC268 does not have an SPDIF input. |
| 13558 | */ |
| 13559 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13560 | |
| 13561 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13562 | * this output to turn on an external amplifier. |
| 13563 | */ |
| 13564 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13565 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13566 | |
| 13567 | { } /* end */ |
| 13568 | }; |
| 13569 | #endif |
| 13570 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13571 | /* create input playback/capture controls for the given pin */ |
| 13572 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13573 | const char *ctlname, int idx) |
| 13574 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13575 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13576 | int err; |
| 13577 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13578 | switch (nid) { |
| 13579 | case 0x14: |
| 13580 | case 0x16: |
| 13581 | dac = 0x02; |
| 13582 | break; |
| 13583 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13584 | case 0x1a: /* ALC259/269 only */ |
| 13585 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13586 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13587 | dac = 0x03; |
| 13588 | break; |
| 13589 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13590 | snd_printd(KERN_WARNING "hda_codec: " |
| 13591 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13592 | return 0; |
| 13593 | } |
| 13594 | if (spec->multiout.dac_nids[0] != dac && |
| 13595 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13596 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13597 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13598 | HDA_OUTPUT)); |
| 13599 | if (err < 0) |
| 13600 | return err; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 13601 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13602 | } |
| 13603 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13604 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13605 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13606 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13607 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13608 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13609 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13610 | if (err < 0) |
| 13611 | return err; |
| 13612 | return 0; |
| 13613 | } |
| 13614 | |
| 13615 | /* add playback controls from the parsed DAC table */ |
| 13616 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13617 | const struct auto_pin_cfg *cfg) |
| 13618 | { |
| 13619 | hda_nid_t nid; |
| 13620 | int err; |
| 13621 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13622 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13623 | |
| 13624 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13625 | if (nid) { |
| 13626 | const char *name; |
| 13627 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13628 | name = "Speaker"; |
| 13629 | else |
| 13630 | name = "Front"; |
| 13631 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13632 | if (err < 0) |
| 13633 | return err; |
| 13634 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13635 | |
| 13636 | nid = cfg->speaker_pins[0]; |
| 13637 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13638 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13639 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13640 | if (err < 0) |
| 13641 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13642 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13643 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13644 | if (err < 0) |
| 13645 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13646 | } |
| 13647 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13648 | if (nid) { |
| 13649 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13650 | if (err < 0) |
| 13651 | return err; |
| 13652 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13653 | |
| 13654 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13655 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13656 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13657 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13658 | if (err < 0) |
| 13659 | return err; |
| 13660 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13661 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13662 | } |
| 13663 | |
| 13664 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13665 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13666 | const struct auto_pin_cfg *cfg) |
| 13667 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13668 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13669 | } |
| 13670 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13671 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13672 | hda_nid_t nid, int pin_type) |
| 13673 | { |
| 13674 | int idx; |
| 13675 | |
| 13676 | alc_set_pin_output(codec, nid, pin_type); |
| 13677 | if (nid == 0x14 || nid == 0x16) |
| 13678 | idx = 0; |
| 13679 | else |
| 13680 | idx = 1; |
| 13681 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13682 | } |
| 13683 | |
| 13684 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13685 | { |
| 13686 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13687 | int i; |
| 13688 | |
| 13689 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13690 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13691 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13692 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13693 | } |
| 13694 | } |
| 13695 | |
| 13696 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13697 | { |
| 13698 | struct alc_spec *spec = codec->spec; |
| 13699 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13700 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13701 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13702 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13703 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13704 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13705 | } |
| 13706 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13707 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13708 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13709 | } |
| 13710 | if (spec->autocfg.mono_out_pin) |
| 13711 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13712 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13713 | } |
| 13714 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13715 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13716 | { |
| 13717 | struct alc_spec *spec = codec->spec; |
| 13718 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13719 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13720 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13721 | unsigned int dac_vol1, dac_vol2; |
| 13722 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13723 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13724 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13725 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13726 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13727 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13728 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13729 | AMP_IN_UNMUTE(1)); |
| 13730 | snd_hda_codec_write(codec, 0x10, 0, |
| 13731 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13732 | AMP_IN_UNMUTE(1)); |
| 13733 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13734 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13735 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13736 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13737 | snd_hda_codec_write(codec, 0x10, 0, |
| 13738 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13739 | } |
| 13740 | |
| 13741 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13742 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13743 | dac_vol2 = AMP_OUT_ZERO; |
| 13744 | else if (line_nid == 0x15) |
| 13745 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13746 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13747 | dac_vol2 = AMP_OUT_ZERO; |
| 13748 | else if (hp_nid == 0x15) |
| 13749 | dac_vol1 = AMP_OUT_ZERO; |
| 13750 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13751 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13752 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13753 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13754 | |
| 13755 | snd_hda_codec_write(codec, 0x02, 0, |
| 13756 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13757 | snd_hda_codec_write(codec, 0x03, 0, |
| 13758 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13759 | } |
| 13760 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13761 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13762 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13763 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13764 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13765 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13766 | |
| 13767 | /* |
| 13768 | * BIOS auto configuration |
| 13769 | */ |
| 13770 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13771 | { |
| 13772 | struct alc_spec *spec = codec->spec; |
| 13773 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13774 | static const hda_nid_t alc268_ignore[] = { 0 }; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13775 | |
| 13776 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13777 | alc268_ignore); |
| 13778 | if (err < 0) |
| 13779 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13780 | if (!spec->autocfg.line_outs) { |
| 13781 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13782 | spec->multiout.max_channels = 2; |
| 13783 | spec->no_analog = 1; |
| 13784 | goto dig_only; |
| 13785 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13786 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13787 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13788 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13789 | if (err < 0) |
| 13790 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13791 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13792 | if (err < 0) |
| 13793 | return err; |
| 13794 | |
| 13795 | spec->multiout.max_channels = 2; |
| 13796 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13797 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13798 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13799 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13800 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13801 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13802 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13803 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13804 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13805 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13806 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13807 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13808 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13809 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13810 | err = alc_auto_add_mic_boost(codec); |
| 13811 | if (err < 0) |
| 13812 | return err; |
| 13813 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13814 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13815 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13816 | return 1; |
| 13817 | } |
| 13818 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13819 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13820 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13821 | |
| 13822 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13823 | static void alc268_auto_init(struct hda_codec *codec) |
| 13824 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13825 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13826 | alc268_auto_init_multi_out(codec); |
| 13827 | alc268_auto_init_hp_out(codec); |
| 13828 | alc268_auto_init_mono_speaker_out(codec); |
| 13829 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13830 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13831 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13832 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13833 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13834 | } |
| 13835 | |
| 13836 | /* |
| 13837 | * configuration and preset |
| 13838 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13839 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13840 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13841 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13842 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13843 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13844 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13845 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13846 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13847 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13848 | #ifdef CONFIG_SND_DEBUG |
| 13849 | [ALC268_TEST] = "test", |
| 13850 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13851 | [ALC268_AUTO] = "auto", |
| 13852 | }; |
| 13853 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13854 | static const struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13855 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13856 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13857 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13858 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13859 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13860 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13861 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13862 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | 0a1896b | 2011-06-06 18:55:34 -0400 | [diff] [blame] | 13863 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13864 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13865 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13866 | /* almost compatible with toshiba but with optional digital outs; |
| 13867 | * auto-probing seems working fine |
| 13868 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13869 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13870 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13871 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13872 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13873 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13874 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13875 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13876 | {} |
| 13877 | }; |
| 13878 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13879 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13880 | static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13881 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13882 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13883 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13884 | ALC268_TOSHIBA), |
| 13885 | {} |
| 13886 | }; |
| 13887 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13888 | static const struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13889 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13890 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13891 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13892 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13893 | alc267_quanta_il1_verbs }, |
| 13894 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13895 | .dac_nids = alc268_dac_nids, |
| 13896 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13897 | .adc_nids = alc268_adc_nids_alt, |
| 13898 | .hp_nid = 0x03, |
| 13899 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13900 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13901 | .unsol_event = alc_sku_unsol_event, |
| 13902 | .setup = alc267_quanta_il1_setup, |
| 13903 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13904 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13905 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13906 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13907 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13908 | .init_verbs = { alc268_base_init_verbs }, |
| 13909 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13910 | .dac_nids = alc268_dac_nids, |
| 13911 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13912 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13913 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13914 | .hp_nid = 0x03, |
| 13915 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13916 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13917 | .channel_mode = alc268_modes, |
| 13918 | .input_mux = &alc268_capture_source, |
| 13919 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13920 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13921 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13922 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13923 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13924 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13925 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13926 | .dac_nids = alc268_dac_nids, |
| 13927 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13928 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13929 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13930 | .hp_nid = 0x03, |
| 13931 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13932 | .channel_mode = alc268_modes, |
| 13933 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13934 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13935 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13936 | .init_hook = alc_inithook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13937 | }, |
| 13938 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13939 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13940 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13941 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13942 | alc268_acer_verbs }, |
| 13943 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13944 | .dac_nids = alc268_dac_nids, |
| 13945 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13946 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13947 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13948 | .hp_nid = 0x02, |
| 13949 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13950 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13951 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13952 | .unsol_event = alc_sku_unsol_event, |
| 13953 | .setup = alc268_acer_setup, |
| 13954 | .init_hook = alc_inithook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13955 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13956 | [ALC268_ACER_DMIC] = { |
| 13957 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13958 | alc268_beep_mixer }, |
| 13959 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13960 | alc268_acer_verbs }, |
| 13961 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13962 | .dac_nids = alc268_dac_nids, |
| 13963 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13964 | .adc_nids = alc268_adc_nids_alt, |
| 13965 | .capsrc_nids = alc268_capsrc_nids, |
| 13966 | .hp_nid = 0x02, |
| 13967 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13968 | .channel_mode = alc268_modes, |
| 13969 | .input_mux = &alc268_acer_dmic_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13970 | .unsol_event = alc_sku_unsol_event, |
| 13971 | .setup = alc268_acer_setup, |
| 13972 | .init_hook = alc_inithook, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13973 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13974 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13975 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13976 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13977 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13978 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13979 | alc268_acer_aspire_one_verbs }, |
| 13980 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13981 | .dac_nids = alc268_dac_nids, |
| 13982 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13983 | .adc_nids = alc268_adc_nids_alt, |
| 13984 | .capsrc_nids = alc268_capsrc_nids, |
| 13985 | .hp_nid = 0x03, |
| 13986 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13987 | .channel_mode = alc268_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13988 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13989 | .setup = alc268_acer_lc_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13990 | .init_hook = alc_inithook, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13991 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13992 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13993 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13994 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13995 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13996 | alc268_dell_verbs }, |
| 13997 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13998 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13999 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 14000 | .adc_nids = alc268_adc_nids_alt, |
| 14001 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14002 | .hp_nid = 0x02, |
| 14003 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 14004 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14005 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14006 | .setup = alc268_dell_setup, |
| 14007 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14008 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 14009 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14010 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 14011 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 14012 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 14013 | alc268_toshiba_verbs }, |
| 14014 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 14015 | .dac_nids = alc268_dac_nids, |
| 14016 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 14017 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14018 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 14019 | .hp_nid = 0x03, |
| 14020 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 14021 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 14022 | .channel_mode = alc268_modes, |
| 14023 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 14024 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14025 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 14026 | .init_hook = alc_inithook, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 14027 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 14028 | #ifdef CONFIG_SND_DEBUG |
| 14029 | [ALC268_TEST] = { |
| 14030 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 14031 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 14032 | alc268_volume_init_verbs }, |
| 14033 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 14034 | .dac_nids = alc268_dac_nids, |
| 14035 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 14036 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14037 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 14038 | .hp_nid = 0x03, |
| 14039 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 14040 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 14041 | .channel_mode = alc268_modes, |
| 14042 | .input_mux = &alc268_capture_source, |
| 14043 | }, |
| 14044 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14045 | }; |
| 14046 | |
| 14047 | static int patch_alc268(struct hda_codec *codec) |
| 14048 | { |
| 14049 | struct alc_spec *spec; |
| 14050 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14051 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14052 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 14053 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14054 | if (spec == NULL) |
| 14055 | return -ENOMEM; |
| 14056 | |
| 14057 | codec->spec = spec; |
| 14058 | |
| 14059 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 14060 | alc268_models, |
| 14061 | alc268_cfg_tbl); |
| 14062 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14063 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 14064 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 14065 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 14066 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14067 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14068 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14069 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14070 | board_config = ALC268_AUTO; |
| 14071 | } |
| 14072 | |
| 14073 | if (board_config == ALC268_AUTO) { |
| 14074 | /* automatic parse from the BIOS config */ |
| 14075 | err = alc268_parse_auto_config(codec); |
| 14076 | if (err < 0) { |
| 14077 | alc_free(codec); |
| 14078 | return err; |
| 14079 | } else if (!err) { |
| 14080 | printk(KERN_INFO |
| 14081 | "hda_codec: Cannot set up configuration " |
| 14082 | "from BIOS. Using base mode...\n"); |
| 14083 | board_config = ALC268_3ST; |
| 14084 | } |
| 14085 | } |
| 14086 | |
| 14087 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14088 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14089 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14090 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14091 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14092 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14093 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14094 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14095 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14096 | has_beep = 0; |
| 14097 | for (i = 0; i < spec->num_mixers; i++) { |
| 14098 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14099 | has_beep = 1; |
| 14100 | break; |
| 14101 | } |
| 14102 | } |
| 14103 | |
| 14104 | if (has_beep) { |
| 14105 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14106 | if (err < 0) { |
| 14107 | alc_free(codec); |
| 14108 | return err; |
| 14109 | } |
| 14110 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14111 | /* override the amp caps for beep generator */ |
| 14112 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14113 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14114 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14115 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14116 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14117 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14118 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14119 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14120 | /* check whether NID 0x07 is valid */ |
| 14121 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14122 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14123 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14124 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14125 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14126 | if (spec->auto_mic || |
| 14127 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14128 | spec->adc_nids = alc268_adc_nids_alt; |
| 14129 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14130 | if (spec->auto_mic) |
| 14131 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14132 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14133 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14134 | else |
| 14135 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14136 | } else { |
| 14137 | spec->adc_nids = alc268_adc_nids; |
| 14138 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14139 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14140 | } |
| 14141 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14142 | |
| 14143 | spec->vmaster_nid = 0x02; |
| 14144 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14145 | codec->patch_ops = alc_patch_ops; |
| 14146 | if (board_config == ALC268_AUTO) |
| 14147 | spec->init_hook = alc268_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 14148 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14149 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14150 | alc_init_jacks(codec); |
| 14151 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14152 | return 0; |
| 14153 | } |
| 14154 | |
| 14155 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14156 | * ALC269 channel source setting (2 channel) |
| 14157 | */ |
| 14158 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14159 | |
| 14160 | #define alc269_dac_nids alc260_dac_nids |
| 14161 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14162 | static const hda_nid_t alc269_adc_nids[1] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14163 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14164 | 0x08, |
| 14165 | }; |
| 14166 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14167 | static const hda_nid_t alc269_capsrc_nids[1] = { |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14168 | 0x23, |
| 14169 | }; |
| 14170 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14171 | static const hda_nid_t alc269vb_adc_nids[1] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14172 | /* ADC1 */ |
| 14173 | 0x09, |
| 14174 | }; |
| 14175 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14176 | static const hda_nid_t alc269vb_capsrc_nids[1] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14177 | 0x22, |
| 14178 | }; |
| 14179 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14180 | static const hda_nid_t alc269_adc_candidates[] = { |
David Henningsson | 262ac22 | 2011-04-07 11:43:00 +0200 | [diff] [blame] | 14181 | 0x08, 0x09, 0x07, 0x11, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14182 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14183 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14184 | #define alc269_modes alc260_modes |
| 14185 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14186 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14187 | static const struct snd_kcontrol_new alc269_base_mixer[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14188 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14189 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14190 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14191 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14192 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14193 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14194 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14195 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14196 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14197 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14198 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14199 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14200 | { } /* end */ |
| 14201 | }; |
| 14202 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14203 | static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14204 | /* output mixer control */ |
| 14205 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14206 | { |
| 14207 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14208 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14209 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14210 | .info = snd_hda_mixer_amp_switch_info, |
| 14211 | .get = snd_hda_mixer_amp_switch_get, |
| 14212 | .put = alc268_acer_master_sw_put, |
| 14213 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14214 | }, |
| 14215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14217 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14218 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14219 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14220 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14221 | { } |
| 14222 | }; |
| 14223 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14224 | static const struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14225 | /* output mixer control */ |
| 14226 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14227 | { |
| 14228 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14229 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14230 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14231 | .info = snd_hda_mixer_amp_switch_info, |
| 14232 | .get = snd_hda_mixer_amp_switch_get, |
| 14233 | .put = alc268_acer_master_sw_put, |
| 14234 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14235 | }, |
| 14236 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14237 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14238 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14239 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14240 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14241 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14242 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14243 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14244 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14245 | { } |
| 14246 | }; |
| 14247 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14248 | static const struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14249 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14250 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14251 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14252 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14253 | { } /* end */ |
| 14254 | }; |
| 14255 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14256 | static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14257 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14258 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14259 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14260 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14261 | { } /* end */ |
| 14262 | }; |
| 14263 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14264 | static const struct snd_kcontrol_new alc269_asus_mixer[] = { |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14265 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14266 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14267 | { } /* end */ |
| 14268 | }; |
| 14269 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14270 | /* capture mixer elements */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14271 | static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14272 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14273 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14274 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14275 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14276 | { } /* end */ |
| 14277 | }; |
| 14278 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14279 | static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14280 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14281 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14282 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14283 | { } /* end */ |
| 14284 | }; |
| 14285 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14286 | static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14287 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14288 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14289 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14290 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14291 | { } /* end */ |
| 14292 | }; |
| 14293 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14294 | static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14295 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14296 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14297 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14298 | { } /* end */ |
| 14299 | }; |
| 14300 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14301 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14302 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14303 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14304 | static const struct hda_verb alc269_quanta_fl1_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14305 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14306 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14307 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14308 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14309 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14310 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14311 | { } |
| 14312 | }; |
| 14313 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14314 | static const struct hda_verb alc269_lifebook_verbs[] = { |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14315 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14316 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14317 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14318 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14319 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14320 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14321 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14322 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14323 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14324 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14325 | { } |
| 14326 | }; |
| 14327 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14328 | /* toggle speaker-output according to the hp-jack state */ |
| 14329 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14330 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14331 | alc_hp_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14332 | |
| 14333 | snd_hda_codec_write(codec, 0x20, 0, |
| 14334 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14335 | snd_hda_codec_write(codec, 0x20, 0, |
| 14336 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14337 | |
| 14338 | snd_hda_codec_write(codec, 0x20, 0, |
| 14339 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14340 | snd_hda_codec_write(codec, 0x20, 0, |
| 14341 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14342 | } |
| 14343 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14344 | #define alc269_lifebook_speaker_automute \ |
| 14345 | alc269_quanta_fl1_speaker_automute |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14346 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14347 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14348 | { |
| 14349 | unsigned int present_laptop; |
| 14350 | unsigned int present_dock; |
| 14351 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14352 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14353 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14354 | |
| 14355 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14356 | if (present_dock) |
| 14357 | snd_hda_codec_write(codec, 0x23, 0, |
| 14358 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14359 | if (present_laptop) |
| 14360 | snd_hda_codec_write(codec, 0x23, 0, |
| 14361 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14362 | if (!present_dock && !present_laptop) |
| 14363 | snd_hda_codec_write(codec, 0x23, 0, |
| 14364 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14365 | } |
| 14366 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14367 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14368 | unsigned int res) |
| 14369 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14370 | switch (res >> 26) { |
| 14371 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14372 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14373 | break; |
| 14374 | case ALC880_MIC_EVENT: |
| 14375 | alc_mic_automute(codec); |
| 14376 | break; |
| 14377 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14378 | } |
| 14379 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14380 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14381 | unsigned int res) |
| 14382 | { |
| 14383 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14384 | alc269_lifebook_speaker_automute(codec); |
| 14385 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14386 | alc269_lifebook_mic_autoswitch(codec); |
| 14387 | } |
| 14388 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14389 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14390 | { |
| 14391 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14392 | spec->autocfg.hp_pins[0] = 0x15; |
| 14393 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14394 | spec->automute_mixer_nid[0] = 0x0c; |
| 14395 | spec->automute = 1; |
| 14396 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14397 | spec->ext_mic.pin = 0x18; |
| 14398 | spec->ext_mic.mux_idx = 0; |
| 14399 | spec->int_mic.pin = 0x19; |
| 14400 | spec->int_mic.mux_idx = 1; |
| 14401 | spec->auto_mic = 1; |
| 14402 | } |
| 14403 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14404 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14405 | { |
| 14406 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14407 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14408 | } |
| 14409 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14410 | static void alc269_lifebook_setup(struct hda_codec *codec) |
| 14411 | { |
| 14412 | struct alc_spec *spec = codec->spec; |
| 14413 | spec->autocfg.hp_pins[0] = 0x15; |
| 14414 | spec->autocfg.hp_pins[1] = 0x1a; |
| 14415 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14416 | spec->automute_mixer_nid[0] = 0x0c; |
| 14417 | spec->automute = 1; |
| 14418 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 14419 | } |
| 14420 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14421 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14422 | { |
| 14423 | alc269_lifebook_speaker_automute(codec); |
| 14424 | alc269_lifebook_mic_autoswitch(codec); |
| 14425 | } |
| 14426 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14427 | static const struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14428 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14429 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14430 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14431 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14432 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14433 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14434 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14435 | {} |
| 14436 | }; |
| 14437 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14438 | static const struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14439 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14440 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14441 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14442 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14443 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14444 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14445 | {} |
| 14446 | }; |
| 14447 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14448 | static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14449 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14450 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14451 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14452 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14453 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14454 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14455 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14456 | {} |
| 14457 | }; |
| 14458 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14459 | static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14460 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14461 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14462 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14463 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14464 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14465 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14466 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14467 | {} |
| 14468 | }; |
| 14469 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14470 | static const struct hda_verb alc271_acer_dmic_verbs[] = { |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14471 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14472 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14473 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14474 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14475 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14476 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14477 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14478 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14479 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14480 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14481 | { } |
| 14482 | }; |
| 14483 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14484 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14485 | { |
| 14486 | struct alc_spec *spec = codec->spec; |
| 14487 | spec->autocfg.hp_pins[0] = 0x15; |
| 14488 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14489 | spec->automute_mixer_nid[0] = 0x0c; |
| 14490 | spec->automute = 1; |
| 14491 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14492 | spec->ext_mic.pin = 0x18; |
| 14493 | spec->ext_mic.mux_idx = 0; |
| 14494 | spec->int_mic.pin = 0x19; |
| 14495 | spec->int_mic.mux_idx = 1; |
| 14496 | spec->auto_mic = 1; |
| 14497 | } |
| 14498 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14499 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14500 | { |
| 14501 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14502 | spec->autocfg.hp_pins[0] = 0x15; |
| 14503 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14504 | spec->automute_mixer_nid[0] = 0x0c; |
| 14505 | spec->automute = 1; |
| 14506 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14507 | spec->ext_mic.pin = 0x18; |
| 14508 | spec->ext_mic.mux_idx = 0; |
| 14509 | spec->int_mic.pin = 0x12; |
| 14510 | spec->int_mic.mux_idx = 5; |
| 14511 | spec->auto_mic = 1; |
| 14512 | } |
| 14513 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14514 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14515 | { |
| 14516 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14517 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14518 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14519 | spec->automute_mixer_nid[0] = 0x0c; |
| 14520 | spec->automute = 1; |
| 14521 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14522 | spec->ext_mic.pin = 0x18; |
| 14523 | spec->ext_mic.mux_idx = 0; |
| 14524 | spec->int_mic.pin = 0x19; |
| 14525 | spec->int_mic.mux_idx = 1; |
| 14526 | spec->auto_mic = 1; |
| 14527 | } |
| 14528 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14529 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14530 | { |
| 14531 | struct alc_spec *spec = codec->spec; |
| 14532 | spec->autocfg.hp_pins[0] = 0x21; |
| 14533 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14534 | spec->automute_mixer_nid[0] = 0x0c; |
| 14535 | spec->automute = 1; |
| 14536 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14537 | spec->ext_mic.pin = 0x18; |
| 14538 | spec->ext_mic.mux_idx = 0; |
| 14539 | spec->int_mic.pin = 0x12; |
| 14540 | spec->int_mic.mux_idx = 6; |
| 14541 | spec->auto_mic = 1; |
| 14542 | } |
| 14543 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14544 | /* |
| 14545 | * generic initialization of ADC, input mixers and output mixers |
| 14546 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14547 | static const struct hda_verb alc269_init_verbs[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14548 | /* |
| 14549 | * Unmute ADC0 and set the default input to mic-in |
| 14550 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14551 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14552 | |
| 14553 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14554 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14555 | */ |
| 14556 | /* set vol=0 to output mixers */ |
| 14557 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14558 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14559 | |
| 14560 | /* set up input amps for analog loopback */ |
| 14561 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14562 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14563 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14564 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14565 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14566 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14567 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14568 | |
| 14569 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14570 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14571 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14572 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14573 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14574 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14575 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14576 | |
| 14577 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14578 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14579 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14580 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14581 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14582 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14583 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14584 | |
| 14585 | /* set EAPD */ |
| 14586 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14587 | { } |
| 14588 | }; |
| 14589 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14590 | static const struct hda_verb alc269vb_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14591 | /* |
| 14592 | * Unmute ADC0 and set the default input to mic-in |
| 14593 | */ |
| 14594 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14595 | |
| 14596 | /* |
| 14597 | * Set up output mixers (0x02 - 0x03) |
| 14598 | */ |
| 14599 | /* set vol=0 to output mixers */ |
| 14600 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14601 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14602 | |
| 14603 | /* set up input amps for analog loopback */ |
| 14604 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14605 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14607 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14608 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14609 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14610 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14611 | |
| 14612 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14613 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14614 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14615 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14616 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14617 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14618 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14619 | |
| 14620 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14621 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14622 | |
| 14623 | /* FIXME: use Mux-type input source selection */ |
| 14624 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14625 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14626 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14627 | |
| 14628 | /* set EAPD */ |
| 14629 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14630 | { } |
| 14631 | }; |
| 14632 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14633 | #define alc269_auto_create_multi_out_ctls \ |
| 14634 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14635 | #define alc269_auto_create_input_ctls \ |
| 14636 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14637 | |
| 14638 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14639 | #define alc269_loopbacks alc880_loopbacks |
| 14640 | #endif |
| 14641 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14642 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14643 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14644 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14645 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14646 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14647 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14648 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14649 | .substreams = 1, |
| 14650 | .channels_min = 2, |
| 14651 | .channels_max = 8, |
| 14652 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14653 | /* NID is set in alc_build_pcms */ |
| 14654 | .ops = { |
| 14655 | .open = alc880_playback_pcm_open, |
| 14656 | .prepare = alc880_playback_pcm_prepare, |
| 14657 | .cleanup = alc880_playback_pcm_cleanup |
| 14658 | }, |
| 14659 | }; |
| 14660 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14661 | static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14662 | .substreams = 1, |
| 14663 | .channels_min = 2, |
| 14664 | .channels_max = 2, |
| 14665 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14666 | /* NID is set in alc_build_pcms */ |
| 14667 | }; |
| 14668 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14669 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14670 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14671 | { |
| 14672 | switch (codec->subsystem_id) { |
| 14673 | case 0x103c1586: |
| 14674 | return 1; |
| 14675 | } |
| 14676 | return 0; |
| 14677 | } |
| 14678 | |
| 14679 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14680 | { |
| 14681 | /* update mute-LED according to the speaker mute state */ |
| 14682 | if (nid == 0x01 || nid == 0x14) { |
| 14683 | int pinval; |
| 14684 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14685 | HDA_AMP_MUTE) |
| 14686 | pinval = 0x24; |
| 14687 | else |
| 14688 | pinval = 0x20; |
| 14689 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14690 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14691 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14692 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14693 | } |
| 14694 | return alc_check_power_status(codec, nid); |
| 14695 | } |
| 14696 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14697 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14698 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14699 | { |
| 14700 | struct alc_spec *spec = codec->spec; |
| 14701 | |
| 14702 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14703 | return 0; |
| 14704 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14705 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14706 | if (spec->ext_mic.pin <= 0x12) { |
| 14707 | spec->private_adc_nids[0] = 0x08; |
| 14708 | spec->private_adc_nids[1] = 0x11; |
| 14709 | spec->private_capsrc_nids[0] = 0x23; |
| 14710 | spec->private_capsrc_nids[1] = 0x22; |
| 14711 | } else { |
| 14712 | spec->private_adc_nids[0] = 0x11; |
| 14713 | spec->private_adc_nids[1] = 0x08; |
| 14714 | spec->private_capsrc_nids[0] = 0x22; |
| 14715 | spec->private_capsrc_nids[1] = 0x23; |
| 14716 | } |
| 14717 | spec->adc_nids = spec->private_adc_nids; |
| 14718 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14719 | spec->num_adc_nids = 2; |
| 14720 | spec->dual_adc_switch = 1; |
| 14721 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14722 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14723 | return 1; |
| 14724 | } |
| 14725 | return 0; |
| 14726 | } |
| 14727 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14728 | /* different alc269-variants */ |
| 14729 | enum { |
| 14730 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14731 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14732 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14733 | ALC269_TYPE_ALC269VB, |
| 14734 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14735 | ALC269_TYPE_ALC271X, |
| 14736 | }; |
| 14737 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14738 | /* |
| 14739 | * BIOS auto configuration |
| 14740 | */ |
| 14741 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14742 | { |
| 14743 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14744 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14745 | static const hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14746 | |
| 14747 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14748 | alc269_ignore); |
| 14749 | if (err < 0) |
| 14750 | return err; |
| 14751 | |
| 14752 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14753 | if (err < 0) |
| 14754 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14755 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14756 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14757 | else |
| 14758 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14759 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14760 | if (err < 0) |
| 14761 | return err; |
| 14762 | |
| 14763 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14764 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14765 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14766 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14767 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14768 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14769 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14770 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14771 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14772 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14773 | } else { |
| 14774 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14775 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14776 | } |
| 14777 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14778 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14779 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14780 | |
| 14781 | if (!alc275_setup_dual_adc(codec)) |
| 14782 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14783 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14784 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14785 | err = alc_auto_add_mic_boost(codec); |
| 14786 | if (err < 0) |
| 14787 | return err; |
| 14788 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14789 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14790 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14791 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14792 | return 1; |
| 14793 | } |
| 14794 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14795 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14796 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14797 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14798 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14799 | |
| 14800 | |
| 14801 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14802 | static void alc269_auto_init(struct hda_codec *codec) |
| 14803 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14804 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14805 | alc269_auto_init_multi_out(codec); |
| 14806 | alc269_auto_init_hp_out(codec); |
| 14807 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14808 | if (!spec->dual_adc_switch) |
| 14809 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14810 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14811 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14812 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14813 | } |
| 14814 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14815 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14816 | { |
| 14817 | int val = alc_read_coef_idx(codec, 0x04); |
| 14818 | if (power_up) |
| 14819 | val |= 1 << 11; |
| 14820 | else |
| 14821 | val &= ~(1 << 11); |
| 14822 | alc_write_coef_idx(codec, 0x04, val); |
| 14823 | } |
| 14824 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14825 | static void alc269_shutup(struct hda_codec *codec) |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14826 | { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14827 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14828 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14829 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14830 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14831 | msleep(150); |
| 14832 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14833 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14834 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14835 | #ifdef SND_HDA_NEEDS_RESUME |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14836 | static int alc269_resume(struct hda_codec *codec) |
| 14837 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14838 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14839 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14840 | msleep(150); |
| 14841 | } |
| 14842 | |
| 14843 | codec->patch_ops.init(codec); |
| 14844 | |
| 14845 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14846 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14847 | msleep(200); |
| 14848 | } |
| 14849 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14850 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14851 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14852 | |
| 14853 | snd_hda_codec_resume_amp(codec); |
| 14854 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14855 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14856 | return 0; |
| 14857 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14858 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14859 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14860 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14861 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14862 | { |
| 14863 | int coef; |
| 14864 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14865 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14866 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14867 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14868 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14869 | } |
| 14870 | |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14871 | static void alc271_fixup_dmic(struct hda_codec *codec, |
| 14872 | const struct alc_fixup *fix, int action) |
| 14873 | { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14874 | static const struct hda_verb verbs[] = { |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14875 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14876 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14877 | {} |
| 14878 | }; |
| 14879 | unsigned int cfg; |
| 14880 | |
| 14881 | if (strcmp(codec->chip_name, "ALC271X")) |
| 14882 | return; |
| 14883 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 14884 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 14885 | snd_hda_sequence_write(codec, verbs); |
| 14886 | } |
| 14887 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14888 | enum { |
| 14889 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14890 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14891 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14892 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14893 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14894 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14895 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14896 | ALC271_FIXUP_DMIC, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14897 | }; |
| 14898 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14899 | static const struct alc_fixup alc269_fixups[] = { |
| 14900 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14901 | .type = ALC_FIXUP_VERBS, |
| 14902 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14903 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14904 | {} |
| 14905 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14906 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14907 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14908 | .type = ALC_FIXUP_VERBS, |
| 14909 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14910 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14911 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14912 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14913 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14914 | }, |
| 14915 | .chained = true, |
| 14916 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14917 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14918 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14919 | .type = ALC_FIXUP_VERBS, |
| 14920 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14921 | /* Enables internal speaker */ |
| 14922 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14923 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14924 | {} |
| 14925 | } |
| 14926 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14927 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14928 | .type = ALC_FIXUP_SKU, |
| 14929 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14930 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14931 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14932 | .type = ALC_FIXUP_PINS, |
| 14933 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14934 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14935 | { } |
| 14936 | } |
| 14937 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14938 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14939 | .type = ALC_FIXUP_VERBS, |
| 14940 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14941 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14942 | {} |
| 14943 | } |
| 14944 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14945 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14946 | .type = ALC_FIXUP_FUNC, |
| 14947 | .v.func = alc269_fixup_hweq, |
| 14948 | .chained = true, |
| 14949 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14950 | }, |
| 14951 | [ALC271_FIXUP_DMIC] = { |
| 14952 | .type = ALC_FIXUP_FUNC, |
| 14953 | .v.func = alc271_fixup_dmic, |
| 14954 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14955 | }; |
| 14956 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14957 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14958 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14959 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14960 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14961 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14962 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14963 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14964 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14965 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14966 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14967 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14968 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14969 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14970 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14971 | {} |
| 14972 | }; |
| 14973 | |
| 14974 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14975 | /* |
| 14976 | * configuration and preset |
| 14977 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14978 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14979 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14980 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14981 | [ALC269_AMIC] = "laptop-amic", |
| 14982 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14983 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14984 | [ALC269_LIFEBOOK] = "lifebook", |
| 14985 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14986 | }; |
| 14987 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14988 | static const struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14989 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14990 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14991 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14992 | ALC269_AMIC), |
| 14993 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14994 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14995 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14996 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14997 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14998 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14999 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 15000 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 15001 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 15002 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15003 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 15004 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 15005 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 15006 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 15007 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 15008 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 15009 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 15010 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 15011 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 15012 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 15013 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 15014 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 15015 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 15016 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 15017 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 15018 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 15019 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 15020 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 15021 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 15022 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 15023 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 15024 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 15025 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 15026 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 15027 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 15028 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15029 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15030 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15031 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15032 | ALC269_DMIC), |
| 15033 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 15034 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15035 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15036 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 15037 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 15038 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 15039 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 15040 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 15041 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 15042 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15043 | {} |
| 15044 | }; |
| 15045 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15046 | static const struct alc_config_preset alc269_presets[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15047 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15048 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15049 | .init_verbs = { alc269_init_verbs }, |
| 15050 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15051 | .dac_nids = alc269_dac_nids, |
| 15052 | .hp_nid = 0x03, |
| 15053 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15054 | .channel_mode = alc269_modes, |
| 15055 | .input_mux = &alc269_capture_source, |
| 15056 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15057 | [ALC269_QUANTA_FL1] = { |
| 15058 | .mixers = { alc269_quanta_fl1_mixer }, |
| 15059 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 15060 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15061 | .dac_nids = alc269_dac_nids, |
| 15062 | .hp_nid = 0x03, |
| 15063 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15064 | .channel_mode = alc269_modes, |
| 15065 | .input_mux = &alc269_capture_source, |
| 15066 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15067 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 15068 | .init_hook = alc269_quanta_fl1_init_hook, |
| 15069 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15070 | [ALC269_AMIC] = { |
| 15071 | .mixers = { alc269_laptop_mixer }, |
| 15072 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15073 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15074 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15075 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15076 | .dac_nids = alc269_dac_nids, |
| 15077 | .hp_nid = 0x03, |
| 15078 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15079 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15080 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15081 | .setup = alc269_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15082 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15083 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15084 | [ALC269_DMIC] = { |
| 15085 | .mixers = { alc269_laptop_mixer }, |
| 15086 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15087 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15088 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15089 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15090 | .dac_nids = alc269_dac_nids, |
| 15091 | .hp_nid = 0x03, |
| 15092 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15093 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15094 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15095 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15096 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15097 | }, |
| 15098 | [ALC269VB_AMIC] = { |
| 15099 | .mixers = { alc269vb_laptop_mixer }, |
| 15100 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15101 | .init_verbs = { alc269vb_init_verbs, |
| 15102 | alc269vb_laptop_amic_init_verbs }, |
| 15103 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15104 | .dac_nids = alc269_dac_nids, |
| 15105 | .hp_nid = 0x03, |
| 15106 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15107 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15108 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15109 | .setup = alc269vb_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15110 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15111 | }, |
| 15112 | [ALC269VB_DMIC] = { |
| 15113 | .mixers = { alc269vb_laptop_mixer }, |
| 15114 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15115 | .init_verbs = { alc269vb_init_verbs, |
| 15116 | alc269vb_laptop_dmic_init_verbs }, |
| 15117 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15118 | .dac_nids = alc269_dac_nids, |
| 15119 | .hp_nid = 0x03, |
| 15120 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15121 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15122 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15123 | .setup = alc269vb_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15124 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15125 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15126 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15127 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15128 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15129 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15130 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15131 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15132 | .dac_nids = alc269_dac_nids, |
| 15133 | .hp_nid = 0x03, |
| 15134 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15135 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15136 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15137 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15138 | .init_hook = alc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15139 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15140 | [ALC269_LIFEBOOK] = { |
| 15141 | .mixers = { alc269_lifebook_mixer }, |
| 15142 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15143 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15144 | .dac_nids = alc269_dac_nids, |
| 15145 | .hp_nid = 0x03, |
| 15146 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15147 | .channel_mode = alc269_modes, |
| 15148 | .input_mux = &alc269_capture_source, |
| 15149 | .unsol_event = alc269_lifebook_unsol_event, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15150 | .setup = alc269_lifebook_setup, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15151 | .init_hook = alc269_lifebook_init_hook, |
| 15152 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15153 | [ALC271_ACER] = { |
| 15154 | .mixers = { alc269_asus_mixer }, |
| 15155 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15156 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15157 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15158 | .dac_nids = alc269_dac_nids, |
| 15159 | .adc_nids = alc262_dmic_adc_nids, |
| 15160 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15161 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15162 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15163 | .channel_mode = alc269_modes, |
| 15164 | .input_mux = &alc269_capture_source, |
| 15165 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15166 | .unsol_event = alc_sku_unsol_event, |
| 15167 | .setup = alc269vb_laptop_dmic_setup, |
| 15168 | .init_hook = alc_inithook, |
| 15169 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15170 | }; |
| 15171 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15172 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15173 | { |
| 15174 | int val; |
| 15175 | |
| 15176 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15177 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15178 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15179 | } |
| 15180 | |
| 15181 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15182 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15183 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15184 | } |
| 15185 | |
| 15186 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15187 | val = alc_read_coef_idx(codec, 0x04); |
| 15188 | /* Power up output pin */ |
| 15189 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15190 | } |
| 15191 | |
| 15192 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15193 | val = alc_read_coef_idx(codec, 0xd); |
| 15194 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15195 | /* Capless ramp up clock control */ |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 15196 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15197 | } |
| 15198 | val = alc_read_coef_idx(codec, 0x17); |
| 15199 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15200 | /* Class D power on reset */ |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 15201 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15202 | } |
| 15203 | } |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 15204 | |
| 15205 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ |
| 15206 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); |
| 15207 | |
| 15208 | val = alc_read_coef_idx(codec, 0x4); /* HP */ |
| 15209 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); |
| 15210 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15211 | return 0; |
| 15212 | } |
| 15213 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15214 | static int patch_alc269(struct hda_codec *codec) |
| 15215 | { |
| 15216 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15217 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15218 | int err; |
| 15219 | |
| 15220 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15221 | if (spec == NULL) |
| 15222 | return -ENOMEM; |
| 15223 | |
| 15224 | codec->spec = spec; |
| 15225 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15226 | alc_auto_parse_customize_define(codec); |
| 15227 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15228 | if (codec->vendor_id == 0x10ec0269) { |
| 15229 | coef = alc_read_coef_idx(codec, 0); |
| 15230 | if ((coef & 0x00f0) == 0x0010) { |
| 15231 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15232 | spec->cdefine.platform_type == 1) { |
| 15233 | alc_codec_rename(codec, "ALC271X"); |
| 15234 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15235 | } else if ((coef & 0xf000) == 0x1000) { |
| 15236 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15237 | } else if ((coef & 0xf000) == 0x2000) { |
| 15238 | alc_codec_rename(codec, "ALC259"); |
| 15239 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15240 | } else if ((coef & 0xf000) == 0x3000) { |
| 15241 | alc_codec_rename(codec, "ALC258"); |
| 15242 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15243 | } else { |
| 15244 | alc_codec_rename(codec, "ALC269VB"); |
| 15245 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15246 | } |
| 15247 | } else |
| 15248 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15249 | alc269_fill_coef(codec); |
| 15250 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15251 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15252 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15253 | alc269_models, |
| 15254 | alc269_cfg_tbl); |
| 15255 | |
| 15256 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15257 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15258 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15259 | board_config = ALC269_AUTO; |
| 15260 | } |
| 15261 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15262 | if (board_config == ALC269_AUTO) { |
| 15263 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15264 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15265 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15266 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15267 | if (board_config == ALC269_AUTO) { |
| 15268 | /* automatic parse from the BIOS config */ |
| 15269 | err = alc269_parse_auto_config(codec); |
| 15270 | if (err < 0) { |
| 15271 | alc_free(codec); |
| 15272 | return err; |
| 15273 | } else if (!err) { |
| 15274 | printk(KERN_INFO |
| 15275 | "hda_codec: Cannot set up configuration " |
| 15276 | "from BIOS. Using base mode...\n"); |
| 15277 | board_config = ALC269_BASIC; |
| 15278 | } |
| 15279 | } |
| 15280 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15281 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15282 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15283 | if (err < 0) { |
| 15284 | alc_free(codec); |
| 15285 | return err; |
| 15286 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15287 | } |
| 15288 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15289 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15290 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15291 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15292 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15293 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15294 | * fix the sample rate of analog I/O to 44.1kHz |
| 15295 | */ |
| 15296 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15297 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15298 | } else if (spec->dual_adc_switch) { |
| 15299 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15300 | /* switch ADC dynamically */ |
| 15301 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15302 | } else { |
| 15303 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15304 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15305 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15306 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15307 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15308 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15309 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15310 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15311 | spec->adc_nids = alc269_adc_nids; |
| 15312 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15313 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15314 | } else { |
| 15315 | spec->adc_nids = alc269vb_adc_nids; |
| 15316 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15317 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15318 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15319 | } |
| 15320 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15321 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15322 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15323 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15324 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15325 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15326 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15327 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15328 | spec->vmaster_nid = 0x02; |
| 15329 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15330 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15331 | #ifdef SND_HDA_NEEDS_RESUME |
| 15332 | codec->patch_ops.resume = alc269_resume; |
| 15333 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15334 | if (board_config == ALC269_AUTO) |
| 15335 | spec->init_hook = alc269_auto_init; |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 15336 | spec->shutup = alc269_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15337 | |
| 15338 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15339 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15340 | if (!spec->loopback.amplist) |
| 15341 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15342 | if (alc269_mic2_for_mute_led(codec)) |
| 15343 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15344 | #endif |
| 15345 | |
| 15346 | return 0; |
| 15347 | } |
| 15348 | |
| 15349 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15350 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15351 | */ |
| 15352 | |
| 15353 | /* |
| 15354 | * set the path ways for 2 channel output |
| 15355 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15356 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15357 | static const struct hda_verb alc861_threestack_ch2_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15358 | /* set pin widget 1Ah (line in) for input */ |
| 15359 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15360 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15361 | * the vref |
| 15362 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15363 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15364 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15365 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15366 | #if 0 |
| 15367 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15368 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15369 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15370 | { } /* end */ |
| 15371 | }; |
| 15372 | /* |
| 15373 | * 6ch mode |
| 15374 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15375 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15376 | static const struct hda_verb alc861_threestack_ch6_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15377 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15378 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15379 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15380 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15381 | |
| 15382 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15383 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15384 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15385 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15386 | #if 0 |
| 15387 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15388 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15389 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15390 | { } /* end */ |
| 15391 | }; |
| 15392 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15393 | static const struct hda_channel_mode alc861_threestack_modes[2] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15394 | { 2, alc861_threestack_ch2_init }, |
| 15395 | { 6, alc861_threestack_ch6_init }, |
| 15396 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15397 | /* Set mic1 as input and unmute the mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15398 | static const struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15399 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15400 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15401 | { } /* end */ |
| 15402 | }; |
| 15403 | /* Set mic1 as output and mute mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15404 | static const struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15405 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15406 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15407 | { } /* end */ |
| 15408 | }; |
| 15409 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15410 | static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15411 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15412 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15413 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15414 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15415 | /* Set mic1 and line-in as input and unmute the mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15416 | static const struct hda_verb alc861_asus_ch2_init[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15417 | /* set pin widget 1Ah (line in) for input */ |
| 15418 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15419 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15420 | * the vref |
| 15421 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15422 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15423 | |
| 15424 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15425 | #if 0 |
| 15426 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15427 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15428 | #endif |
| 15429 | { } /* end */ |
| 15430 | }; |
| 15431 | /* Set mic1 nad line-in as output and mute mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15432 | static const struct hda_verb alc861_asus_ch6_init[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15433 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15434 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15435 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15436 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15437 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15438 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15439 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15440 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15441 | |
| 15442 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15443 | #if 0 |
| 15444 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15445 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15446 | #endif |
| 15447 | { } /* end */ |
| 15448 | }; |
| 15449 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15450 | static const struct hda_channel_mode alc861_asus_modes[2] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15451 | { 2, alc861_asus_ch2_init }, |
| 15452 | { 6, alc861_asus_ch6_init }, |
| 15453 | }; |
| 15454 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15455 | /* patch-ALC861 */ |
| 15456 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15457 | static const struct snd_kcontrol_new alc861_base_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15458 | /* output mixer control */ |
| 15459 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15460 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15461 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15462 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15463 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15464 | |
| 15465 | /*Input mixer control */ |
| 15466 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15467 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15468 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15469 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15470 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15471 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15474 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15475 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15476 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15477 | { } /* end */ |
| 15478 | }; |
| 15479 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15480 | static const struct snd_kcontrol_new alc861_3ST_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15481 | /* output mixer control */ |
| 15482 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15483 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15484 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15485 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15486 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15487 | |
| 15488 | /* Input mixer control */ |
| 15489 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15490 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15491 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15492 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15493 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15494 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15495 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15496 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15497 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15500 | { |
| 15501 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15502 | .name = "Channel Mode", |
| 15503 | .info = alc_ch_mode_info, |
| 15504 | .get = alc_ch_mode_get, |
| 15505 | .put = alc_ch_mode_put, |
| 15506 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15507 | }, |
| 15508 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15509 | }; |
| 15510 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15511 | static const struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15512 | /* output mixer control */ |
| 15513 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15514 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15515 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15516 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15517 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15518 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15519 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15520 | static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15521 | /* output mixer control */ |
| 15522 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15523 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15524 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15525 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15526 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15527 | |
| 15528 | /* Input mixer control */ |
| 15529 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15530 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15531 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15532 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15533 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15534 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15535 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15536 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15537 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15538 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15539 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15540 | { |
| 15541 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15542 | .name = "Channel Mode", |
| 15543 | .info = alc_ch_mode_info, |
| 15544 | .get = alc_ch_mode_get, |
| 15545 | .put = alc_ch_mode_put, |
| 15546 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15547 | }, |
| 15548 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15549 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15550 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15551 | static const struct snd_kcontrol_new alc861_asus_mixer[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15552 | /* output mixer control */ |
| 15553 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15554 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15555 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15556 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15557 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15558 | |
| 15559 | /* Input mixer control */ |
| 15560 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15561 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15562 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15563 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15564 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15565 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15566 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15567 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15568 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15570 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15571 | { |
| 15572 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15573 | .name = "Channel Mode", |
| 15574 | .info = alc_ch_mode_info, |
| 15575 | .get = alc_ch_mode_get, |
| 15576 | .put = alc_ch_mode_put, |
| 15577 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15578 | }, |
| 15579 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15580 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15581 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15582 | /* additional mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15583 | static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15584 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15585 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15586 | { } |
| 15587 | }; |
| 15588 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15589 | /* |
| 15590 | * generic initialization of ADC, input mixers and output mixers |
| 15591 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15592 | static const struct hda_verb alc861_base_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15593 | /* |
| 15594 | * Unmute ADC0 and set the default input to mic-in |
| 15595 | */ |
| 15596 | /* port-A for surround (rear panel) */ |
| 15597 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15598 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15599 | /* port-B for mic-in (rear panel) with vref */ |
| 15600 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15601 | /* port-C for line-in (rear panel) */ |
| 15602 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15603 | /* port-D for Front */ |
| 15604 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15605 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15606 | /* port-E for HP out (front panel) */ |
| 15607 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15608 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15609 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15610 | /* port-F for mic-in (front panel) with vref */ |
| 15611 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15612 | /* port-G for CLFE (rear panel) */ |
| 15613 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15614 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15615 | /* port-H for side (rear panel) */ |
| 15616 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15617 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15618 | /* CD-in */ |
| 15619 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15620 | /* route front mic to ADC1*/ |
| 15621 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15622 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15623 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15624 | /* Unmute DAC0~3 & spdif out*/ |
| 15625 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15626 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15627 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15628 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15629 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15630 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15631 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15632 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15633 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15634 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15635 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15636 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15637 | /* Unmute Stereo Mixer 15 */ |
| 15638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15639 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15641 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15642 | |
| 15643 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15644 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15645 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15646 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15647 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15648 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15649 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15650 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15651 | /* hp used DAC 3 (Front) */ |
| 15652 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15653 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15654 | |
| 15655 | { } |
| 15656 | }; |
| 15657 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15658 | static const struct hda_verb alc861_threestack_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15659 | /* |
| 15660 | * Unmute ADC0 and set the default input to mic-in |
| 15661 | */ |
| 15662 | /* port-A for surround (rear panel) */ |
| 15663 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15664 | /* port-B for mic-in (rear panel) with vref */ |
| 15665 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15666 | /* port-C for line-in (rear panel) */ |
| 15667 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15668 | /* port-D for Front */ |
| 15669 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15670 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15671 | /* port-E for HP out (front panel) */ |
| 15672 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15673 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15674 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15675 | /* port-F for mic-in (front panel) with vref */ |
| 15676 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15677 | /* port-G for CLFE (rear panel) */ |
| 15678 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15679 | /* port-H for side (rear panel) */ |
| 15680 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15681 | /* CD-in */ |
| 15682 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15683 | /* route front mic to ADC1*/ |
| 15684 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15685 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15686 | /* Unmute DAC0~3 & spdif out*/ |
| 15687 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15688 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15689 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15690 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15692 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15693 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15694 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15695 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15696 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15697 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15698 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15699 | /* Unmute Stereo Mixer 15 */ |
| 15700 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15701 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15703 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15704 | |
| 15705 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15706 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15707 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15708 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15709 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15710 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15711 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15712 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15713 | /* hp used DAC 3 (Front) */ |
| 15714 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15715 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15716 | { } |
| 15717 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15718 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15719 | static const struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15720 | /* |
| 15721 | * Unmute ADC0 and set the default input to mic-in |
| 15722 | */ |
| 15723 | /* port-A for surround (rear panel) */ |
| 15724 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15725 | /* port-B for mic-in (rear panel) with vref */ |
| 15726 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15727 | /* port-C for line-in (rear panel) */ |
| 15728 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15729 | /* port-D for Front */ |
| 15730 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15731 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15732 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15733 | /* this has to be set to VREF80 */ |
| 15734 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15735 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15736 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15737 | /* port-F for mic-in (front panel) with vref */ |
| 15738 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15739 | /* port-G for CLFE (rear panel) */ |
| 15740 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15741 | /* port-H for side (rear panel) */ |
| 15742 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15743 | /* CD-in */ |
| 15744 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15745 | /* route front mic to ADC1*/ |
| 15746 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15748 | /* Unmute DAC0~3 & spdif out*/ |
| 15749 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15750 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15751 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15752 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15754 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15755 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15756 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15757 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15758 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15759 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15760 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15761 | /* Unmute Stereo Mixer 15 */ |
| 15762 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15763 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15764 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15765 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15766 | |
| 15767 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15768 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15769 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15770 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15771 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15772 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15773 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15774 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15775 | /* hp used DAC 3 (Front) */ |
| 15776 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15777 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15778 | { } |
| 15779 | }; |
| 15780 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15781 | static const struct hda_verb alc861_asus_init_verbs[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15782 | /* |
| 15783 | * Unmute ADC0 and set the default input to mic-in |
| 15784 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15785 | /* port-A for surround (rear panel) |
| 15786 | * according to codec#0 this is the HP jack |
| 15787 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15788 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15789 | /* route front PCM to HP */ |
| 15790 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15791 | /* port-B for mic-in (rear panel) with vref */ |
| 15792 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15793 | /* port-C for line-in (rear panel) */ |
| 15794 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15795 | /* port-D for Front */ |
| 15796 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15797 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15798 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15799 | /* this has to be set to VREF80 */ |
| 15800 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15801 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15802 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15803 | /* port-F for mic-in (front panel) with vref */ |
| 15804 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15805 | /* port-G for CLFE (rear panel) */ |
| 15806 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15807 | /* port-H for side (rear panel) */ |
| 15808 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15809 | /* CD-in */ |
| 15810 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15811 | /* route front mic to ADC1*/ |
| 15812 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15813 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15814 | /* Unmute DAC0~3 & spdif out*/ |
| 15815 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15816 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15817 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15818 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15820 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15821 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15822 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15823 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15824 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15825 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15826 | /* Unmute Stereo Mixer 15 */ |
| 15827 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15828 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15829 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15830 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15831 | |
| 15832 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15833 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15834 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15835 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15836 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15837 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15838 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15839 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15840 | /* hp used DAC 3 (Front) */ |
| 15841 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15842 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15843 | { } |
| 15844 | }; |
| 15845 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15846 | /* additional init verbs for ASUS laptops */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15847 | static const struct hda_verb alc861_asus_laptop_init_verbs[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15848 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15849 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15850 | { } |
| 15851 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15853 | /* |
| 15854 | * generic initialization of ADC, input mixers and output mixers |
| 15855 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15856 | static const struct hda_verb alc861_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15857 | /* |
| 15858 | * Unmute ADC0 and set the default input to mic-in |
| 15859 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15860 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15861 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15863 | /* Unmute DAC0~3 & spdif out*/ |
| 15864 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15865 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15866 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15867 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15868 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15870 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15871 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15872 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15873 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15874 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15875 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15876 | /* Unmute Stereo Mixer 15 */ |
| 15877 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15878 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15879 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15880 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15881 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15882 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15883 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15884 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15885 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15886 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15887 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15888 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15889 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15890 | |
| 15891 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15892 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15893 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15894 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15895 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15896 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15897 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15898 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15899 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15900 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15901 | |
| 15902 | { } |
| 15903 | }; |
| 15904 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15905 | static const struct hda_verb alc861_toshiba_init_verbs[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15906 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15907 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15908 | { } |
| 15909 | }; |
| 15910 | |
| 15911 | /* toggle speaker-output according to the hp-jack state */ |
| 15912 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15913 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15914 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15915 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15916 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15917 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15918 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15919 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15920 | } |
| 15921 | |
| 15922 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15923 | unsigned int res) |
| 15924 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15925 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15926 | alc861_toshiba_automute(codec); |
| 15927 | } |
| 15928 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15929 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15930 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15931 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15932 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15933 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15934 | |
| 15935 | |
| 15936 | #define ALC861_DIGOUT_NID 0x07 |
| 15937 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15938 | static const struct hda_channel_mode alc861_8ch_modes[1] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15939 | { 8, NULL } |
| 15940 | }; |
| 15941 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15942 | static const hda_nid_t alc861_dac_nids[4] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15943 | /* front, surround, clfe, side */ |
| 15944 | 0x03, 0x06, 0x05, 0x04 |
| 15945 | }; |
| 15946 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15947 | static const hda_nid_t alc660_dac_nids[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15948 | /* front, clfe, surround */ |
| 15949 | 0x03, 0x05, 0x06 |
| 15950 | }; |
| 15951 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15952 | static const hda_nid_t alc861_adc_nids[1] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15953 | /* ADC0-2 */ |
| 15954 | 0x08, |
| 15955 | }; |
| 15956 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15957 | static const struct hda_input_mux alc861_capture_source = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15958 | .num_items = 5, |
| 15959 | .items = { |
| 15960 | { "Mic", 0x0 }, |
| 15961 | { "Front Mic", 0x3 }, |
| 15962 | { "Line", 0x1 }, |
| 15963 | { "CD", 0x4 }, |
| 15964 | { "Mixer", 0x5 }, |
| 15965 | }, |
| 15966 | }; |
| 15967 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15968 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15969 | { |
| 15970 | struct alc_spec *spec = codec->spec; |
| 15971 | hda_nid_t mix, srcs[5]; |
| 15972 | int i, j, num; |
| 15973 | |
| 15974 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15975 | return 0; |
| 15976 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15977 | if (num < 0) |
| 15978 | return 0; |
| 15979 | for (i = 0; i < num; i++) { |
| 15980 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15981 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15982 | if (type != AC_WID_AUD_OUT) |
| 15983 | continue; |
| 15984 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15985 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15986 | break; |
| 15987 | if (j >= spec->multiout.num_dacs) |
| 15988 | return srcs[i]; |
| 15989 | } |
| 15990 | return 0; |
| 15991 | } |
| 15992 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15993 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15994 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15995 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15996 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15997 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15998 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15999 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16000 | |
| 16001 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 16002 | for (i = 0; i < cfg->line_outs; i++) { |
| 16003 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16004 | dac = alc861_look_for_dac(codec, nid); |
| 16005 | if (!dac) |
| 16006 | continue; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 16007 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16008 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16009 | return 0; |
| 16010 | } |
| 16011 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16012 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 16013 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16014 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16015 | return __add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16016 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 16017 | } |
| 16018 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16019 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 16020 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 16021 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16022 | /* add playback controls from the parsed DAC table */ |
| 16023 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 16024 | const struct auto_pin_cfg *cfg) |
| 16025 | { |
| 16026 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16027 | static const char * const chname[4] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16028 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16029 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16030 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16031 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16032 | int i, err, noutputs; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16033 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16034 | noutputs = cfg->line_outs; |
| 16035 | if (spec->multi_ios > 0) |
| 16036 | noutputs += spec->multi_ios; |
| 16037 | |
| 16038 | for (i = 0; i < noutputs; i++) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16039 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16040 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16041 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16042 | if (!pfx && i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16043 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16044 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16045 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16046 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16047 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16048 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16049 | return err; |
| 16050 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16051 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 16052 | int index = i; |
| 16053 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 16054 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 16055 | index = 0; |
| 16056 | } |
| 16057 | err = __alc861_create_out_sw(codec, name, nid, index, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16058 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16059 | return err; |
| 16060 | } |
| 16061 | } |
| 16062 | return 0; |
| 16063 | } |
| 16064 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16065 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16066 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16067 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16068 | int err; |
| 16069 | hda_nid_t nid; |
| 16070 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16071 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16072 | return 0; |
| 16073 | |
| 16074 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16075 | nid = alc861_look_for_dac(codec, pin); |
| 16076 | if (nid) { |
| 16077 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 16078 | if (err < 0) |
| 16079 | return err; |
| 16080 | spec->multiout.hp_nid = nid; |
| 16081 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16082 | } |
| 16083 | return 0; |
| 16084 | } |
| 16085 | |
| 16086 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16087 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16088 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16089 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16090 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16091 | } |
| 16092 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16093 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16094 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16095 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16096 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16097 | hda_nid_t mix, srcs[5]; |
| 16098 | int i, num; |
| 16099 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16100 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 16101 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16102 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 16103 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16104 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 16105 | return; |
| 16106 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 16107 | if (num < 0) |
| 16108 | return; |
| 16109 | for (i = 0; i < num; i++) { |
| 16110 | unsigned int mute; |
| 16111 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 16112 | mute = AMP_IN_UNMUTE(i); |
| 16113 | else |
| 16114 | mute = AMP_IN_MUTE(i); |
| 16115 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16116 | mute); |
| 16117 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16118 | } |
| 16119 | |
| 16120 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 16121 | { |
| 16122 | struct alc_spec *spec = codec->spec; |
| 16123 | int i; |
| 16124 | |
| 16125 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 16126 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16127 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16128 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16129 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16130 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16131 | } |
| 16132 | } |
| 16133 | |
| 16134 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 16135 | { |
| 16136 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16137 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16138 | if (spec->autocfg.hp_outs) |
| 16139 | alc861_auto_set_output_and_unmute(codec, |
| 16140 | spec->autocfg.hp_pins[0], |
| 16141 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16142 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16143 | if (spec->autocfg.speaker_outs) |
| 16144 | alc861_auto_set_output_and_unmute(codec, |
| 16145 | spec->autocfg.speaker_pins[0], |
| 16146 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16147 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16148 | } |
| 16149 | |
| 16150 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 16151 | { |
| 16152 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16153 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16154 | int i; |
| 16155 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 16156 | for (i = 0; i < cfg->num_inputs; i++) { |
| 16157 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16158 | if (nid >= 0x0c && nid <= 0x11) |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 16159 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16160 | } |
| 16161 | } |
| 16162 | |
| 16163 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16164 | /* return 1 if successful, 0 if the proper config is not found, |
| 16165 | * or a negative error code |
| 16166 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16167 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16168 | { |
| 16169 | struct alc_spec *spec = codec->spec; |
| 16170 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16171 | static const hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16172 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16173 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16174 | alc861_ignore); |
| 16175 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16176 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16177 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16178 | return 0; /* can't find valid BIOS pin config */ |
| 16179 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16180 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16181 | if (err < 0) |
| 16182 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16183 | err = alc_auto_add_multi_channel_mode(codec); |
| 16184 | if (err < 0) |
| 16185 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16186 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16187 | if (err < 0) |
| 16188 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16189 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16190 | if (err < 0) |
| 16191 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16192 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16193 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16194 | return err; |
| 16195 | |
| 16196 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16197 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16198 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16199 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16200 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16201 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16202 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16203 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16204 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16205 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16206 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16207 | |
| 16208 | spec->adc_nids = alc861_adc_nids; |
| 16209 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16210 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16211 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16212 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16213 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16214 | return 1; |
| 16215 | } |
| 16216 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16217 | /* additional initialization for auto-configuration model */ |
| 16218 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16219 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16220 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16221 | alc861_auto_init_multi_out(codec); |
| 16222 | alc861_auto_init_hp_out(codec); |
| 16223 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16224 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16225 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16226 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16227 | } |
| 16228 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16229 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16230 | static const struct hda_amp_list alc861_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16231 | { 0x15, HDA_INPUT, 0 }, |
| 16232 | { 0x15, HDA_INPUT, 1 }, |
| 16233 | { 0x15, HDA_INPUT, 2 }, |
| 16234 | { 0x15, HDA_INPUT, 3 }, |
| 16235 | { } /* end */ |
| 16236 | }; |
| 16237 | #endif |
| 16238 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16239 | |
| 16240 | /* |
| 16241 | * configuration and preset |
| 16242 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16243 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16244 | [ALC861_3ST] = "3stack", |
| 16245 | [ALC660_3ST] = "3stack-660", |
| 16246 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16247 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16248 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16249 | [ALC861_TOSHIBA] = "toshiba", |
| 16250 | [ALC861_ASUS] = "asus", |
| 16251 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16252 | [ALC861_AUTO] = "auto", |
| 16253 | }; |
| 16254 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16255 | static const struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16256 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16257 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16258 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16259 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16260 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16261 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16262 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16263 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16264 | * Any other models that need this preset? |
| 16265 | */ |
| 16266 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16267 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16268 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16269 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16270 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16271 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16272 | /* FIXME: the below seems conflict */ |
| 16273 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16274 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16275 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16276 | {} |
| 16277 | }; |
| 16278 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16279 | static const struct alc_config_preset alc861_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16280 | [ALC861_3ST] = { |
| 16281 | .mixers = { alc861_3ST_mixer }, |
| 16282 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16283 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16284 | .dac_nids = alc861_dac_nids, |
| 16285 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16286 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16287 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16288 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16289 | .adc_nids = alc861_adc_nids, |
| 16290 | .input_mux = &alc861_capture_source, |
| 16291 | }, |
| 16292 | [ALC861_3ST_DIG] = { |
| 16293 | .mixers = { alc861_base_mixer }, |
| 16294 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16295 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16296 | .dac_nids = alc861_dac_nids, |
| 16297 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16298 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16299 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16300 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16301 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16302 | .adc_nids = alc861_adc_nids, |
| 16303 | .input_mux = &alc861_capture_source, |
| 16304 | }, |
| 16305 | [ALC861_6ST_DIG] = { |
| 16306 | .mixers = { alc861_base_mixer }, |
| 16307 | .init_verbs = { alc861_base_init_verbs }, |
| 16308 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16309 | .dac_nids = alc861_dac_nids, |
| 16310 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16311 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16312 | .channel_mode = alc861_8ch_modes, |
| 16313 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16314 | .adc_nids = alc861_adc_nids, |
| 16315 | .input_mux = &alc861_capture_source, |
| 16316 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16317 | [ALC660_3ST] = { |
| 16318 | .mixers = { alc861_3ST_mixer }, |
| 16319 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16320 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16321 | .dac_nids = alc660_dac_nids, |
| 16322 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16323 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16324 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16325 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16326 | .adc_nids = alc861_adc_nids, |
| 16327 | .input_mux = &alc861_capture_source, |
| 16328 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16329 | [ALC861_UNIWILL_M31] = { |
| 16330 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16331 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16332 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16333 | .dac_nids = alc861_dac_nids, |
| 16334 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16335 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16336 | .channel_mode = alc861_uniwill_m31_modes, |
| 16337 | .need_dac_fix = 1, |
| 16338 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16339 | .adc_nids = alc861_adc_nids, |
| 16340 | .input_mux = &alc861_capture_source, |
| 16341 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16342 | [ALC861_TOSHIBA] = { |
| 16343 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16344 | .init_verbs = { alc861_base_init_verbs, |
| 16345 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16346 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16347 | .dac_nids = alc861_dac_nids, |
| 16348 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16349 | .channel_mode = alc883_3ST_2ch_modes, |
| 16350 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16351 | .adc_nids = alc861_adc_nids, |
| 16352 | .input_mux = &alc861_capture_source, |
| 16353 | .unsol_event = alc861_toshiba_unsol_event, |
| 16354 | .init_hook = alc861_toshiba_automute, |
| 16355 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16356 | [ALC861_ASUS] = { |
| 16357 | .mixers = { alc861_asus_mixer }, |
| 16358 | .init_verbs = { alc861_asus_init_verbs }, |
| 16359 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16360 | .dac_nids = alc861_dac_nids, |
| 16361 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16362 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16363 | .channel_mode = alc861_asus_modes, |
| 16364 | .need_dac_fix = 1, |
| 16365 | .hp_nid = 0x06, |
| 16366 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16367 | .adc_nids = alc861_adc_nids, |
| 16368 | .input_mux = &alc861_capture_source, |
| 16369 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16370 | [ALC861_ASUS_LAPTOP] = { |
| 16371 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16372 | .init_verbs = { alc861_asus_init_verbs, |
| 16373 | alc861_asus_laptop_init_verbs }, |
| 16374 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16375 | .dac_nids = alc861_dac_nids, |
| 16376 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16377 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16378 | .channel_mode = alc883_3ST_2ch_modes, |
| 16379 | .need_dac_fix = 1, |
| 16380 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16381 | .adc_nids = alc861_adc_nids, |
| 16382 | .input_mux = &alc861_capture_source, |
| 16383 | }, |
| 16384 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16385 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16386 | /* Pin config fixes */ |
| 16387 | enum { |
| 16388 | PINFIX_FSC_AMILO_PI1505, |
| 16389 | }; |
| 16390 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16391 | static const struct alc_fixup alc861_fixups[] = { |
| 16392 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16393 | .type = ALC_FIXUP_PINS, |
| 16394 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16395 | { 0x0b, 0x0221101f }, /* HP */ |
| 16396 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16397 | { } |
| 16398 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16399 | }, |
| 16400 | }; |
| 16401 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16402 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16403 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16404 | {} |
| 16405 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16406 | |
| 16407 | static int patch_alc861(struct hda_codec *codec) |
| 16408 | { |
| 16409 | struct alc_spec *spec; |
| 16410 | int board_config; |
| 16411 | int err; |
| 16412 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16413 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16414 | if (spec == NULL) |
| 16415 | return -ENOMEM; |
| 16416 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16417 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16418 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16419 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16420 | alc861_models, |
| 16421 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16422 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16423 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16424 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16425 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16426 | board_config = ALC861_AUTO; |
| 16427 | } |
| 16428 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16429 | if (board_config == ALC861_AUTO) { |
| 16430 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16431 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16432 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16433 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16434 | if (board_config == ALC861_AUTO) { |
| 16435 | /* automatic parse from the BIOS config */ |
| 16436 | err = alc861_parse_auto_config(codec); |
| 16437 | if (err < 0) { |
| 16438 | alc_free(codec); |
| 16439 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16440 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16441 | printk(KERN_INFO |
| 16442 | "hda_codec: Cannot set up configuration " |
| 16443 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16444 | board_config = ALC861_3ST_DIG; |
| 16445 | } |
| 16446 | } |
| 16447 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16448 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16449 | if (err < 0) { |
| 16450 | alc_free(codec); |
| 16451 | return err; |
| 16452 | } |
| 16453 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16454 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16455 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16456 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16457 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16458 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16459 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16460 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16461 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16462 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16463 | if (!spec->cap_mixer) |
| 16464 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16465 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16466 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16467 | spec->vmaster_nid = 0x03; |
| 16468 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16469 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16470 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16471 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16472 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16473 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16474 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16475 | spec->power_hook = alc_power_eapd; |
| 16476 | #endif |
| 16477 | } |
| 16478 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16479 | if (!spec->loopback.amplist) |
| 16480 | spec->loopback.amplist = alc861_loopbacks; |
| 16481 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16482 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16483 | return 0; |
| 16484 | } |
| 16485 | |
| 16486 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16487 | * ALC861-VD support |
| 16488 | * |
| 16489 | * Based on ALC882 |
| 16490 | * |
| 16491 | * In addition, an independent DAC |
| 16492 | */ |
| 16493 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16494 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16495 | static const hda_nid_t alc861vd_dac_nids[4] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16496 | /* front, surr, clfe, side surr */ |
| 16497 | 0x02, 0x03, 0x04, 0x05 |
| 16498 | }; |
| 16499 | |
| 16500 | /* dac_nids for ALC660vd are in a different order - according to |
| 16501 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16502 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16503 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16504 | * - and it is the same as in 861vd. |
| 16505 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16506 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16507 | static const hda_nid_t alc660vd_dac_nids[3] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16508 | /* front, rear, clfe, rear_surr */ |
| 16509 | 0x02, 0x04, 0x03 |
| 16510 | }; |
| 16511 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16512 | static const hda_nid_t alc861vd_adc_nids[1] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16513 | /* ADC0 */ |
| 16514 | 0x09, |
| 16515 | }; |
| 16516 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16517 | static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16518 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16519 | /* input MUX */ |
| 16520 | /* FIXME: should be a matrix-type input source selection */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16521 | static const struct hda_input_mux alc861vd_capture_source = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16522 | .num_items = 4, |
| 16523 | .items = { |
| 16524 | { "Mic", 0x0 }, |
| 16525 | { "Front Mic", 0x1 }, |
| 16526 | { "Line", 0x2 }, |
| 16527 | { "CD", 0x4 }, |
| 16528 | }, |
| 16529 | }; |
| 16530 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16531 | static const struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16532 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16533 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16534 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16535 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16536 | }, |
| 16537 | }; |
| 16538 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16539 | static const struct hda_input_mux alc861vd_hp_capture_source = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16540 | .num_items = 2, |
| 16541 | .items = { |
| 16542 | { "Front Mic", 0x0 }, |
| 16543 | { "ATAPI Mic", 0x1 }, |
| 16544 | }, |
| 16545 | }; |
| 16546 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16547 | /* |
| 16548 | * 2ch mode |
| 16549 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16550 | static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16551 | { 2, NULL } |
| 16552 | }; |
| 16553 | |
| 16554 | /* |
| 16555 | * 6ch mode |
| 16556 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16557 | static const struct hda_verb alc861vd_6stack_ch6_init[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16558 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16559 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16560 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16561 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16562 | { } /* end */ |
| 16563 | }; |
| 16564 | |
| 16565 | /* |
| 16566 | * 8ch mode |
| 16567 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16568 | static const struct hda_verb alc861vd_6stack_ch8_init[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16569 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16570 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16571 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16572 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16573 | { } /* end */ |
| 16574 | }; |
| 16575 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16576 | static const struct hda_channel_mode alc861vd_6stack_modes[2] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16577 | { 6, alc861vd_6stack_ch6_init }, |
| 16578 | { 8, alc861vd_6stack_ch8_init }, |
| 16579 | }; |
| 16580 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16581 | static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16582 | { |
| 16583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16584 | .name = "Channel Mode", |
| 16585 | .info = alc_ch_mode_info, |
| 16586 | .get = alc_ch_mode_get, |
| 16587 | .put = alc_ch_mode_put, |
| 16588 | }, |
| 16589 | { } /* end */ |
| 16590 | }; |
| 16591 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16592 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16593 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16594 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16595 | static const struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16596 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16597 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16598 | |
| 16599 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16600 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16601 | |
| 16602 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16603 | HDA_OUTPUT), |
| 16604 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16605 | HDA_OUTPUT), |
| 16606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16608 | |
| 16609 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16610 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16611 | |
| 16612 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16613 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16614 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16615 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16617 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16618 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16621 | |
| 16622 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16623 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16624 | |
| 16625 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16626 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16627 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16628 | { } /* end */ |
| 16629 | }; |
| 16630 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16631 | static const struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16634 | |
| 16635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16636 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16637 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16640 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16641 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16642 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16643 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16644 | |
| 16645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16646 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16647 | |
| 16648 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16649 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16650 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16651 | { } /* end */ |
| 16652 | }; |
| 16653 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16654 | static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16655 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16656 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16657 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16658 | |
| 16659 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16660 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16661 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16664 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16665 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16666 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16667 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16668 | |
| 16669 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16670 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16671 | |
| 16672 | { } /* end */ |
| 16673 | }; |
| 16674 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16675 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16676 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16677 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16678 | static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16679 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16680 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16681 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16682 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16683 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16686 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16687 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16688 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16689 | { } /* end */ |
| 16690 | }; |
| 16691 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16692 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16693 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16694 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16695 | static const struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16696 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16697 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16698 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16699 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16700 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16701 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16702 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16703 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16704 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16705 | { } /* end */ |
| 16706 | }; |
| 16707 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16708 | /* |
| 16709 | * generic initialization of ADC, input mixers and output mixers |
| 16710 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16711 | static const struct hda_verb alc861vd_volume_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16712 | /* |
| 16713 | * Unmute ADC0 and set the default input to mic-in |
| 16714 | */ |
| 16715 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16716 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16717 | |
| 16718 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16719 | * the analog-loopback mixer widget |
| 16720 | */ |
| 16721 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16722 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16723 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16727 | |
| 16728 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16729 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16730 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16731 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16732 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16733 | |
| 16734 | /* |
| 16735 | * Set up output mixers (0x02 - 0x05) |
| 16736 | */ |
| 16737 | /* set vol=0 to output mixers */ |
| 16738 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16739 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16740 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16741 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16742 | |
| 16743 | /* set up input amps for analog loopback */ |
| 16744 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16745 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16748 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16749 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16750 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16752 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16753 | |
| 16754 | { } |
| 16755 | }; |
| 16756 | |
| 16757 | /* |
| 16758 | * 3-stack pin configuration: |
| 16759 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16760 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16761 | static const struct hda_verb alc861vd_3stack_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16762 | /* |
| 16763 | * Set pin mode and muting |
| 16764 | */ |
| 16765 | /* set front pin widgets 0x14 for output */ |
| 16766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16768 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16769 | |
| 16770 | /* Mic (rear) pin: input vref at 80% */ |
| 16771 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16772 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16773 | /* Front Mic pin: input vref at 80% */ |
| 16774 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16775 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16776 | /* Line In pin: input */ |
| 16777 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16778 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16779 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16780 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16781 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16782 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16783 | /* CD pin widget for input */ |
| 16784 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16785 | |
| 16786 | { } |
| 16787 | }; |
| 16788 | |
| 16789 | /* |
| 16790 | * 6-stack pin configuration: |
| 16791 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16792 | static const struct hda_verb alc861vd_6stack_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16793 | /* |
| 16794 | * Set pin mode and muting |
| 16795 | */ |
| 16796 | /* set front pin widgets 0x14 for output */ |
| 16797 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16798 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16799 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16800 | |
| 16801 | /* Rear Pin: output 1 (0x0d) */ |
| 16802 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16803 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16804 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16805 | /* CLFE Pin: output 2 (0x0e) */ |
| 16806 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16807 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16808 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16809 | /* Side Pin: output 3 (0x0f) */ |
| 16810 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16811 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16812 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16813 | |
| 16814 | /* Mic (rear) pin: input vref at 80% */ |
| 16815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16817 | /* Front Mic pin: input vref at 80% */ |
| 16818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16820 | /* Line In pin: input */ |
| 16821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16823 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16824 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16825 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16826 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16827 | /* CD pin widget for input */ |
| 16828 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16829 | |
| 16830 | { } |
| 16831 | }; |
| 16832 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16833 | static const struct hda_verb alc861vd_eapd_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16834 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16835 | { } |
| 16836 | }; |
| 16837 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16838 | static const struct hda_verb alc660vd_eapd_verbs[] = { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16839 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16840 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16841 | { } |
| 16842 | }; |
| 16843 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16844 | static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16848 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16849 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16850 | {} |
| 16851 | }; |
| 16852 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16853 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16854 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16855 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16856 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16857 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16858 | spec->automute = 1; |
| 16859 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16860 | } |
| 16861 | |
| 16862 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16863 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16864 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16865 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16866 | } |
| 16867 | |
| 16868 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16869 | unsigned int res) |
| 16870 | { |
| 16871 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16872 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16873 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16874 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16875 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16876 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16877 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16878 | } |
| 16879 | } |
| 16880 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16881 | static const struct hda_verb alc861vd_dallas_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16882 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16883 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16884 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16885 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16886 | |
| 16887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16889 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16891 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16893 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16894 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16895 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16896 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16897 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16898 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16899 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16900 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16901 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16902 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16903 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16904 | |
| 16905 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16906 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16907 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16908 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16909 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16910 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16911 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16912 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16913 | |
| 16914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16915 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16916 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16917 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16918 | |
| 16919 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16920 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16921 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16922 | |
| 16923 | { } /* end */ |
| 16924 | }; |
| 16925 | |
| 16926 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16927 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16928 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16929 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16930 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16931 | spec->autocfg.hp_pins[0] = 0x15; |
| 16932 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16933 | spec->automute = 1; |
| 16934 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16935 | } |
| 16936 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16937 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16938 | #define alc861vd_loopbacks alc880_loopbacks |
| 16939 | #endif |
| 16940 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16941 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16942 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16943 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16944 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16945 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16946 | |
| 16947 | /* |
| 16948 | * configuration and preset |
| 16949 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16950 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16951 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16952 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16953 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16954 | [ALC861VD_3ST] = "3stack", |
| 16955 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16956 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16957 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16958 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16959 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16960 | [ALC861VD_AUTO] = "auto", |
| 16961 | }; |
| 16962 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16963 | static const struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16964 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16965 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16966 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16967 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16968 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16969 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16970 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16971 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16972 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16973 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16974 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16975 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16976 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16977 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16978 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16979 | {} |
| 16980 | }; |
| 16981 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16982 | static const struct alc_config_preset alc861vd_presets[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16983 | [ALC660VD_3ST] = { |
| 16984 | .mixers = { alc861vd_3st_mixer }, |
| 16985 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16986 | alc861vd_3stack_init_verbs }, |
| 16987 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16988 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16989 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16990 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16991 | .input_mux = &alc861vd_capture_source, |
| 16992 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16993 | [ALC660VD_3ST_DIG] = { |
| 16994 | .mixers = { alc861vd_3st_mixer }, |
| 16995 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16996 | alc861vd_3stack_init_verbs }, |
| 16997 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16998 | .dac_nids = alc660vd_dac_nids, |
| 16999 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 17000 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17001 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17002 | .input_mux = &alc861vd_capture_source, |
| 17003 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17004 | [ALC861VD_3ST] = { |
| 17005 | .mixers = { alc861vd_3st_mixer }, |
| 17006 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17007 | alc861vd_3stack_init_verbs }, |
| 17008 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17009 | .dac_nids = alc861vd_dac_nids, |
| 17010 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17011 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17012 | .input_mux = &alc861vd_capture_source, |
| 17013 | }, |
| 17014 | [ALC861VD_3ST_DIG] = { |
| 17015 | .mixers = { alc861vd_3st_mixer }, |
| 17016 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17017 | alc861vd_3stack_init_verbs }, |
| 17018 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17019 | .dac_nids = alc861vd_dac_nids, |
| 17020 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17021 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17022 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17023 | .input_mux = &alc861vd_capture_source, |
| 17024 | }, |
| 17025 | [ALC861VD_6ST_DIG] = { |
| 17026 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 17027 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17028 | alc861vd_6stack_init_verbs }, |
| 17029 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17030 | .dac_nids = alc861vd_dac_nids, |
| 17031 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17032 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 17033 | .channel_mode = alc861vd_6stack_modes, |
| 17034 | .input_mux = &alc861vd_capture_source, |
| 17035 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17036 | [ALC861VD_LENOVO] = { |
| 17037 | .mixers = { alc861vd_lenovo_mixer }, |
| 17038 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17039 | alc861vd_3stack_init_verbs, |
| 17040 | alc861vd_eapd_verbs, |
| 17041 | alc861vd_lenovo_unsol_verbs }, |
| 17042 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17043 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17044 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17045 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17046 | .input_mux = &alc861vd_capture_source, |
| 17047 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17048 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17049 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17050 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17051 | [ALC861VD_DALLAS] = { |
| 17052 | .mixers = { alc861vd_dallas_mixer }, |
| 17053 | .init_verbs = { alc861vd_dallas_verbs }, |
| 17054 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17055 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 17056 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17057 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17058 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17059 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17060 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17061 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17062 | }, |
| 17063 | [ALC861VD_HP] = { |
| 17064 | .mixers = { alc861vd_hp_mixer }, |
| 17065 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 17066 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 17067 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17068 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 17069 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17070 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17071 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17072 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17073 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 17074 | .init_hook = alc_hp_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17075 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17076 | [ALC660VD_ASUS_V1S] = { |
| 17077 | .mixers = { alc861vd_lenovo_mixer }, |
| 17078 | .init_verbs = { alc861vd_volume_init_verbs, |
| 17079 | alc861vd_3stack_init_verbs, |
| 17080 | alc861vd_eapd_verbs, |
| 17081 | alc861vd_lenovo_unsol_verbs }, |
| 17082 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 17083 | .dac_nids = alc660vd_dac_nids, |
| 17084 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 17085 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 17086 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 17087 | .input_mux = &alc861vd_capture_source, |
| 17088 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17089 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 17090 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 17091 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17092 | }; |
| 17093 | |
| 17094 | /* |
| 17095 | * BIOS auto configuration |
| 17096 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17097 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 17098 | const struct auto_pin_cfg *cfg) |
| 17099 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 17100 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17101 | } |
| 17102 | |
| 17103 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17104 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17105 | hda_nid_t nid, int pin_type, int dac_idx) |
| 17106 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17107 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17108 | } |
| 17109 | |
| 17110 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 17111 | { |
| 17112 | struct alc_spec *spec = codec->spec; |
| 17113 | int i; |
| 17114 | |
| 17115 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17116 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17117 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17118 | if (nid) |
| 17119 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17120 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17121 | } |
| 17122 | } |
| 17123 | |
| 17124 | |
| 17125 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 17126 | { |
| 17127 | struct alc_spec *spec = codec->spec; |
| 17128 | hda_nid_t pin; |
| 17129 | |
| 17130 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17131 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17132 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17133 | pin = spec->autocfg.speaker_pins[0]; |
| 17134 | if (pin) |
| 17135 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17136 | } |
| 17137 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17138 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 17139 | |
| 17140 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 17141 | { |
| 17142 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17143 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17144 | int i; |
| 17145 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 17146 | for (i = 0; i < cfg->num_inputs; i++) { |
| 17147 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17148 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 17149 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17150 | if (nid != ALC861VD_PIN_CD_NID && |
| 17151 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17152 | snd_hda_codec_write(codec, nid, 0, |
| 17153 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17154 | AMP_OUT_MUTE); |
| 17155 | } |
| 17156 | } |
| 17157 | } |
| 17158 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17159 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 17160 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17161 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 17162 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 17163 | |
| 17164 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 17165 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17166 | * different NIDs for mute/unmute switch and volume control */ |
| 17167 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17168 | const struct auto_pin_cfg *cfg) |
| 17169 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 17170 | static const char * const chname[4] = { |
| 17171 | "Front", "Surround", "CLFE", "Side" |
| 17172 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17173 | const char *pfx = alc_get_line_out_pfx(spec, true); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17174 | hda_nid_t nid_v, nid_s; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17175 | int i, err, noutputs; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17176 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17177 | noutputs = cfg->line_outs; |
| 17178 | if (spec->multi_ios > 0) |
| 17179 | noutputs += spec->multi_ios; |
| 17180 | |
| 17181 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17182 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17183 | continue; |
| 17184 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17185 | alc880_dac_to_idx( |
| 17186 | spec->multiout.dac_nids[i])); |
| 17187 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17188 | alc880_dac_to_idx( |
| 17189 | spec->multiout.dac_nids[i])); |
| 17190 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17191 | if (!pfx && i == 2) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17192 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17193 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17194 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17195 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 17196 | HDA_OUTPUT)); |
| 17197 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17198 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17199 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 17200 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17201 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 17202 | HDA_OUTPUT)); |
| 17203 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17204 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17205 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17206 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17207 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17208 | HDA_INPUT)); |
| 17209 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17210 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17211 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17212 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17213 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17214 | HDA_INPUT)); |
| 17215 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17216 | return err; |
| 17217 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17218 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17219 | int index = i; |
| 17220 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17221 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17222 | index = 0; |
| 17223 | } |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17224 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17225 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17226 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17227 | HDA_OUTPUT)); |
| 17228 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17229 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17230 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17231 | name, index, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17232 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17233 | HDA_INPUT)); |
| 17234 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17235 | return err; |
| 17236 | } |
| 17237 | } |
| 17238 | return 0; |
| 17239 | } |
| 17240 | |
| 17241 | /* add playback controls for speaker and HP outputs */ |
| 17242 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17243 | * different NIDs for mute/unmute switch and volume control */ |
| 17244 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17245 | hda_nid_t pin, const char *pfx) |
| 17246 | { |
| 17247 | hda_nid_t nid_v, nid_s; |
| 17248 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17249 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17250 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17251 | return 0; |
| 17252 | |
| 17253 | if (alc880_is_fixed_pin(pin)) { |
| 17254 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17255 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17256 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17257 | spec->multiout.hp_nid = nid_v; |
| 17258 | else |
| 17259 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17260 | /* control HP volume/switch on the output mixer amp */ |
| 17261 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17262 | alc880_fixed_pin_idx(pin)); |
| 17263 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17264 | alc880_fixed_pin_idx(pin)); |
| 17265 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17266 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17267 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17268 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17269 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17270 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17271 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17272 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17273 | return err; |
| 17274 | } else if (alc880_is_multi_pin(pin)) { |
| 17275 | /* set manual connection */ |
| 17276 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17277 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17278 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17279 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17280 | return err; |
| 17281 | } |
| 17282 | return 0; |
| 17283 | } |
| 17284 | |
| 17285 | /* parse the BIOS configuration and set up the alc_spec |
| 17286 | * return 1 if successful, 0 if the proper config is not found, |
| 17287 | * or a negative error code |
| 17288 | * Based on ALC880 version - had to change it to override |
| 17289 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17290 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17291 | { |
| 17292 | struct alc_spec *spec = codec->spec; |
| 17293 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17294 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17295 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17296 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17297 | alc861vd_ignore); |
| 17298 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17299 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17300 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17301 | return 0; /* can't find valid BIOS pin config */ |
| 17302 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17303 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17304 | if (err < 0) |
| 17305 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17306 | err = alc_auto_add_multi_channel_mode(codec); |
| 17307 | if (err < 0) |
| 17308 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17309 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17310 | if (err < 0) |
| 17311 | return err; |
| 17312 | err = alc861vd_auto_create_extra_out(spec, |
| 17313 | spec->autocfg.speaker_pins[0], |
| 17314 | "Speaker"); |
| 17315 | if (err < 0) |
| 17316 | return err; |
| 17317 | err = alc861vd_auto_create_extra_out(spec, |
| 17318 | spec->autocfg.hp_pins[0], |
| 17319 | "Headphone"); |
| 17320 | if (err < 0) |
| 17321 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17322 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17323 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17324 | return err; |
| 17325 | |
| 17326 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17327 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17328 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17329 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17330 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17331 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17332 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17333 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17334 | |
| 17335 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17336 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17337 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17338 | err = alc_auto_add_mic_boost(codec); |
| 17339 | if (err < 0) |
| 17340 | return err; |
| 17341 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17342 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17343 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17344 | return 1; |
| 17345 | } |
| 17346 | |
| 17347 | /* additional initialization for auto-configuration model */ |
| 17348 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17349 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17350 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17351 | alc861vd_auto_init_multi_out(codec); |
| 17352 | alc861vd_auto_init_hp_out(codec); |
| 17353 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17354 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17355 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17356 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17357 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17358 | } |
| 17359 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17360 | enum { |
| 17361 | ALC660VD_FIX_ASUS_GPIO1 |
| 17362 | }; |
| 17363 | |
| 17364 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17365 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17366 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17367 | .type = ALC_FIXUP_VERBS, |
| 17368 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17369 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17370 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17371 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17372 | { } |
| 17373 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17374 | }, |
| 17375 | }; |
| 17376 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17377 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17378 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17379 | {} |
| 17380 | }; |
| 17381 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17382 | static int patch_alc861vd(struct hda_codec *codec) |
| 17383 | { |
| 17384 | struct alc_spec *spec; |
| 17385 | int err, board_config; |
| 17386 | |
| 17387 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17388 | if (spec == NULL) |
| 17389 | return -ENOMEM; |
| 17390 | |
| 17391 | codec->spec = spec; |
| 17392 | |
| 17393 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17394 | alc861vd_models, |
| 17395 | alc861vd_cfg_tbl); |
| 17396 | |
| 17397 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17398 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17399 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17400 | board_config = ALC861VD_AUTO; |
| 17401 | } |
| 17402 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17403 | if (board_config == ALC861VD_AUTO) { |
| 17404 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17405 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17406 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17407 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17408 | if (board_config == ALC861VD_AUTO) { |
| 17409 | /* automatic parse from the BIOS config */ |
| 17410 | err = alc861vd_parse_auto_config(codec); |
| 17411 | if (err < 0) { |
| 17412 | alc_free(codec); |
| 17413 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17414 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17415 | printk(KERN_INFO |
| 17416 | "hda_codec: Cannot set up configuration " |
| 17417 | "from BIOS. Using base mode...\n"); |
| 17418 | board_config = ALC861VD_3ST; |
| 17419 | } |
| 17420 | } |
| 17421 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17422 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17423 | if (err < 0) { |
| 17424 | alc_free(codec); |
| 17425 | return err; |
| 17426 | } |
| 17427 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17428 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17429 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17430 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17431 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17432 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17433 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17434 | } |
| 17435 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17436 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17437 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17438 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17439 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17440 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17441 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17442 | if (!spec->adc_nids) { |
| 17443 | spec->adc_nids = alc861vd_adc_nids; |
| 17444 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17445 | } |
| 17446 | if (!spec->capsrc_nids) |
| 17447 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17448 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17449 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17450 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17451 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17452 | spec->vmaster_nid = 0x02; |
| 17453 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17454 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17455 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17456 | codec->patch_ops = alc_patch_ops; |
| 17457 | |
| 17458 | if (board_config == ALC861VD_AUTO) |
| 17459 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 17460 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17461 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17462 | if (!spec->loopback.amplist) |
| 17463 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17464 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17465 | |
| 17466 | return 0; |
| 17467 | } |
| 17468 | |
| 17469 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17470 | * ALC662 support |
| 17471 | * |
| 17472 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17473 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17474 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17475 | * 6-channel independent captures. |
| 17476 | * |
| 17477 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17478 | * driver yet). |
| 17479 | */ |
| 17480 | #define ALC662_DIGOUT_NID 0x06 |
| 17481 | #define ALC662_DIGIN_NID 0x0a |
| 17482 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17483 | static const hda_nid_t alc662_dac_nids[3] = { |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 17484 | /* front, rear, clfe */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17485 | 0x02, 0x03, 0x04 |
| 17486 | }; |
| 17487 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17488 | static const hda_nid_t alc272_dac_nids[2] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17489 | 0x02, 0x03 |
| 17490 | }; |
| 17491 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17492 | static const hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17493 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17494 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17495 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17496 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17497 | static const hda_nid_t alc272_adc_nids[1] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17498 | /* ADC1-2 */ |
| 17499 | 0x08, |
| 17500 | }; |
| 17501 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17502 | static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
| 17503 | static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17504 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17505 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17506 | /* input MUX */ |
| 17507 | /* FIXME: should be a matrix-type input source selection */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17508 | static const struct hda_input_mux alc662_capture_source = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17509 | .num_items = 4, |
| 17510 | .items = { |
| 17511 | { "Mic", 0x0 }, |
| 17512 | { "Front Mic", 0x1 }, |
| 17513 | { "Line", 0x2 }, |
| 17514 | { "CD", 0x4 }, |
| 17515 | }, |
| 17516 | }; |
| 17517 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17518 | static const struct hda_input_mux alc662_lenovo_101e_capture_source = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17519 | .num_items = 2, |
| 17520 | .items = { |
| 17521 | { "Mic", 0x1 }, |
| 17522 | { "Line", 0x2 }, |
| 17523 | }, |
| 17524 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17525 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17526 | static const struct hda_input_mux alc663_capture_source = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17527 | .num_items = 3, |
| 17528 | .items = { |
| 17529 | { "Mic", 0x0 }, |
| 17530 | { "Front Mic", 0x1 }, |
| 17531 | { "Line", 0x2 }, |
| 17532 | }, |
| 17533 | }; |
| 17534 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17535 | #if 0 /* set to 1 for testing other input sources below */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17536 | static const struct hda_input_mux alc272_nc10_capture_source = { |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17537 | .num_items = 16, |
| 17538 | .items = { |
| 17539 | { "Autoselect Mic", 0x0 }, |
| 17540 | { "Internal Mic", 0x1 }, |
| 17541 | { "In-0x02", 0x2 }, |
| 17542 | { "In-0x03", 0x3 }, |
| 17543 | { "In-0x04", 0x4 }, |
| 17544 | { "In-0x05", 0x5 }, |
| 17545 | { "In-0x06", 0x6 }, |
| 17546 | { "In-0x07", 0x7 }, |
| 17547 | { "In-0x08", 0x8 }, |
| 17548 | { "In-0x09", 0x9 }, |
| 17549 | { "In-0x0a", 0x0a }, |
| 17550 | { "In-0x0b", 0x0b }, |
| 17551 | { "In-0x0c", 0x0c }, |
| 17552 | { "In-0x0d", 0x0d }, |
| 17553 | { "In-0x0e", 0x0e }, |
| 17554 | { "In-0x0f", 0x0f }, |
| 17555 | }, |
| 17556 | }; |
| 17557 | #endif |
| 17558 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17559 | /* |
| 17560 | * 2ch mode |
| 17561 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17562 | static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17563 | { 2, NULL } |
| 17564 | }; |
| 17565 | |
| 17566 | /* |
| 17567 | * 2ch mode |
| 17568 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17569 | static const struct hda_verb alc662_3ST_ch2_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17570 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17571 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17572 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17573 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17574 | { } /* end */ |
| 17575 | }; |
| 17576 | |
| 17577 | /* |
| 17578 | * 6ch mode |
| 17579 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17580 | static const struct hda_verb alc662_3ST_ch6_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17581 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17582 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17583 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17584 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17585 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17586 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17587 | { } /* end */ |
| 17588 | }; |
| 17589 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17590 | static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17591 | { 2, alc662_3ST_ch2_init }, |
| 17592 | { 6, alc662_3ST_ch6_init }, |
| 17593 | }; |
| 17594 | |
| 17595 | /* |
| 17596 | * 2ch mode |
| 17597 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17598 | static const struct hda_verb alc662_sixstack_ch6_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17599 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17600 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17601 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17602 | { } /* end */ |
| 17603 | }; |
| 17604 | |
| 17605 | /* |
| 17606 | * 6ch mode |
| 17607 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17608 | static const struct hda_verb alc662_sixstack_ch8_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17609 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17610 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17611 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17612 | { } /* end */ |
| 17613 | }; |
| 17614 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17615 | static const struct hda_channel_mode alc662_5stack_modes[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17616 | { 2, alc662_sixstack_ch6_init }, |
| 17617 | { 6, alc662_sixstack_ch8_init }, |
| 17618 | }; |
| 17619 | |
| 17620 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17621 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17622 | */ |
| 17623 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17624 | static const struct snd_kcontrol_new alc662_base_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17625 | /* output mixer control */ |
| 17626 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17627 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17628 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17629 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17630 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17631 | 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] | 17632 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17633 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17634 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17635 | |
| 17636 | /*Input mixer control */ |
| 17637 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17638 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17639 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17640 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17642 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17643 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17644 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17645 | { } /* end */ |
| 17646 | }; |
| 17647 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17648 | static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17649 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17650 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17651 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17652 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17653 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17654 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17655 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17656 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17657 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17658 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17659 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17660 | { } /* end */ |
| 17661 | }; |
| 17662 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17663 | static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17664 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17665 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17666 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17667 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17668 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17669 | 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] | 17670 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17671 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17672 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17673 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17674 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17675 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17676 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17678 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17679 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17680 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17681 | { } /* end */ |
| 17682 | }; |
| 17683 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17684 | static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17685 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17686 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17687 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17688 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17689 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17690 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17691 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17692 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17694 | { } /* end */ |
| 17695 | }; |
| 17696 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17697 | static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17698 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17699 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17700 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17701 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17702 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17703 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17704 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17705 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17706 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17707 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17708 | { } /* end */ |
| 17709 | }; |
| 17710 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17711 | static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17712 | ALC262_HIPPO_MASTER_SWITCH, |
| 17713 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17714 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17715 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17716 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17717 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17718 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17719 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17720 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17721 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17722 | { } /* end */ |
| 17723 | }; |
| 17724 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17725 | static const struct hda_bind_ctls alc663_asus_bind_master_vol = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17726 | .ops = &snd_hda_bind_vol, |
| 17727 | .values = { |
| 17728 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17729 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17730 | 0 |
| 17731 | }, |
| 17732 | }; |
| 17733 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17734 | static const struct hda_bind_ctls alc663_asus_one_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17735 | .ops = &snd_hda_bind_sw, |
| 17736 | .values = { |
| 17737 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17738 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17739 | 0 |
| 17740 | }, |
| 17741 | }; |
| 17742 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17743 | static const struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17744 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17745 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17746 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17748 | { } /* end */ |
| 17749 | }; |
| 17750 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17751 | static const struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17752 | .ops = &snd_hda_bind_sw, |
| 17753 | .values = { |
| 17754 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17755 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17756 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17757 | 0 |
| 17758 | }, |
| 17759 | }; |
| 17760 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17761 | static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17762 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17763 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17766 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17767 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17768 | |
| 17769 | { } /* end */ |
| 17770 | }; |
| 17771 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17772 | static const struct hda_bind_ctls alc663_asus_four_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17773 | .ops = &snd_hda_bind_sw, |
| 17774 | .values = { |
| 17775 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17776 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17777 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17778 | 0 |
| 17779 | }, |
| 17780 | }; |
| 17781 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17782 | static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17783 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17784 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17785 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17786 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17787 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17788 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17789 | { } /* end */ |
| 17790 | }; |
| 17791 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17792 | static const struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17793 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17794 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17798 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17799 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17800 | { } /* end */ |
| 17801 | }; |
| 17802 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17803 | static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17804 | .ops = &snd_hda_bind_vol, |
| 17805 | .values = { |
| 17806 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17807 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17808 | 0 |
| 17809 | }, |
| 17810 | }; |
| 17811 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17812 | static const struct hda_bind_ctls alc663_asus_two_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17813 | .ops = &snd_hda_bind_sw, |
| 17814 | .values = { |
| 17815 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17816 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17817 | 0 |
| 17818 | }, |
| 17819 | }; |
| 17820 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17821 | static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17822 | HDA_BIND_VOL("Master Playback Volume", |
| 17823 | &alc663_asus_two_bind_master_vol), |
| 17824 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17825 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17829 | { } /* end */ |
| 17830 | }; |
| 17831 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17832 | static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17833 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17834 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17835 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17839 | { } /* end */ |
| 17840 | }; |
| 17841 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17842 | static const struct snd_kcontrol_new alc663_g71v_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17843 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17844 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17845 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17846 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17847 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17848 | |
| 17849 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17850 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17851 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17852 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17853 | { } /* end */ |
| 17854 | }; |
| 17855 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17856 | static const struct snd_kcontrol_new alc663_g50v_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17857 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17858 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17860 | |
| 17861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17862 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17863 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17864 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17865 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17866 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17867 | { } /* end */ |
| 17868 | }; |
| 17869 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17870 | static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17871 | .ops = &snd_hda_bind_sw, |
| 17872 | .values = { |
| 17873 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17874 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17875 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17876 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17877 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17878 | 0 |
| 17879 | }, |
| 17880 | }; |
| 17881 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17882 | static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17883 | .ops = &snd_hda_bind_sw, |
| 17884 | .values = { |
| 17885 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17886 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17887 | 0 |
| 17888 | }, |
| 17889 | }; |
| 17890 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17891 | static const struct snd_kcontrol_new alc663_mode7_mixer[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17892 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17893 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17894 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17895 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17896 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17897 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17898 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17899 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17900 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17901 | { } /* end */ |
| 17902 | }; |
| 17903 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17904 | static const struct snd_kcontrol_new alc663_mode8_mixer[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17905 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17906 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17907 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17908 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17909 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17910 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17911 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17912 | { } /* end */ |
| 17913 | }; |
| 17914 | |
| 17915 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17916 | static const struct snd_kcontrol_new alc662_chmode_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17917 | { |
| 17918 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17919 | .name = "Channel Mode", |
| 17920 | .info = alc_ch_mode_info, |
| 17921 | .get = alc_ch_mode_get, |
| 17922 | .put = alc_ch_mode_put, |
| 17923 | }, |
| 17924 | { } /* end */ |
| 17925 | }; |
| 17926 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17927 | static const struct hda_verb alc662_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17928 | /* ADC: mute amp left and right */ |
| 17929 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17930 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17931 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17932 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17933 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17934 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17935 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17936 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17937 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17938 | |
| 17939 | /* Front Pin: output 0 (0x0c) */ |
| 17940 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17941 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17942 | |
| 17943 | /* Rear Pin: output 1 (0x0d) */ |
| 17944 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17945 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17946 | |
| 17947 | /* CLFE Pin: output 2 (0x0e) */ |
| 17948 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17949 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17950 | |
| 17951 | /* Mic (rear) pin: input vref at 80% */ |
| 17952 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17953 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17954 | /* Front Mic pin: input vref at 80% */ |
| 17955 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17956 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17957 | /* Line In pin: input */ |
| 17958 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17959 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17960 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17961 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17962 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17963 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17964 | /* CD pin widget for input */ |
| 17965 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17966 | |
| 17967 | /* FIXME: use matrix-type input source selection */ |
| 17968 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17969 | /* Input mixer */ |
| 17970 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17971 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17972 | |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 17973 | { } |
| 17974 | }; |
| 17975 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17976 | static const struct hda_verb alc662_eapd_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17977 | /* always trun on EAPD */ |
| 17978 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17979 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17980 | { } |
| 17981 | }; |
| 17982 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17983 | static const struct hda_verb alc662_sue_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17984 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17985 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17986 | {} |
| 17987 | }; |
| 17988 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17989 | static const struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17990 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17991 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17992 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17993 | }; |
| 17994 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17995 | /* Set Unsolicited Event*/ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17996 | static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17997 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17998 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17999 | {} |
| 18000 | }; |
| 18001 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18002 | static const struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18003 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18004 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18005 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18006 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18007 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18008 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18009 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18010 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18011 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18012 | {} |
| 18013 | }; |
| 18014 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18015 | static const struct hda_verb alc663_21jd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18016 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18017 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18018 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18019 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18020 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18021 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18022 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18023 | {} |
| 18024 | }; |
| 18025 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18026 | static const struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18027 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18028 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18029 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18030 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18031 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18032 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18033 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18034 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18035 | {} |
| 18036 | }; |
| 18037 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18038 | static const struct hda_verb alc663_15jd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18039 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18040 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18041 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18042 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18044 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18045 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18046 | {} |
| 18047 | }; |
| 18048 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18049 | static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18050 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18051 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18052 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18053 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18054 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18055 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18056 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 18057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18059 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18060 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18061 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18062 | {} |
| 18063 | }; |
| 18064 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18065 | static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18066 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18067 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18068 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18069 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18070 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18072 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18074 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 18075 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18076 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18077 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18078 | {} |
| 18079 | }; |
| 18080 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18081 | static const struct hda_verb alc663_g71v_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18082 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18083 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 18084 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 18085 | |
| 18086 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18087 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18088 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18089 | |
| 18090 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 18091 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 18092 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 18093 | {} |
| 18094 | }; |
| 18095 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18096 | static const struct hda_verb alc663_g50v_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18097 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18098 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18099 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 18100 | |
| 18101 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18102 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18103 | {} |
| 18104 | }; |
| 18105 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18106 | static const struct hda_verb alc662_ecs_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 18108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18109 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18110 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18111 | {} |
| 18112 | }; |
| 18113 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18114 | static const struct hda_verb alc272_dell_zm1_init_verbs[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18115 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18116 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18117 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18118 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18119 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18120 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18121 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18123 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18124 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18125 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18126 | {} |
| 18127 | }; |
| 18128 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18129 | static const struct hda_verb alc272_dell_init_verbs[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18130 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18131 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18132 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18133 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18134 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18135 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18136 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18137 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18138 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18139 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18140 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18141 | {} |
| 18142 | }; |
| 18143 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18144 | static const struct hda_verb alc663_mode7_init_verbs[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18145 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18146 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18147 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18148 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18149 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18150 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18151 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18152 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18153 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18154 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18157 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18158 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18159 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18160 | {} |
| 18161 | }; |
| 18162 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18163 | static const struct hda_verb alc663_mode8_init_verbs[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18164 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18165 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18166 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18167 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 18168 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18169 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 18170 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18171 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 18172 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 18173 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 18174 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 18175 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 18176 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 18177 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18178 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 18179 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 18180 | {} |
| 18181 | }; |
| 18182 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18183 | static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18184 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 18185 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 18186 | { } /* end */ |
| 18187 | }; |
| 18188 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18189 | static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18190 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 18191 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 18192 | { } /* end */ |
| 18193 | }; |
| 18194 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18195 | static void alc662_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18196 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18197 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18198 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18199 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18200 | spec->autocfg.line_out_pins[0] = 0x14; |
| 18201 | spec->autocfg.speaker_pins[0] = 0x15; |
| 18202 | spec->automute = 1; |
| 18203 | spec->detect_line = 1; |
| 18204 | spec->automute_lines = 1; |
| 18205 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18206 | } |
| 18207 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18208 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18209 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18210 | struct alc_spec *spec = codec->spec; |
| 18211 | |
| 18212 | alc262_hippo1_setup(codec); |
| 18213 | spec->ext_mic.pin = 0x18; |
| 18214 | spec->ext_mic.mux_idx = 0; |
| 18215 | spec->int_mic.pin = 0x19; |
| 18216 | spec->int_mic.mux_idx = 1; |
| 18217 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18218 | } |
| 18219 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18220 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18221 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18222 | struct alc_spec *spec = codec->spec; |
| 18223 | |
| 18224 | spec->autocfg.hp_pins[0] = 0x14; |
| 18225 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18226 | spec->automute = 1; |
| 18227 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18228 | } |
| 18229 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18230 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18231 | { |
| 18232 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18233 | spec->autocfg.hp_pins[0] = 0x21; |
| 18234 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18235 | spec->automute_mixer_nid[0] = 0x0c; |
| 18236 | spec->automute = 1; |
| 18237 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18238 | spec->ext_mic.pin = 0x18; |
| 18239 | spec->ext_mic.mux_idx = 0; |
| 18240 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18241 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18242 | spec->auto_mic = 1; |
| 18243 | } |
| 18244 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18245 | /* ***************** Mode1 ******************************/ |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18246 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18247 | { |
| 18248 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18249 | spec->autocfg.hp_pins[0] = 0x21; |
| 18250 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18251 | spec->automute_mixer_nid[0] = 0x0c; |
| 18252 | spec->automute = 1; |
| 18253 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18254 | spec->ext_mic.pin = 0x18; |
| 18255 | spec->ext_mic.mux_idx = 0; |
| 18256 | spec->int_mic.pin = 0x19; |
| 18257 | spec->int_mic.mux_idx = 1; |
| 18258 | spec->auto_mic = 1; |
| 18259 | } |
| 18260 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18261 | /* ***************** Mode2 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18262 | static void alc662_mode2_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18263 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18264 | struct alc_spec *spec = codec->spec; |
| 18265 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18266 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18267 | spec->automute = 1; |
| 18268 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18269 | spec->ext_mic.pin = 0x18; |
| 18270 | spec->ext_mic.mux_idx = 0; |
| 18271 | spec->int_mic.pin = 0x19; |
| 18272 | spec->int_mic.mux_idx = 1; |
| 18273 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18274 | } |
| 18275 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18276 | /* ***************** Mode3 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18277 | static void alc663_mode3_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18278 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18279 | struct alc_spec *spec = codec->spec; |
| 18280 | spec->autocfg.hp_pins[0] = 0x21; |
| 18281 | spec->autocfg.hp_pins[0] = 0x15; |
| 18282 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18283 | spec->automute = 1; |
| 18284 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18285 | spec->ext_mic.pin = 0x18; |
| 18286 | spec->ext_mic.mux_idx = 0; |
| 18287 | spec->int_mic.pin = 0x19; |
| 18288 | spec->int_mic.mux_idx = 1; |
| 18289 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18290 | } |
| 18291 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18292 | /* ***************** Mode4 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18293 | static void alc663_mode4_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18294 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18295 | struct alc_spec *spec = codec->spec; |
| 18296 | spec->autocfg.hp_pins[0] = 0x21; |
| 18297 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18298 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18299 | spec->automute_mixer_nid[0] = 0x0c; |
| 18300 | spec->automute_mixer_nid[1] = 0x0e; |
| 18301 | spec->automute = 1; |
| 18302 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18303 | spec->ext_mic.pin = 0x18; |
| 18304 | spec->ext_mic.mux_idx = 0; |
| 18305 | spec->int_mic.pin = 0x19; |
| 18306 | spec->int_mic.mux_idx = 1; |
| 18307 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18308 | } |
| 18309 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18310 | /* ***************** Mode5 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18311 | static void alc663_mode5_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18312 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18313 | struct alc_spec *spec = codec->spec; |
| 18314 | spec->autocfg.hp_pins[0] = 0x15; |
| 18315 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18316 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18317 | spec->automute_mixer_nid[0] = 0x0c; |
| 18318 | spec->automute_mixer_nid[1] = 0x0e; |
| 18319 | spec->automute = 1; |
| 18320 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18321 | spec->ext_mic.pin = 0x18; |
| 18322 | spec->ext_mic.mux_idx = 0; |
| 18323 | spec->int_mic.pin = 0x19; |
| 18324 | spec->int_mic.mux_idx = 1; |
| 18325 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18326 | } |
| 18327 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18328 | /* ***************** Mode6 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18329 | static void alc663_mode6_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18330 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18331 | struct alc_spec *spec = codec->spec; |
| 18332 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18333 | spec->autocfg.hp_pins[0] = 0x15; |
| 18334 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18335 | spec->automute_mixer_nid[0] = 0x0c; |
| 18336 | spec->automute = 1; |
| 18337 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18338 | spec->ext_mic.pin = 0x18; |
| 18339 | spec->ext_mic.mux_idx = 0; |
| 18340 | spec->int_mic.pin = 0x19; |
| 18341 | spec->int_mic.mux_idx = 1; |
| 18342 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18343 | } |
| 18344 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18345 | /* ***************** Mode7 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18346 | static void alc663_mode7_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18347 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18348 | struct alc_spec *spec = codec->spec; |
| 18349 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18350 | spec->autocfg.hp_pins[0] = 0x21; |
| 18351 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18352 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18353 | spec->automute = 1; |
| 18354 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18355 | spec->ext_mic.pin = 0x18; |
| 18356 | spec->ext_mic.mux_idx = 0; |
| 18357 | spec->int_mic.pin = 0x19; |
| 18358 | spec->int_mic.mux_idx = 1; |
| 18359 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18360 | } |
| 18361 | |
| 18362 | /* ***************** Mode8 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18363 | static void alc663_mode8_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18364 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18365 | struct alc_spec *spec = codec->spec; |
| 18366 | spec->autocfg.hp_pins[0] = 0x21; |
| 18367 | spec->autocfg.hp_pins[1] = 0x15; |
| 18368 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18369 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18370 | spec->automute = 1; |
| 18371 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18372 | spec->ext_mic.pin = 0x18; |
| 18373 | spec->ext_mic.mux_idx = 0; |
| 18374 | spec->int_mic.pin = 0x12; |
| 18375 | spec->int_mic.mux_idx = 9; |
| 18376 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18377 | } |
| 18378 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18379 | static void alc663_g71v_setup(struct hda_codec *codec) |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18380 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18381 | struct alc_spec *spec = codec->spec; |
| 18382 | spec->autocfg.hp_pins[0] = 0x21; |
| 18383 | spec->autocfg.line_out_pins[0] = 0x15; |
| 18384 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18385 | spec->automute = 1; |
| 18386 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
| 18387 | spec->detect_line = 1; |
| 18388 | spec->automute_lines = 1; |
| 18389 | spec->ext_mic.pin = 0x18; |
| 18390 | spec->ext_mic.mux_idx = 0; |
| 18391 | spec->int_mic.pin = 0x12; |
| 18392 | spec->int_mic.mux_idx = 9; |
| 18393 | spec->auto_mic = 1; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18394 | } |
| 18395 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18396 | #define alc663_g50v_setup alc663_m51va_setup |
| 18397 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18398 | static const struct snd_kcontrol_new alc662_ecs_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18399 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18400 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18401 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18402 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18403 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18404 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18405 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18406 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18407 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18408 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18409 | { } /* end */ |
| 18410 | }; |
| 18411 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18412 | static const struct snd_kcontrol_new alc272_nc10_mixer[] = { |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18413 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18414 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18415 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18416 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18417 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18418 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18419 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18420 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18421 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18422 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18423 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18424 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18425 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18426 | { } /* end */ |
| 18427 | }; |
| 18428 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18429 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18430 | #define alc662_loopbacks alc880_loopbacks |
| 18431 | #endif |
| 18432 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18433 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18434 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18435 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18436 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18437 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18438 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18439 | |
| 18440 | /* |
| 18441 | * configuration and preset |
| 18442 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18443 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18444 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18445 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18446 | [ALC662_3ST_6ch] = "3stack-6ch", |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 18447 | [ALC662_5ST_DIG] = "5stack-dig", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18448 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18449 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18450 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18451 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18452 | [ALC663_ASUS_M51VA] = "m51va", |
| 18453 | [ALC663_ASUS_G71V] = "g71v", |
| 18454 | [ALC663_ASUS_H13] = "h13", |
| 18455 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18456 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18457 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18458 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18459 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18460 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18461 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18462 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18463 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18464 | [ALC272_DELL] = "dell", |
| 18465 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18466 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18467 | [ALC662_AUTO] = "auto", |
| 18468 | }; |
| 18469 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18470 | static const struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18471 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18472 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18473 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18474 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18475 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18476 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18477 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18478 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18479 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18480 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18481 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18482 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18483 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18484 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18485 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18486 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18487 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18488 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18489 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18490 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18491 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18492 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18493 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18494 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18495 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18496 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18497 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18498 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18499 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18500 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18501 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18502 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18503 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18504 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18505 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18506 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18507 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18508 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18509 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18510 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18511 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18512 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18513 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18514 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18515 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18516 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18517 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18518 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18519 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18520 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18521 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18522 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18523 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18524 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18525 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18526 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18527 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18528 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18529 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18530 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18531 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18532 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18533 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18534 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18535 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18536 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18537 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Takashi Iwai | ebb4724 | 2011-05-02 10:37:29 +0200 | [diff] [blame] | 18538 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18539 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18540 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18541 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18542 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18543 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18544 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18545 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18546 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18547 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18548 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18549 | {} |
| 18550 | }; |
| 18551 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18552 | static const struct alc_config_preset alc662_presets[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18553 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18554 | .mixers = { alc662_3ST_2ch_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18555 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18556 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18557 | .dac_nids = alc662_dac_nids, |
| 18558 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18559 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18560 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18561 | .channel_mode = alc662_3ST_2ch_modes, |
| 18562 | .input_mux = &alc662_capture_source, |
| 18563 | }, |
| 18564 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18565 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18566 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18567 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18568 | .dac_nids = alc662_dac_nids, |
| 18569 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18570 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18571 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18572 | .channel_mode = alc662_3ST_6ch_modes, |
| 18573 | .need_dac_fix = 1, |
| 18574 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18575 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18576 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18577 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18578 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18579 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18580 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18581 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18582 | .channel_mode = alc662_3ST_6ch_modes, |
| 18583 | .need_dac_fix = 1, |
| 18584 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18585 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18586 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18587 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18588 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18589 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18590 | .dac_nids = alc662_dac_nids, |
| 18591 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18592 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18593 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18594 | .channel_mode = alc662_5stack_modes, |
| 18595 | .input_mux = &alc662_capture_source, |
| 18596 | }, |
| 18597 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18598 | .mixers = { alc662_lenovo_101e_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18599 | .init_verbs = { alc662_init_verbs, |
| 18600 | alc662_eapd_init_verbs, |
| 18601 | alc662_sue_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18602 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18603 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18604 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18605 | .channel_mode = alc662_3ST_2ch_modes, |
| 18606 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18607 | .unsol_event = alc_sku_unsol_event, |
| 18608 | .setup = alc662_lenovo_101e_setup, |
| 18609 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18610 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18611 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18612 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18613 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18614 | alc662_eapd_init_verbs, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18615 | alc662_eeepc_sue_init_verbs }, |
| 18616 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18617 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18618 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18619 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18620 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18621 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18622 | .init_hook = alc_inithook, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18623 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18624 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18625 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18626 | alc662_chmode_mixer }, |
| 18627 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18628 | alc662_eapd_init_verbs, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18629 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18630 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18631 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18632 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18633 | .channel_mode = alc662_3ST_6ch_modes, |
| 18634 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18635 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18636 | .setup = alc662_eeepc_ep20_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18637 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18638 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18639 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18640 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18641 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18642 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18643 | alc662_ecs_init_verbs }, |
| 18644 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18645 | .dac_nids = alc662_dac_nids, |
| 18646 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18647 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18648 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18649 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18650 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18651 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18652 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18653 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18654 | .init_verbs = { alc662_init_verbs, |
| 18655 | alc662_eapd_init_verbs, |
| 18656 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18657 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18658 | .dac_nids = alc662_dac_nids, |
| 18659 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18660 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18661 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18662 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18663 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18664 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18665 | }, |
| 18666 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18667 | .mixers = { alc663_g71v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18668 | .init_verbs = { alc662_init_verbs, |
| 18669 | alc662_eapd_init_verbs, |
| 18670 | alc663_g71v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18671 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18672 | .dac_nids = alc662_dac_nids, |
| 18673 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18674 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18675 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18676 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18677 | .setup = alc663_g71v_setup, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18678 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18679 | }, |
| 18680 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18681 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18682 | .init_verbs = { alc662_init_verbs, |
| 18683 | alc662_eapd_init_verbs, |
| 18684 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18685 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18686 | .dac_nids = alc662_dac_nids, |
| 18687 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18688 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18689 | .setup = alc663_m51va_setup, |
| 18690 | .unsol_event = alc_sku_unsol_event, |
| 18691 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18692 | }, |
| 18693 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18694 | .mixers = { alc663_g50v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18695 | .init_verbs = { alc662_init_verbs, |
| 18696 | alc662_eapd_init_verbs, |
| 18697 | alc663_g50v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18698 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18699 | .dac_nids = alc662_dac_nids, |
| 18700 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18701 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18702 | .channel_mode = alc662_3ST_6ch_modes, |
| 18703 | .input_mux = &alc663_capture_source, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18704 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18705 | .setup = alc663_g50v_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18706 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18707 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18708 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18709 | .mixers = { alc663_m51va_mixer }, |
| 18710 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18711 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18712 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18713 | alc663_21jd_amic_init_verbs }, |
| 18714 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18715 | .hp_nid = 0x03, |
| 18716 | .dac_nids = alc662_dac_nids, |
| 18717 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18718 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18719 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18720 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18721 | .setup = alc663_mode1_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18722 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18723 | }, |
| 18724 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18725 | .mixers = { alc662_1bjd_mixer }, |
| 18726 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18727 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18728 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18729 | alc662_1bjd_amic_init_verbs }, |
| 18730 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18731 | .dac_nids = alc662_dac_nids, |
| 18732 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18733 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18734 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18735 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18736 | .setup = alc662_mode2_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18737 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18738 | }, |
| 18739 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18740 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18741 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18742 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18743 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18744 | alc663_two_hp_amic_m1_init_verbs }, |
| 18745 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18746 | .hp_nid = 0x03, |
| 18747 | .dac_nids = alc662_dac_nids, |
| 18748 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18749 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18750 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18751 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18752 | .setup = alc663_mode3_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18753 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18754 | }, |
| 18755 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18756 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18757 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18758 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18759 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18760 | alc663_21jd_amic_init_verbs}, |
| 18761 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18762 | .hp_nid = 0x03, |
| 18763 | .dac_nids = alc662_dac_nids, |
| 18764 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18765 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18766 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18767 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18768 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18769 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18770 | }, |
| 18771 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18772 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18773 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18774 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18775 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18776 | alc663_15jd_amic_init_verbs }, |
| 18777 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18778 | .hp_nid = 0x03, |
| 18779 | .dac_nids = alc662_dac_nids, |
| 18780 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18781 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18782 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18783 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18784 | .setup = alc663_mode5_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18785 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18786 | }, |
| 18787 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18788 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18789 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18790 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18791 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18792 | alc663_two_hp_amic_m2_init_verbs }, |
| 18793 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18794 | .hp_nid = 0x03, |
| 18795 | .dac_nids = alc662_dac_nids, |
| 18796 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18797 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18798 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18799 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18800 | .setup = alc663_mode6_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18801 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18802 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18803 | [ALC663_ASUS_MODE7] = { |
| 18804 | .mixers = { alc663_mode7_mixer }, |
| 18805 | .cap_mixer = alc662_auto_capture_mixer, |
| 18806 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18807 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18808 | alc663_mode7_init_verbs }, |
| 18809 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18810 | .hp_nid = 0x03, |
| 18811 | .dac_nids = alc662_dac_nids, |
| 18812 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18813 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18814 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18815 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18816 | .setup = alc663_mode7_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18817 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18818 | }, |
| 18819 | [ALC663_ASUS_MODE8] = { |
| 18820 | .mixers = { alc663_mode8_mixer }, |
| 18821 | .cap_mixer = alc662_auto_capture_mixer, |
| 18822 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18823 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18824 | alc663_mode8_init_verbs }, |
| 18825 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18826 | .hp_nid = 0x03, |
| 18827 | .dac_nids = alc662_dac_nids, |
| 18828 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18829 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18830 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18831 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18832 | .setup = alc663_mode8_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18833 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18834 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18835 | [ALC272_DELL] = { |
| 18836 | .mixers = { alc663_m51va_mixer }, |
| 18837 | .cap_mixer = alc272_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18838 | .init_verbs = { alc662_init_verbs, |
| 18839 | alc662_eapd_init_verbs, |
| 18840 | alc272_dell_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18841 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18842 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18843 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18844 | .adc_nids = alc272_adc_nids, |
| 18845 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18846 | .capsrc_nids = alc272_capsrc_nids, |
| 18847 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18848 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18849 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18850 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18851 | }, |
| 18852 | [ALC272_DELL_ZM1] = { |
| 18853 | .mixers = { alc663_m51va_mixer }, |
| 18854 | .cap_mixer = alc662_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18855 | .init_verbs = { alc662_init_verbs, |
| 18856 | alc662_eapd_init_verbs, |
| 18857 | alc272_dell_zm1_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18858 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18859 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18860 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18861 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18862 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18863 | .capsrc_nids = alc662_capsrc_nids, |
| 18864 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18865 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18866 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18867 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18868 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18869 | [ALC272_SAMSUNG_NC10] = { |
| 18870 | .mixers = { alc272_nc10_mixer }, |
| 18871 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18872 | alc662_eapd_init_verbs, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18873 | alc663_21jd_amic_init_verbs }, |
| 18874 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18875 | .dac_nids = alc272_dac_nids, |
| 18876 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18877 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18878 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18879 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18880 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18881 | .init_hook = alc_inithook, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18882 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18883 | }; |
| 18884 | |
| 18885 | |
| 18886 | /* |
| 18887 | * BIOS auto configuration |
| 18888 | */ |
| 18889 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18890 | /* convert from MIX nid to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18891 | static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18892 | { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18893 | hda_nid_t list[5]; |
Takashi Iwai | 1304ac8 | 2011-04-06 15:16:21 +0200 | [diff] [blame] | 18894 | int i, num; |
| 18895 | |
| 18896 | num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list)); |
| 18897 | for (i = 0; i < num; i++) { |
| 18898 | if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT) |
| 18899 | return list[i]; |
| 18900 | } |
| 18901 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18902 | } |
| 18903 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18904 | /* go down to the selector widget before the mixer */ |
| 18905 | static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin) |
| 18906 | { |
| 18907 | hda_nid_t srcs[5]; |
| 18908 | int num = snd_hda_get_connections(codec, pin, srcs, |
| 18909 | ARRAY_SIZE(srcs)); |
| 18910 | if (num != 1 || |
| 18911 | get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL) |
| 18912 | return pin; |
| 18913 | return srcs[0]; |
| 18914 | } |
| 18915 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18916 | /* get MIX nid connected to the given pin targeted to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18917 | static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18918 | hda_nid_t dac) |
| 18919 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 18920 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18921 | int i, num; |
| 18922 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18923 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18924 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18925 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18926 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18927 | return mix[i]; |
| 18928 | } |
| 18929 | return 0; |
| 18930 | } |
| 18931 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18932 | /* select the connection from pin to DAC if needed */ |
| 18933 | static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin, |
| 18934 | hda_nid_t dac) |
| 18935 | { |
| 18936 | hda_nid_t mix[5]; |
| 18937 | int i, num; |
| 18938 | |
| 18939 | pin = alc_go_down_to_selector(codec, pin); |
| 18940 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18941 | if (num < 2) |
| 18942 | return 0; |
| 18943 | for (i = 0; i < num; i++) { |
| 18944 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) { |
| 18945 | snd_hda_codec_update_cache(codec, pin, 0, |
| 18946 | AC_VERB_SET_CONNECT_SEL, i); |
| 18947 | return 0; |
| 18948 | } |
| 18949 | } |
| 18950 | return 0; |
| 18951 | } |
| 18952 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18953 | /* look for an empty DAC slot */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18954 | static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18955 | { |
| 18956 | struct alc_spec *spec = codec->spec; |
| 18957 | hda_nid_t srcs[5]; |
| 18958 | int i, j, num; |
| 18959 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18960 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18961 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18962 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18963 | hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18964 | if (!nid) |
| 18965 | continue; |
| 18966 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18967 | if (spec->multiout.dac_nids[j] == nid) |
| 18968 | break; |
| 18969 | if (j >= spec->multiout.num_dacs) |
| 18970 | return nid; |
| 18971 | } |
| 18972 | return 0; |
| 18973 | } |
| 18974 | |
| 18975 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18976 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18977 | const struct auto_pin_cfg *cfg) |
| 18978 | { |
| 18979 | struct alc_spec *spec = codec->spec; |
| 18980 | int i; |
| 18981 | hda_nid_t dac; |
| 18982 | |
| 18983 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18984 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18985 | dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18986 | if (!dac) |
| 18987 | continue; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 18988 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18989 | } |
| 18990 | return 0; |
| 18991 | } |
| 18992 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18993 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 18994 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18995 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18996 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18997 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18998 | } |
| 18999 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19000 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 19001 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19002 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19003 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19004 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 19005 | } |
| 19006 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19007 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 19008 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 19009 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 19010 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19011 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 19012 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 19013 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 19014 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 19015 | |
| 19016 | /* add playback controls from the parsed DAC table */ |
| 19017 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 19018 | const struct auto_pin_cfg *cfg) |
| 19019 | { |
| 19020 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19021 | static const char * const chname[4] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19022 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 19023 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19024 | const char *pfx = alc_get_line_out_pfx(spec, true); |
| 19025 | hda_nid_t nid, mix, pin; |
| 19026 | int i, err, noutputs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19027 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19028 | noutputs = cfg->line_outs; |
| 19029 | if (spec->multi_ios > 0) |
| 19030 | noutputs += spec->multi_ios; |
| 19031 | |
| 19032 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19033 | nid = spec->multiout.dac_nids[i]; |
| 19034 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19035 | continue; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19036 | if (i >= cfg->line_outs) |
| 19037 | pin = spec->multi_io[i - 1].pin; |
| 19038 | else |
| 19039 | pin = cfg->line_out_pins[i]; |
| 19040 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19041 | if (!mix) |
| 19042 | continue; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19043 | if (!pfx && i == 2) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19044 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19045 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19046 | if (err < 0) |
| 19047 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19048 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19049 | if (err < 0) |
| 19050 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19051 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19052 | if (err < 0) |
| 19053 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19054 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19055 | if (err < 0) |
| 19056 | return err; |
| 19057 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19058 | const char *name = pfx; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 19059 | int index = i; |
| 19060 | if (!name) { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 19061 | name = chname[i]; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 19062 | index = 0; |
| 19063 | } |
| 19064 | err = __alc662_add_vol_ctl(spec, name, nid, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19065 | if (err < 0) |
| 19066 | return err; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 19067 | err = __alc662_add_sw_ctl(spec, name, mix, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19068 | if (err < 0) |
| 19069 | return err; |
| 19070 | } |
| 19071 | } |
| 19072 | return 0; |
| 19073 | } |
| 19074 | |
| 19075 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19076 | /* return DAC nid if any new DAC is assigned */ |
| 19077 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19078 | const char *pfx) |
| 19079 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19080 | struct alc_spec *spec = codec->spec; |
| 19081 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19082 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19083 | |
| 19084 | if (!pin) |
| 19085 | return 0; |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19086 | nid = alc_auto_look_for_dac(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19087 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19088 | /* the corresponding DAC is already occupied */ |
| 19089 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 19090 | return 0; /* no way */ |
| 19091 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 19092 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19093 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 19094 | } |
| 19095 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19096 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19097 | if (!mix) |
| 19098 | return 0; |
| 19099 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 19100 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 19101 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19102 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 19103 | if (err < 0) |
| 19104 | return err; |
| 19105 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19106 | } |
| 19107 | |
| 19108 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19109 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 19110 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19111 | |
| 19112 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19113 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19114 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19115 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19116 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 19117 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19118 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19119 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19120 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19121 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 19122 | if (alc_auto_mix_to_dac(codec, srcs[i]) != dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19123 | continue; |
Takashi Iwai | 0e53f34 | 2011-04-07 12:27:32 +0200 | [diff] [blame] | 19124 | /* need the manual connection? */ |
| 19125 | if (num > 1) |
| 19126 | snd_hda_codec_write(codec, nid, 0, |
| 19127 | AC_VERB_SET_CONNECT_SEL, i); |
| 19128 | /* unmute mixer widget inputs */ |
| 19129 | snd_hda_codec_write(codec, srcs[i], 0, |
| 19130 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19131 | AMP_IN_UNMUTE(0)); |
| 19132 | snd_hda_codec_write(codec, srcs[i], 0, |
| 19133 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19134 | AMP_IN_UNMUTE(1)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19135 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19136 | } |
| 19137 | } |
| 19138 | |
| 19139 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 19140 | { |
| 19141 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19142 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19143 | int i; |
| 19144 | |
| 19145 | for (i = 0; i <= HDA_SIDE; i++) { |
| 19146 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 19147 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 19148 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19149 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19150 | } |
| 19151 | } |
| 19152 | |
| 19153 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 19154 | { |
| 19155 | struct alc_spec *spec = codec->spec; |
| 19156 | hda_nid_t pin; |
| 19157 | |
| 19158 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19159 | if (pin) |
| 19160 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 19161 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19162 | pin = spec->autocfg.speaker_pins[0]; |
| 19163 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19164 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 19165 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19166 | } |
| 19167 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19168 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 19169 | |
| 19170 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 19171 | { |
| 19172 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19173 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19174 | int i; |
| 19175 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19176 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19177 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19178 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 19179 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 19180 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 19181 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19182 | snd_hda_codec_write(codec, nid, 0, |
| 19183 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 19184 | AMP_OUT_MUTE); |
| 19185 | } |
| 19186 | } |
| 19187 | } |
| 19188 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19189 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19190 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19191 | /* |
| 19192 | * multi-io helper |
| 19193 | */ |
| 19194 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
| 19195 | unsigned int location) |
| 19196 | { |
| 19197 | struct alc_spec *spec = codec->spec; |
| 19198 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19199 | int type, i, num_pins = 0; |
| 19200 | |
| 19201 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
| 19202 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19203 | hda_nid_t nid = cfg->inputs[i].pin; |
| 19204 | hda_nid_t dac; |
| 19205 | unsigned int defcfg, caps; |
| 19206 | if (cfg->inputs[i].type != type) |
| 19207 | continue; |
| 19208 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 19209 | if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX) |
| 19210 | continue; |
| 19211 | if (location && get_defcfg_location(defcfg) != location) |
| 19212 | continue; |
| 19213 | caps = snd_hda_query_pin_caps(codec, nid); |
| 19214 | if (!(caps & AC_PINCAP_OUT)) |
| 19215 | continue; |
| 19216 | dac = alc_auto_look_for_dac(codec, nid); |
| 19217 | if (!dac) |
| 19218 | continue; |
| 19219 | spec->multi_io[num_pins].pin = nid; |
| 19220 | spec->multi_io[num_pins].dac = dac; |
| 19221 | num_pins++; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 19222 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19223 | } |
| 19224 | } |
| 19225 | spec->multiout.num_dacs = 1; |
| 19226 | if (num_pins < 2) |
| 19227 | return 0; |
| 19228 | return num_pins; |
| 19229 | } |
| 19230 | |
| 19231 | static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 19232 | struct snd_ctl_elem_info *uinfo) |
| 19233 | { |
| 19234 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19235 | struct alc_spec *spec = codec->spec; |
| 19236 | |
| 19237 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 19238 | uinfo->count = 1; |
| 19239 | uinfo->value.enumerated.items = spec->multi_ios + 1; |
| 19240 | if (uinfo->value.enumerated.item > spec->multi_ios) |
| 19241 | uinfo->value.enumerated.item = spec->multi_ios; |
| 19242 | sprintf(uinfo->value.enumerated.name, "%dch", |
| 19243 | (uinfo->value.enumerated.item + 1) * 2); |
| 19244 | return 0; |
| 19245 | } |
| 19246 | |
| 19247 | static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 19248 | struct snd_ctl_elem_value *ucontrol) |
| 19249 | { |
| 19250 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19251 | struct alc_spec *spec = codec->spec; |
| 19252 | ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2; |
| 19253 | return 0; |
| 19254 | } |
| 19255 | |
| 19256 | static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output) |
| 19257 | { |
| 19258 | struct alc_spec *spec = codec->spec; |
| 19259 | hda_nid_t nid = spec->multi_io[idx].pin; |
| 19260 | |
| 19261 | if (!spec->multi_io[idx].ctl_in) |
| 19262 | spec->multi_io[idx].ctl_in = |
| 19263 | snd_hda_codec_read(codec, nid, 0, |
| 19264 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 19265 | if (output) { |
| 19266 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19267 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19268 | PIN_OUT); |
| 19269 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19270 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19271 | HDA_AMP_MUTE, 0); |
| 19272 | alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac); |
| 19273 | } else { |
| 19274 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19275 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19276 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 19277 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19278 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19279 | spec->multi_io[idx].ctl_in); |
| 19280 | } |
| 19281 | return 0; |
| 19282 | } |
| 19283 | |
| 19284 | static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 19285 | struct snd_ctl_elem_value *ucontrol) |
| 19286 | { |
| 19287 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19288 | struct alc_spec *spec = codec->spec; |
| 19289 | int i, ch; |
| 19290 | |
| 19291 | ch = ucontrol->value.enumerated.item[0]; |
| 19292 | if (ch < 0 || ch > spec->multi_ios) |
| 19293 | return -EINVAL; |
| 19294 | if (ch == (spec->ext_channel_count - 1) / 2) |
| 19295 | return 0; |
| 19296 | spec->ext_channel_count = (ch + 1) * 2; |
| 19297 | for (i = 0; i < spec->multi_ios; i++) |
| 19298 | alc_set_multi_io(codec, i, i < ch); |
| 19299 | spec->multiout.max_channels = spec->ext_channel_count; |
| 19300 | return 1; |
| 19301 | } |
| 19302 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19303 | static const struct snd_kcontrol_new alc_auto_channel_mode_enum = { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19304 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 19305 | .name = "Channel Mode", |
| 19306 | .info = alc_auto_ch_mode_info, |
| 19307 | .get = alc_auto_ch_mode_get, |
| 19308 | .put = alc_auto_ch_mode_put, |
| 19309 | }; |
| 19310 | |
| 19311 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec) |
| 19312 | { |
| 19313 | struct alc_spec *spec = codec->spec; |
| 19314 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19315 | unsigned int location, defcfg; |
| 19316 | int num_pins; |
| 19317 | |
| 19318 | if (cfg->line_outs != 1 || |
| 19319 | cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 19320 | return 0; |
| 19321 | |
| 19322 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
| 19323 | location = get_defcfg_location(defcfg); |
| 19324 | |
| 19325 | num_pins = alc_auto_fill_multi_ios(codec, location); |
| 19326 | if (num_pins > 0) { |
| 19327 | struct snd_kcontrol_new *knew; |
| 19328 | |
| 19329 | knew = alc_kcontrol_new(spec); |
| 19330 | if (!knew) |
| 19331 | return -ENOMEM; |
| 19332 | *knew = alc_auto_channel_mode_enum; |
| 19333 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); |
| 19334 | if (!knew->name) |
| 19335 | return -ENOMEM; |
| 19336 | |
| 19337 | spec->multi_ios = num_pins; |
| 19338 | spec->ext_channel_count = 2; |
| 19339 | spec->multiout.num_dacs = num_pins + 1; |
| 19340 | } |
| 19341 | return 0; |
| 19342 | } |
| 19343 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19344 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19345 | { |
| 19346 | struct alc_spec *spec = codec->spec; |
| 19347 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19348 | static const hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19349 | |
| 19350 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19351 | alc662_ignore); |
| 19352 | if (err < 0) |
| 19353 | return err; |
| 19354 | if (!spec->autocfg.line_outs) |
| 19355 | return 0; /* can't find valid BIOS pin config */ |
| 19356 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19357 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19358 | if (err < 0) |
| 19359 | return err; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19360 | err = alc_auto_add_multi_channel_mode(codec); |
| 19361 | if (err < 0) |
| 19362 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19363 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19364 | if (err < 0) |
| 19365 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19366 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19367 | spec->autocfg.speaker_pins[0], |
| 19368 | "Speaker"); |
| 19369 | if (err < 0) |
| 19370 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19371 | if (err) |
| 19372 | spec->multiout.extra_out_nid[0] = err; |
| 19373 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19374 | "Headphone"); |
| 19375 | if (err < 0) |
| 19376 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19377 | if (err) |
| 19378 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19379 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19380 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19381 | return err; |
| 19382 | |
| 19383 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19384 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19385 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19386 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19387 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19388 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19389 | |
| 19390 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19391 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19392 | |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19393 | err = alc_auto_add_mic_boost(codec); |
| 19394 | if (err < 0) |
| 19395 | return err; |
| 19396 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19397 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19398 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19399 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19400 | else |
| 19401 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19402 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19403 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19404 | } |
| 19405 | |
| 19406 | /* additional initialization for auto-configuration model */ |
| 19407 | static void alc662_auto_init(struct hda_codec *codec) |
| 19408 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19409 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19410 | alc662_auto_init_multi_out(codec); |
| 19411 | alc662_auto_init_hp_out(codec); |
| 19412 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19413 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19414 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19415 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19416 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19417 | } |
| 19418 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19419 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19420 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19421 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19422 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19423 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19424 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19425 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19426 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19427 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19428 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19429 | printk(KERN_WARNING |
| 19430 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19431 | } |
| 19432 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19433 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19434 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19435 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19436 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19437 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19438 | ALC662_FIXUP_SKU_IGNORE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19439 | }; |
| 19440 | |
| 19441 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19442 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19443 | .type = ALC_FIXUP_PINS, |
| 19444 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19445 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19446 | { } |
| 19447 | } |
| 19448 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19449 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19450 | .type = ALC_FIXUP_PINS, |
| 19451 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19452 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19453 | { } |
| 19454 | } |
| 19455 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19456 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19457 | .type = ALC_FIXUP_FUNC, |
| 19458 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19459 | }, |
| 19460 | [ALC662_FIXUP_CZC_P10T] = { |
| 19461 | .type = ALC_FIXUP_VERBS, |
| 19462 | .v.verbs = (const struct hda_verb[]) { |
| 19463 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19464 | {} |
| 19465 | } |
| 19466 | }, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19467 | [ALC662_FIXUP_SKU_IGNORE] = { |
| 19468 | .type = ALC_FIXUP_SKU, |
| 19469 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19470 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19471 | }; |
| 19472 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19473 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19474 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19475 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19476 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19477 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19478 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19479 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19480 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19481 | {} |
| 19482 | }; |
| 19483 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19484 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19485 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19486 | {} |
| 19487 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19488 | |
| 19489 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19490 | static int patch_alc662(struct hda_codec *codec) |
| 19491 | { |
| 19492 | struct alc_spec *spec; |
| 19493 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19494 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19495 | |
| 19496 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19497 | if (!spec) |
| 19498 | return -ENOMEM; |
| 19499 | |
| 19500 | codec->spec = spec; |
| 19501 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19502 | alc_auto_parse_customize_define(codec); |
| 19503 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19504 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19505 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19506 | coef = alc_read_coef_idx(codec, 0); |
| 19507 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19508 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19509 | else if (coef & (1 << 14) && |
| 19510 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19511 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19512 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19513 | else if (coef == 0x4011) |
| 19514 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19515 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19516 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19517 | alc662_models, |
| 19518 | alc662_cfg_tbl); |
| 19519 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19520 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19521 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19522 | board_config = ALC662_AUTO; |
| 19523 | } |
| 19524 | |
| 19525 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19526 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19527 | alc662_fixup_tbl, alc662_fixups); |
| 19528 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19529 | /* automatic parse from the BIOS config */ |
| 19530 | err = alc662_parse_auto_config(codec); |
| 19531 | if (err < 0) { |
| 19532 | alc_free(codec); |
| 19533 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19534 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19535 | printk(KERN_INFO |
| 19536 | "hda_codec: Cannot set up configuration " |
| 19537 | "from BIOS. Using base mode...\n"); |
| 19538 | board_config = ALC662_3ST_2ch_DIG; |
| 19539 | } |
| 19540 | } |
| 19541 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19542 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19543 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19544 | if (err < 0) { |
| 19545 | alc_free(codec); |
| 19546 | return err; |
| 19547 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19548 | } |
| 19549 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19550 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19551 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19552 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19553 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19554 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19555 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19556 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19557 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19558 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19559 | if (!spec->adc_nids) { |
| 19560 | spec->adc_nids = alc662_adc_nids; |
| 19561 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19562 | } |
| 19563 | if (!spec->capsrc_nids) |
| 19564 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19565 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19566 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19567 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19568 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19569 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19570 | switch (codec->vendor_id) { |
| 19571 | case 0x10ec0662: |
| 19572 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19573 | break; |
| 19574 | case 0x10ec0272: |
| 19575 | case 0x10ec0663: |
| 19576 | case 0x10ec0665: |
| 19577 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19578 | break; |
| 19579 | case 0x10ec0273: |
| 19580 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19581 | break; |
| 19582 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19583 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19584 | spec->vmaster_nid = 0x02; |
| 19585 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19586 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19587 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19588 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19589 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19590 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 19591 | spec->shutup = alc_eapd_shutup; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19592 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19593 | alc_init_jacks(codec); |
| 19594 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19595 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19596 | if (!spec->loopback.amplist) |
| 19597 | spec->loopback.amplist = alc662_loopbacks; |
| 19598 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19599 | |
| 19600 | return 0; |
| 19601 | } |
| 19602 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19603 | static int patch_alc888(struct hda_codec *codec) |
| 19604 | { |
| 19605 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19606 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19607 | if (codec->vendor_id == 0x10ec0887) |
| 19608 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19609 | else |
| 19610 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19611 | if (!codec->chip_name) { |
| 19612 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19613 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19614 | } |
| 19615 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19616 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19617 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19618 | } |
| 19619 | |
Kailang Yang | b478b99 | 2011-05-18 11:51:15 +0200 | [diff] [blame] | 19620 | static int patch_alc899(struct hda_codec *codec) |
| 19621 | { |
| 19622 | if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) { |
| 19623 | kfree(codec->chip_name); |
| 19624 | codec->chip_name = kstrdup("ALC898", GFP_KERNEL); |
| 19625 | } |
| 19626 | return patch_alc882(codec); |
| 19627 | } |
| 19628 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19629 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19630 | * ALC680 support |
| 19631 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19632 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19633 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19634 | #define alc680_modes alc260_modes |
| 19635 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19636 | static const hda_nid_t alc680_dac_nids[3] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19637 | /* Lout1, Lout2, hp */ |
| 19638 | 0x02, 0x03, 0x04 |
| 19639 | }; |
| 19640 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19641 | static const hda_nid_t alc680_adc_nids[3] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19642 | /* ADC0-2 */ |
| 19643 | /* DMIC, MIC, Line-in*/ |
| 19644 | 0x07, 0x08, 0x09 |
| 19645 | }; |
| 19646 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19647 | /* |
| 19648 | * Analog capture ADC cgange |
| 19649 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19650 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19651 | { |
| 19652 | struct alc_spec *spec = codec->spec; |
| 19653 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19654 | int pin_found = 0; |
| 19655 | int type_found = AUTO_PIN_LAST; |
| 19656 | hda_nid_t nid; |
| 19657 | int i; |
| 19658 | |
| 19659 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19660 | nid = cfg->inputs[i].pin; |
Takashi Iwai | 06dec22 | 2011-05-17 10:00:16 +0200 | [diff] [blame] | 19661 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19662 | continue; |
| 19663 | if (snd_hda_jack_detect(codec, nid)) { |
| 19664 | if (cfg->inputs[i].type < type_found) { |
| 19665 | type_found = cfg->inputs[i].type; |
| 19666 | pin_found = nid; |
| 19667 | } |
| 19668 | } |
| 19669 | } |
| 19670 | |
| 19671 | nid = 0x07; |
| 19672 | if (pin_found) |
| 19673 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19674 | |
| 19675 | if (nid != spec->cur_adc) |
| 19676 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19677 | spec->cur_adc = nid; |
| 19678 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19679 | spec->cur_adc_format); |
| 19680 | } |
| 19681 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19682 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19683 | struct hda_codec *codec, |
| 19684 | unsigned int stream_tag, |
| 19685 | unsigned int format, |
| 19686 | struct snd_pcm_substream *substream) |
| 19687 | { |
| 19688 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19689 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19690 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19691 | spec->cur_adc_stream_tag = stream_tag; |
| 19692 | spec->cur_adc_format = format; |
| 19693 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19694 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19695 | return 0; |
| 19696 | } |
| 19697 | |
| 19698 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19699 | struct hda_codec *codec, |
| 19700 | struct snd_pcm_substream *substream) |
| 19701 | { |
| 19702 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19703 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19704 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19705 | return 0; |
| 19706 | } |
| 19707 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19708 | static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19709 | .substreams = 1, /* can be overridden */ |
| 19710 | .channels_min = 2, |
| 19711 | .channels_max = 2, |
| 19712 | /* NID is set in alc_build_pcms */ |
| 19713 | .ops = { |
| 19714 | .prepare = alc680_capture_pcm_prepare, |
| 19715 | .cleanup = alc680_capture_pcm_cleanup |
| 19716 | }, |
| 19717 | }; |
| 19718 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19719 | static const struct snd_kcontrol_new alc680_base_mixer[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19720 | /* output mixer control */ |
| 19721 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19722 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19723 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19724 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19725 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19726 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19727 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19728 | { } |
| 19729 | }; |
| 19730 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19731 | static const struct hda_bind_ctls alc680_bind_cap_vol = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19732 | .ops = &snd_hda_bind_vol, |
| 19733 | .values = { |
| 19734 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19735 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19736 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19737 | 0 |
| 19738 | }, |
| 19739 | }; |
| 19740 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19741 | static const struct hda_bind_ctls alc680_bind_cap_switch = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19742 | .ops = &snd_hda_bind_sw, |
| 19743 | .values = { |
| 19744 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19745 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19746 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19747 | 0 |
| 19748 | }, |
| 19749 | }; |
| 19750 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19751 | static const struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19752 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19753 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19754 | { } /* end */ |
| 19755 | }; |
| 19756 | |
| 19757 | /* |
| 19758 | * generic initialization of ADC, input mixers and output mixers |
| 19759 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19760 | static const struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19761 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19762 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19763 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19764 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19765 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19766 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19767 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19768 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19769 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19770 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19771 | |
| 19772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19774 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19775 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19776 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19777 | |
| 19778 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19779 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19780 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19781 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19782 | { } |
| 19783 | }; |
| 19784 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19785 | /* toggle speaker-output according to the hp-jack state */ |
| 19786 | static void alc680_base_setup(struct hda_codec *codec) |
| 19787 | { |
| 19788 | struct alc_spec *spec = codec->spec; |
| 19789 | |
| 19790 | spec->autocfg.hp_pins[0] = 0x16; |
| 19791 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19792 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19793 | spec->autocfg.num_inputs = 2; |
| 19794 | spec->autocfg.inputs[0].pin = 0x18; |
| 19795 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19796 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19797 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19798 | spec->automute = 1; |
| 19799 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19800 | } |
| 19801 | |
| 19802 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19803 | unsigned int res) |
| 19804 | { |
| 19805 | if ((res >> 26) == ALC880_HP_EVENT) |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19806 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19807 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19808 | alc680_rec_autoswitch(codec); |
| 19809 | } |
| 19810 | |
| 19811 | static void alc680_inithook(struct hda_codec *codec) |
| 19812 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19813 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19814 | alc680_rec_autoswitch(codec); |
| 19815 | } |
| 19816 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19817 | /* create input playback/capture controls for the given pin */ |
| 19818 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19819 | const char *ctlname, int idx) |
| 19820 | { |
| 19821 | hda_nid_t dac; |
| 19822 | int err; |
| 19823 | |
| 19824 | switch (nid) { |
| 19825 | case 0x14: |
| 19826 | dac = 0x02; |
| 19827 | break; |
| 19828 | case 0x15: |
| 19829 | dac = 0x03; |
| 19830 | break; |
| 19831 | case 0x16: |
| 19832 | dac = 0x04; |
| 19833 | break; |
| 19834 | default: |
| 19835 | return 0; |
| 19836 | } |
| 19837 | if (spec->multiout.dac_nids[0] != dac && |
| 19838 | spec->multiout.dac_nids[1] != dac) { |
| 19839 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19840 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19841 | HDA_OUTPUT)); |
| 19842 | if (err < 0) |
| 19843 | return err; |
| 19844 | |
| 19845 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19846 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19847 | |
| 19848 | if (err < 0) |
| 19849 | return err; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 19850 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19851 | } |
| 19852 | |
| 19853 | return 0; |
| 19854 | } |
| 19855 | |
| 19856 | /* add playback controls from the parsed DAC table */ |
| 19857 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19858 | const struct auto_pin_cfg *cfg) |
| 19859 | { |
| 19860 | hda_nid_t nid; |
| 19861 | int err; |
| 19862 | |
| 19863 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19864 | |
| 19865 | nid = cfg->line_out_pins[0]; |
| 19866 | if (nid) { |
| 19867 | const char *name; |
| 19868 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19869 | name = "Speaker"; |
| 19870 | else |
| 19871 | name = "Front"; |
| 19872 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19873 | if (err < 0) |
| 19874 | return err; |
| 19875 | } |
| 19876 | |
| 19877 | nid = cfg->speaker_pins[0]; |
| 19878 | if (nid) { |
| 19879 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19880 | if (err < 0) |
| 19881 | return err; |
| 19882 | } |
| 19883 | nid = cfg->hp_pins[0]; |
| 19884 | if (nid) { |
| 19885 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19886 | if (err < 0) |
| 19887 | return err; |
| 19888 | } |
| 19889 | |
| 19890 | return 0; |
| 19891 | } |
| 19892 | |
| 19893 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19894 | hda_nid_t nid, int pin_type) |
| 19895 | { |
| 19896 | alc_set_pin_output(codec, nid, pin_type); |
| 19897 | } |
| 19898 | |
| 19899 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19900 | { |
| 19901 | struct alc_spec *spec = codec->spec; |
| 19902 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19903 | if (nid) { |
| 19904 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19905 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19906 | } |
| 19907 | } |
| 19908 | |
| 19909 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19910 | { |
| 19911 | struct alc_spec *spec = codec->spec; |
| 19912 | hda_nid_t pin; |
| 19913 | |
| 19914 | pin = spec->autocfg.hp_pins[0]; |
| 19915 | if (pin) |
| 19916 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19917 | pin = spec->autocfg.speaker_pins[0]; |
| 19918 | if (pin) |
| 19919 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19920 | } |
| 19921 | |
| 19922 | /* pcm configuration: identical with ALC880 */ |
| 19923 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19924 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19925 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19926 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19927 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19928 | |
| 19929 | /* |
| 19930 | * BIOS auto configuration |
| 19931 | */ |
| 19932 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19933 | { |
| 19934 | struct alc_spec *spec = codec->spec; |
| 19935 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19936 | static const hda_nid_t alc680_ignore[] = { 0 }; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19937 | |
| 19938 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19939 | alc680_ignore); |
| 19940 | if (err < 0) |
| 19941 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19942 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19943 | if (!spec->autocfg.line_outs) { |
| 19944 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19945 | spec->multiout.max_channels = 2; |
| 19946 | spec->no_analog = 1; |
| 19947 | goto dig_only; |
| 19948 | } |
| 19949 | return 0; /* can't find valid BIOS pin config */ |
| 19950 | } |
| 19951 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19952 | if (err < 0) |
| 19953 | return err; |
| 19954 | |
| 19955 | spec->multiout.max_channels = 2; |
| 19956 | |
| 19957 | dig_only: |
| 19958 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19959 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19960 | if (spec->kctls.list) |
| 19961 | add_mixer(spec, spec->kctls.list); |
| 19962 | |
| 19963 | add_verb(spec, alc680_init_verbs); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19964 | |
| 19965 | err = alc_auto_add_mic_boost(codec); |
| 19966 | if (err < 0) |
| 19967 | return err; |
| 19968 | |
| 19969 | return 1; |
| 19970 | } |
| 19971 | |
| 19972 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19973 | |
| 19974 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19975 | static void alc680_auto_init(struct hda_codec *codec) |
| 19976 | { |
| 19977 | struct alc_spec *spec = codec->spec; |
| 19978 | alc680_auto_init_multi_out(codec); |
| 19979 | alc680_auto_init_hp_out(codec); |
| 19980 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19981 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19982 | if (spec->unsol_event) |
| 19983 | alc_inithook(codec); |
| 19984 | } |
| 19985 | |
| 19986 | /* |
| 19987 | * configuration and preset |
| 19988 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19989 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19990 | [ALC680_BASE] = "base", |
| 19991 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19992 | }; |
| 19993 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19994 | static const struct snd_pci_quirk alc680_cfg_tbl[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19995 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19996 | {} |
| 19997 | }; |
| 19998 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19999 | static const struct alc_config_preset alc680_presets[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20000 | [ALC680_BASE] = { |
| 20001 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20002 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20003 | .init_verbs = { alc680_init_verbs }, |
| 20004 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 20005 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20006 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 20007 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 20008 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20009 | .unsol_event = alc680_unsol_event, |
| 20010 | .setup = alc680_base_setup, |
| 20011 | .init_hook = alc680_inithook, |
| 20012 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20013 | }, |
| 20014 | }; |
| 20015 | |
| 20016 | static int patch_alc680(struct hda_codec *codec) |
| 20017 | { |
| 20018 | struct alc_spec *spec; |
| 20019 | int board_config; |
| 20020 | int err; |
| 20021 | |
| 20022 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 20023 | if (spec == NULL) |
| 20024 | return -ENOMEM; |
| 20025 | |
| 20026 | codec->spec = spec; |
| 20027 | |
| 20028 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 20029 | alc680_models, |
| 20030 | alc680_cfg_tbl); |
| 20031 | |
| 20032 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 20033 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 20034 | codec->chip_name); |
| 20035 | board_config = ALC680_AUTO; |
| 20036 | } |
| 20037 | |
| 20038 | if (board_config == ALC680_AUTO) { |
| 20039 | /* automatic parse from the BIOS config */ |
| 20040 | err = alc680_parse_auto_config(codec); |
| 20041 | if (err < 0) { |
| 20042 | alc_free(codec); |
| 20043 | return err; |
| 20044 | } else if (!err) { |
| 20045 | printk(KERN_INFO |
| 20046 | "hda_codec: Cannot set up configuration " |
| 20047 | "from BIOS. Using base mode...\n"); |
| 20048 | board_config = ALC680_BASE; |
| 20049 | } |
| 20050 | } |
| 20051 | |
| 20052 | if (board_config != ALC680_AUTO) |
| 20053 | setup_preset(codec, &alc680_presets[board_config]); |
| 20054 | |
| 20055 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20056 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20057 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 20058 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20059 | |
| 20060 | if (!spec->adc_nids) { |
| 20061 | spec->adc_nids = alc680_adc_nids; |
| 20062 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 20063 | } |
| 20064 | |
| 20065 | if (!spec->cap_mixer) |
| 20066 | set_capture_mixer(codec); |
| 20067 | |
| 20068 | spec->vmaster_nid = 0x02; |
| 20069 | |
| 20070 | codec->patch_ops = alc_patch_ops; |
| 20071 | if (board_config == ALC680_AUTO) |
| 20072 | spec->init_hook = alc680_auto_init; |
| 20073 | |
| 20074 | return 0; |
| 20075 | } |
| 20076 | |
| 20077 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20078 | * patch entries |
| 20079 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 20080 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 20081 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20082 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20083 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20084 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 20085 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 20086 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20087 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 20088 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 20089 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 20090 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20091 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20092 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20093 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 20094 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 20095 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20096 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20097 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 20098 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 20099 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 20100 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 20101 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 20102 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 20103 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 20104 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20105 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20106 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 20107 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20108 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 20109 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20110 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 20111 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 20112 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 20113 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20114 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20115 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 20116 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 20117 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Kailang Yang | b478b99 | 2011-05-18 11:51:15 +0200 | [diff] [blame] | 20118 | { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20119 | {} /* terminator */ |
| 20120 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 20121 | |
| 20122 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 20123 | |
| 20124 | MODULE_LICENSE("GPL"); |
| 20125 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 20126 | |
| 20127 | static struct hda_codec_preset_list realtek_list = { |
| 20128 | .preset = snd_hda_preset_realtek, |
| 20129 | .owner = THIS_MODULE, |
| 20130 | }; |
| 20131 | |
| 20132 | static int __init patch_realtek_init(void) |
| 20133 | { |
| 20134 | return snd_hda_add_codec_preset(&realtek_list); |
| 20135 | } |
| 20136 | |
| 20137 | static void __exit patch_realtek_exit(void) |
| 20138 | { |
| 20139 | snd_hda_delete_codec_preset(&realtek_list); |
| 20140 | } |
| 20141 | |
| 20142 | module_init(patch_realtek_init) |
| 20143 | module_exit(patch_realtek_exit) |