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 | 3e1647c | 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 */ |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 351 | hda_nid_t mixer_nid; /* analog-mixer NID */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 353 | /* capture setup for dynamic dual-adc switch */ |
| 354 | unsigned int cur_adc_idx; |
| 355 | hda_nid_t cur_adc; |
| 356 | unsigned int cur_adc_stream_tag; |
| 357 | unsigned int cur_adc_format; |
| 358 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 360 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | const struct hda_input_mux *input_mux; |
| 362 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 363 | struct alc_mic_route ext_mic; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 364 | struct alc_mic_route dock_mic; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 365 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | |
| 367 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 368 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 370 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 371 | int const_channel_count; |
| 372 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | |
| 374 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 375 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 376 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 377 | /* dynamic controls, init_verbs and input_mux */ |
| 378 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 379 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 380 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 381 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 382 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 383 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 384 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 385 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 386 | /* hooks */ |
| 387 | void (*init_hook)(struct hda_codec *codec); |
| 388 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 389 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 390 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 391 | #endif |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 392 | void (*shutup)(struct hda_codec *codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 393 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 394 | /* for pin sensing */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 395 | unsigned int jack_present: 1; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 396 | unsigned int line_jack_present:1; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 397 | unsigned int master_mute:1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 398 | unsigned int auto_mic:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 399 | unsigned int automute:1; /* HP automute enabled */ |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 400 | unsigned int detect_line:1; /* Line-out detection enabled */ |
| 401 | unsigned int automute_lines:1; /* automute line-out as well */ |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 402 | unsigned int automute_hp_lo:1; /* both HP and LO available */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 403 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 404 | /* other flags */ |
| 405 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 406 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 407 | unsigned int single_input_src:1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 408 | |
| 409 | /* auto-mute control */ |
| 410 | int automute_mode; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 411 | hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 412 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 413 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 414 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 415 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 416 | /* for virtual master */ |
| 417 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 418 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 419 | struct hda_loopback_check loopback; |
| 420 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 421 | |
| 422 | /* for PLL fix */ |
| 423 | hda_nid_t pll_nid; |
| 424 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 425 | |
| 426 | /* fix-up list */ |
| 427 | int fixup_id; |
| 428 | const struct alc_fixup *fixup_list; |
| 429 | const char *fixup_name; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 430 | |
| 431 | /* multi-io */ |
| 432 | int multi_ios; |
| 433 | struct alc_multi_io multi_io[4]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 434 | }; |
| 435 | |
| 436 | /* |
| 437 | * configuration template - to be copied to the spec instance |
| 438 | */ |
| 439 | struct alc_config_preset { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 440 | const struct snd_kcontrol_new *mixers[5]; /* should be identical size |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 441 | * with spec |
| 442 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 443 | const struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 444 | const struct hda_verb *init_verbs[5]; |
| 445 | unsigned int num_dacs; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 446 | const hda_nid_t *dac_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 447 | hda_nid_t dig_out_nid; /* optional */ |
| 448 | hda_nid_t hp_nid; /* optional */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 449 | const hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 450 | unsigned int num_adc_nids; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 451 | const hda_nid_t *adc_nids; |
| 452 | const hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 453 | hda_nid_t dig_in_nid; |
| 454 | unsigned int num_channel_mode; |
| 455 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 456 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 457 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 458 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 459 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 460 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 461 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 462 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 463 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 464 | const struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 465 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 466 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | }; |
| 468 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | |
| 470 | /* |
| 471 | * input MUX handling |
| 472 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 473 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 474 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | { |
| 476 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 477 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 478 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 479 | if (mux_idx >= spec->num_mux_defs) |
| 480 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 481 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 482 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 483 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | } |
| 485 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 486 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 487 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | { |
| 489 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 490 | struct alc_spec *spec = codec->spec; |
| 491 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 492 | |
| 493 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 494 | return 0; |
| 495 | } |
| 496 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 497 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 498 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | { |
| 500 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 501 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 502 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 504 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 505 | hda_nid_t nid = spec->capsrc_nids ? |
| 506 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 507 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 509 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 510 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 511 | if (!imux->num_items && mux_idx > 0) |
| 512 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 513 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 514 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 515 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 516 | /* Matrix-mixer style (e.g. ALC882) */ |
| 517 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 518 | unsigned int i, idx; |
| 519 | |
| 520 | idx = ucontrol->value.enumerated.item[0]; |
| 521 | if (idx >= imux->num_items) |
| 522 | idx = imux->num_items - 1; |
| 523 | if (*cur_val == idx) |
| 524 | return 0; |
| 525 | for (i = 0; i < imux->num_items; i++) { |
| 526 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 527 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 528 | imux->items[i].index, |
| 529 | HDA_AMP_MUTE, v); |
| 530 | } |
| 531 | *cur_val = idx; |
| 532 | return 1; |
| 533 | } else { |
| 534 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 535 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 536 | &spec->cur_mux[adc_idx]); |
| 537 | } |
| 538 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | /* |
| 541 | * channel mode setting |
| 542 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 543 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 544 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | { |
| 546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 547 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 548 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 549 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | } |
| 551 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 552 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 553 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | { |
| 555 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 556 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 557 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 559 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | } |
| 561 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 563 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | { |
| 565 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 566 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 567 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 568 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 569 | &spec->ext_channel_count); |
| 570 | if (err >= 0 && !spec->const_channel_count) { |
| 571 | spec->multiout.max_channels = spec->ext_channel_count; |
| 572 | if (spec->need_dac_fix) |
| 573 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 574 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 575 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | } |
| 577 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 579 | * 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] | 580 | * instead of "%" to avoid consequences of accidentally treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | * being part of a format specifier. Maximum allowed length of a value is |
| 582 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 583 | * |
| 584 | * Note: some retasking pin complexes seem to ignore requests for input |
| 585 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 586 | * are requested. Therefore order this list so that this behaviour will not |
| 587 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 588 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 589 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 590 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 591 | static const char * const alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 592 | "Mic 50pc bias", "Mic 80pc bias", |
| 593 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 594 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 595 | static const unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 596 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 597 | }; |
| 598 | /* 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] | 599 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 600 | * addition, "input" pins may or may not process the mic bias option |
| 601 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 602 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 603 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 604 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 605 | #define ALC_PIN_DIR_IN 0x00 |
| 606 | #define ALC_PIN_DIR_OUT 0x01 |
| 607 | #define ALC_PIN_DIR_INOUT 0x02 |
| 608 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 609 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 610 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 611 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 612 | * For each direction the minimum and maximum values are given. |
| 613 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 614 | static const signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 615 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 616 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 617 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 618 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 619 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 620 | }; |
| 621 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 622 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 623 | #define alc_pin_mode_n_items(_dir) \ |
| 624 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 625 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 626 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 627 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 628 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 629 | unsigned int item_num = uinfo->value.enumerated.item; |
| 630 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 631 | |
| 632 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 633 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 634 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 635 | |
| 636 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 637 | item_num = alc_pin_mode_min(dir); |
| 638 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 639 | return 0; |
| 640 | } |
| 641 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 643 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 644 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 645 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 647 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 648 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 649 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 650 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 651 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 652 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 653 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 654 | /* Find enumerated value for current pinctl setting */ |
| 655 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 656 | 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] | 657 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 658 | *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] | 659 | return 0; |
| 660 | } |
| 661 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 662 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 663 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 664 | { |
| 665 | signed int change; |
| 666 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 667 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 668 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 669 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 670 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 671 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 672 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 673 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 674 | 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] | 675 | val = alc_pin_mode_min(dir); |
| 676 | |
| 677 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 678 | if (change) { |
| 679 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 680 | snd_hda_codec_write_cache(codec, nid, 0, |
| 681 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 682 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 683 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 684 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 685 | * for the requested pin mode. Enum values of 2 or less are |
| 686 | * input modes. |
| 687 | * |
| 688 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 689 | * reduces noise slightly (particularly on input) so we'll |
| 690 | * do it. However, having both input and output buffers |
| 691 | * enabled simultaneously doesn't seem to be problematic if |
| 692 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 693 | */ |
| 694 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 695 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 696 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 697 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 698 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 699 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 700 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 701 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 702 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 703 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 704 | } |
| 705 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 706 | return change; |
| 707 | } |
| 708 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 709 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 710 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 711 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 712 | .info = alc_pin_mode_info, \ |
| 713 | .get = alc_pin_mode_get, \ |
| 714 | .put = alc_pin_mode_put, \ |
| 715 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 716 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 717 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 718 | * together using a mask with more than one bit set. This control is |
| 719 | * currently used only by the ALC260 test model. At this stage they are not |
| 720 | * needed for any "production" models. |
| 721 | */ |
| 722 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 723 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 724 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 725 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 726 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 727 | { |
| 728 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 729 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 730 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 731 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 732 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 733 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 734 | |
| 735 | *valp = (val & mask) != 0; |
| 736 | return 0; |
| 737 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 738 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 739 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 740 | { |
| 741 | signed int change; |
| 742 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 743 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 744 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 745 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 746 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 747 | AC_VERB_GET_GPIO_DATA, |
| 748 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 749 | |
| 750 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 751 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 752 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 753 | gpio_data &= ~mask; |
| 754 | else |
| 755 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 756 | snd_hda_codec_write_cache(codec, nid, 0, |
| 757 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 758 | |
| 759 | return change; |
| 760 | } |
| 761 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 762 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 763 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 764 | .info = alc_gpio_data_info, \ |
| 765 | .get = alc_gpio_data_get, \ |
| 766 | .put = alc_gpio_data_put, \ |
| 767 | .private_value = nid | (mask<<16) } |
| 768 | #endif /* CONFIG_SND_DEBUG */ |
| 769 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 770 | /* A switch control to allow the enabling of the digital IO pins on the |
| 771 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 772 | * to provide something in the test model allowing digital outputs to be |
| 773 | * identified if present. If models are found which can utilise these |
| 774 | * outputs a more complete mixer control can be devised for those models if |
| 775 | * necessary. |
| 776 | */ |
| 777 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 778 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 779 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 780 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 781 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 782 | { |
| 783 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 784 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 785 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 786 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 787 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 788 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 789 | |
| 790 | *valp = (val & mask) != 0; |
| 791 | return 0; |
| 792 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 793 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 794 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 795 | { |
| 796 | signed int change; |
| 797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 798 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 799 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 800 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 801 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 802 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 803 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 804 | |
| 805 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 806 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 807 | if (val==0) |
| 808 | ctrl_data &= ~mask; |
| 809 | else |
| 810 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 811 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 812 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 813 | |
| 814 | return change; |
| 815 | } |
| 816 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 817 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 818 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 819 | .info = alc_spdif_ctrl_info, \ |
| 820 | .get = alc_spdif_ctrl_get, \ |
| 821 | .put = alc_spdif_ctrl_put, \ |
| 822 | .private_value = nid | (mask<<16) } |
| 823 | #endif /* CONFIG_SND_DEBUG */ |
| 824 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 825 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 826 | * Again, this is only used in the ALC26x test models to help identify when |
| 827 | * the EAPD line must be asserted for features to work. |
| 828 | */ |
| 829 | #ifdef CONFIG_SND_DEBUG |
| 830 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 831 | |
| 832 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 833 | struct snd_ctl_elem_value *ucontrol) |
| 834 | { |
| 835 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 836 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 837 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 838 | long *valp = ucontrol->value.integer.value; |
| 839 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 840 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 841 | |
| 842 | *valp = (val & mask) != 0; |
| 843 | return 0; |
| 844 | } |
| 845 | |
| 846 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 847 | struct snd_ctl_elem_value *ucontrol) |
| 848 | { |
| 849 | int change; |
| 850 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 851 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 852 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 853 | long val = *ucontrol->value.integer.value; |
| 854 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 855 | AC_VERB_GET_EAPD_BTLENABLE, |
| 856 | 0x00); |
| 857 | |
| 858 | /* Set/unset the masked control bit(s) as needed */ |
| 859 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 860 | if (!val) |
| 861 | ctrl_data &= ~mask; |
| 862 | else |
| 863 | ctrl_data |= mask; |
| 864 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 865 | ctrl_data); |
| 866 | |
| 867 | return change; |
| 868 | } |
| 869 | |
| 870 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 871 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 872 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 873 | .info = alc_eapd_ctrl_info, \ |
| 874 | .get = alc_eapd_ctrl_get, \ |
| 875 | .put = alc_eapd_ctrl_put, \ |
| 876 | .private_value = nid | (mask<<16) } |
| 877 | #endif /* CONFIG_SND_DEBUG */ |
| 878 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 879 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 880 | * set up the input pin config (depending on the given auto-pin type) |
| 881 | */ |
| 882 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 883 | int auto_pin_type) |
| 884 | { |
| 885 | unsigned int val = PIN_IN; |
| 886 | |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 887 | if (auto_pin_type == AUTO_PIN_MIC) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 888 | unsigned int pincap; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 889 | unsigned int oldval; |
| 890 | oldval = snd_hda_codec_read(codec, nid, 0, |
| 891 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 892 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 893 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 894 | /* if the default pin setup is vref50, we give it priority */ |
| 895 | if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50) |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 896 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 897 | else if (pincap & AC_PINCAP_VREF_50) |
| 898 | val = PIN_VREF50; |
| 899 | else if (pincap & AC_PINCAP_VREF_100) |
| 900 | val = PIN_VREF100; |
| 901 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 902 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 903 | } |
| 904 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 905 | } |
| 906 | |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 907 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) |
| 908 | { |
| 909 | struct alc_spec *spec = codec->spec; |
| 910 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 911 | |
| 912 | if (!cfg->line_outs) { |
| 913 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && |
| 914 | cfg->line_out_pins[cfg->line_outs]) |
| 915 | cfg->line_outs++; |
| 916 | } |
| 917 | if (!cfg->speaker_outs) { |
| 918 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && |
| 919 | cfg->speaker_pins[cfg->speaker_outs]) |
| 920 | cfg->speaker_outs++; |
| 921 | } |
| 922 | if (!cfg->hp_outs) { |
| 923 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && |
| 924 | cfg->hp_pins[cfg->hp_outs]) |
| 925 | cfg->hp_outs++; |
| 926 | } |
| 927 | } |
| 928 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 929 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 930 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 931 | 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] | 932 | { |
| 933 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 934 | return; |
| 935 | spec->mixers[spec->num_mixers++] = mix; |
| 936 | } |
| 937 | |
| 938 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 939 | { |
| 940 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 941 | return; |
| 942 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 943 | } |
| 944 | |
| 945 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 946 | * set up from the preset table |
| 947 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 948 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 949 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 950 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 951 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 952 | int i; |
| 953 | |
| 954 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 955 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 956 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 957 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 958 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 959 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 961 | spec->channel_mode = preset->channel_mode; |
| 962 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 963 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 964 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 965 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 966 | if (preset->const_channel_count) |
| 967 | spec->multiout.max_channels = preset->const_channel_count; |
| 968 | else |
| 969 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 970 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 971 | |
| 972 | spec->multiout.num_dacs = preset->num_dacs; |
| 973 | spec->multiout.dac_nids = preset->dac_nids; |
| 974 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 975 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 976 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 977 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 978 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 979 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 980 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 981 | spec->input_mux = preset->input_mux; |
| 982 | |
| 983 | spec->num_adc_nids = preset->num_adc_nids; |
| 984 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 985 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 986 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 987 | |
| 988 | spec->unsol_event = preset->unsol_event; |
| 989 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 990 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 991 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 992 | spec->loopback.amplist = preset->loopbacks; |
| 993 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 994 | |
| 995 | if (preset->setup) |
| 996 | preset->setup(codec); |
Takashi Iwai | f6837bb | 2010-09-20 14:56:32 +0200 | [diff] [blame] | 997 | |
| 998 | alc_fixup_autocfg_pin_nums(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 999 | } |
| 1000 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1001 | /* Enable GPIO mask and set output */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1002 | static const struct hda_verb alc_gpio1_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1003 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 1004 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 1005 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 1006 | { } |
| 1007 | }; |
| 1008 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1009 | static const struct hda_verb alc_gpio2_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1010 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 1011 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 1012 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 1013 | { } |
| 1014 | }; |
| 1015 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1016 | static const struct hda_verb alc_gpio3_init_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1017 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 1018 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 1019 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 1020 | { } |
| 1021 | }; |
| 1022 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 1023 | /* |
| 1024 | * Fix hardware PLL issue |
| 1025 | * On some codecs, the analog PLL gating control must be off while |
| 1026 | * the default value is 1. |
| 1027 | */ |
| 1028 | static void alc_fix_pll(struct hda_codec *codec) |
| 1029 | { |
| 1030 | struct alc_spec *spec = codec->spec; |
| 1031 | unsigned int val; |
| 1032 | |
| 1033 | if (!spec->pll_nid) |
| 1034 | return; |
| 1035 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1036 | spec->pll_coef_idx); |
| 1037 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 1038 | AC_VERB_GET_PROC_COEF, 0); |
| 1039 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 1040 | spec->pll_coef_idx); |
| 1041 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 1042 | val & ~(1 << spec->pll_coef_bit)); |
| 1043 | } |
| 1044 | |
| 1045 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 1046 | unsigned int coef_idx, unsigned int coef_bit) |
| 1047 | { |
| 1048 | struct alc_spec *spec = codec->spec; |
| 1049 | spec->pll_nid = nid; |
| 1050 | spec->pll_coef_idx = coef_idx; |
| 1051 | spec->pll_coef_bit = coef_bit; |
| 1052 | alc_fix_pll(codec); |
| 1053 | } |
| 1054 | |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1055 | static int alc_init_jacks(struct hda_codec *codec) |
| 1056 | { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1057 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1058 | struct alc_spec *spec = codec->spec; |
| 1059 | int err; |
| 1060 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 1061 | unsigned int mic_nid = spec->ext_mic.pin; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1062 | unsigned int dock_nid = spec->dock_mic.pin; |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1063 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1064 | if (hp_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1065 | err = snd_hda_input_jack_add(codec, hp_nid, |
| 1066 | SND_JACK_HEADPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1067 | if (err < 0) |
| 1068 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1069 | snd_hda_input_jack_report(codec, hp_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1070 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1071 | |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1072 | if (mic_nid) { |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1073 | err = snd_hda_input_jack_add(codec, mic_nid, |
| 1074 | SND_JACK_MICROPHONE, NULL); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1075 | if (err < 0) |
| 1076 | return err; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1077 | snd_hda_input_jack_report(codec, mic_nid); |
Takashi Iwai | 265a024 | 2010-09-21 11:26:21 +0200 | [diff] [blame] | 1078 | } |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1079 | if (dock_nid) { |
| 1080 | err = snd_hda_input_jack_add(codec, dock_nid, |
| 1081 | SND_JACK_MICROPHONE, NULL); |
| 1082 | if (err < 0) |
| 1083 | return err; |
| 1084 | snd_hda_input_jack_report(codec, dock_nid); |
| 1085 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1086 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1087 | return 0; |
| 1088 | } |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 1089 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1090 | 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] | 1091 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1092 | int i, present = 0; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1093 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1094 | for (i = 0; i < num_pins; i++) { |
| 1095 | hda_nid_t nid = pins[i]; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1096 | if (!nid) |
| 1097 | break; |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1098 | snd_hda_input_jack_report(codec, nid); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1099 | present |= snd_hda_jack_detect(codec, nid); |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1100 | } |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1101 | return present; |
| 1102 | } |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1103 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1104 | 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] | 1105 | bool mute, bool hp_out) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1106 | { |
| 1107 | struct alc_spec *spec = codec->spec; |
| 1108 | unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 1109 | unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1110 | int i; |
| 1111 | |
| 1112 | for (i = 0; i < num_pins; i++) { |
| 1113 | hda_nid_t nid = pins[i]; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1114 | if (!nid) |
| 1115 | break; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1116 | switch (spec->automute_mode) { |
| 1117 | case ALC_AUTOMUTE_PIN: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1118 | snd_hda_codec_write(codec, nid, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1119 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1120 | pin_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1121 | break; |
| 1122 | case ALC_AUTOMUTE_AMP: |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1123 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1124 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1125 | break; |
| 1126 | case ALC_AUTOMUTE_MIXER: |
| 1127 | nid = spec->automute_mixer_nid[i]; |
| 1128 | if (!nid) |
| 1129 | break; |
| 1130 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1131 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1132 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1133 | HDA_AMP_MUTE, mute_bits); |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 1134 | break; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1135 | } |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1136 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1137 | } |
| 1138 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1139 | /* Toggle internal speakers muting */ |
| 1140 | static void update_speakers(struct hda_codec *codec) |
| 1141 | { |
| 1142 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1143 | int on; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1144 | |
Takashi Iwai | c0a2026 | 2011-06-10 15:28:15 +0200 | [diff] [blame] | 1145 | /* Control HP pins/amps depending on master_mute state; |
| 1146 | * in general, HP pins/amps control should be enabled in all cases, |
| 1147 | * but currently set only for master_mute, just to be safe |
| 1148 | */ |
| 1149 | do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 1150 | spec->autocfg.hp_pins, spec->master_mute, true); |
| 1151 | |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1152 | if (!spec->automute) |
| 1153 | on = 0; |
| 1154 | else |
| 1155 | on = spec->jack_present | spec->line_jack_present; |
| 1156 | on |= spec->master_mute; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1157 | do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1158 | spec->autocfg.speaker_pins, on, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1159 | |
| 1160 | /* toggle line-out mutes if needed, too */ |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1161 | /* if LO is a copy of either HP or Speaker, don't need to handle it */ |
| 1162 | if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] || |
| 1163 | spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0]) |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1164 | return; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1165 | if (!spec->automute_lines || !spec->automute) |
| 1166 | on = 0; |
| 1167 | else |
| 1168 | on = spec->jack_present; |
| 1169 | on |= spec->master_mute; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1170 | do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1171 | spec->autocfg.line_out_pins, on, false); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1172 | } |
| 1173 | |
| 1174 | static void alc_hp_automute(struct hda_codec *codec) |
| 1175 | { |
| 1176 | struct alc_spec *spec = codec->spec; |
| 1177 | |
| 1178 | if (!spec->automute) |
| 1179 | return; |
| 1180 | spec->jack_present = |
| 1181 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins), |
| 1182 | spec->autocfg.hp_pins); |
| 1183 | update_speakers(codec); |
| 1184 | } |
| 1185 | |
| 1186 | static void alc_line_automute(struct hda_codec *codec) |
| 1187 | { |
| 1188 | struct alc_spec *spec = codec->spec; |
| 1189 | |
| 1190 | if (!spec->automute || !spec->detect_line) |
| 1191 | return; |
| 1192 | spec->line_jack_present = |
| 1193 | detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), |
| 1194 | spec->autocfg.line_out_pins); |
| 1195 | update_speakers(codec); |
| 1196 | } |
| 1197 | |
Takashi Iwai | 8d087c7 | 2011-06-28 12:45:47 +0200 | [diff] [blame^] | 1198 | #define get_connection_index(codec, mux, nid) \ |
| 1199 | snd_hda_get_conn_index(codec, mux, nid, 0) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1200 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1201 | /* switch the current ADC according to the jack state */ |
| 1202 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1203 | { |
| 1204 | struct alc_spec *spec = codec->spec; |
| 1205 | unsigned int present; |
| 1206 | hda_nid_t new_adc; |
| 1207 | |
| 1208 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1209 | if (present) |
| 1210 | spec->cur_adc_idx = 1; |
| 1211 | else |
| 1212 | spec->cur_adc_idx = 0; |
| 1213 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1214 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1215 | /* stream is running, let's swap the current ADC */ |
Takashi Iwai | f0cea79 | 2010-08-13 11:56:53 +0200 | [diff] [blame] | 1216 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1217 | spec->cur_adc = new_adc; |
| 1218 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1219 | spec->cur_adc_stream_tag, 0, |
| 1220 | spec->cur_adc_format); |
| 1221 | } |
| 1222 | } |
| 1223 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1224 | static void alc_mic_automute(struct hda_codec *codec) |
| 1225 | { |
| 1226 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1227 | struct alc_mic_route *dead1, *dead2, *alive; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1228 | unsigned int present, type; |
| 1229 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1230 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1231 | if (!spec->auto_mic) |
| 1232 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1233 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1234 | return; |
| 1235 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1236 | return; |
| 1237 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1238 | if (spec->dual_adc_switch) { |
| 1239 | alc_dual_mic_adc_auto_switch(codec); |
| 1240 | return; |
| 1241 | } |
| 1242 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1243 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1244 | |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1245 | alive = &spec->int_mic; |
| 1246 | dead1 = &spec->ext_mic; |
| 1247 | dead2 = &spec->dock_mic; |
| 1248 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1249 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1250 | if (present) { |
| 1251 | alive = &spec->ext_mic; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1252 | dead1 = &spec->int_mic; |
| 1253 | dead2 = &spec->dock_mic; |
| 1254 | } |
| 1255 | if (!present && spec->dock_mic.pin > 0) { |
| 1256 | present = snd_hda_jack_detect(codec, spec->dock_mic.pin); |
| 1257 | if (present) { |
| 1258 | alive = &spec->dock_mic; |
| 1259 | dead1 = &spec->int_mic; |
| 1260 | dead2 = &spec->ext_mic; |
| 1261 | } |
| 1262 | snd_hda_input_jack_report(codec, spec->dock_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1263 | } |
| 1264 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1265 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1266 | if (type == AC_WID_AUD_MIX) { |
| 1267 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1268 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1269 | alive->mux_idx, |
| 1270 | HDA_AMP_MUTE, 0); |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1271 | if (dead1->pin > 0) |
| 1272 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1273 | dead1->mux_idx, |
| 1274 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1275 | if (dead2->pin > 0) |
| 1276 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1277 | dead2->mux_idx, |
| 1278 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1279 | } else { |
| 1280 | /* MUX style (e.g. ALC880) */ |
| 1281 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1282 | AC_VERB_SET_CONNECT_SEL, |
| 1283 | alive->mux_idx); |
| 1284 | } |
Takashi Iwai | cd372fb | 2011-03-03 14:40:14 +0100 | [diff] [blame] | 1285 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1286 | |
| 1287 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1288 | } |
| 1289 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1290 | /* unsolicited event for HP jack sensing */ |
| 1291 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1292 | { |
| 1293 | if (codec->vendor_id == 0x10ec0880) |
| 1294 | res >>= 28; |
| 1295 | else |
| 1296 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1297 | switch (res) { |
| 1298 | case ALC880_HP_EVENT: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1299 | alc_hp_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1300 | break; |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1301 | case ALC880_FRONT_EVENT: |
| 1302 | alc_line_automute(codec); |
| 1303 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1304 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1305 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1306 | break; |
| 1307 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1308 | } |
| 1309 | |
| 1310 | static void alc_inithook(struct hda_codec *codec) |
| 1311 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1312 | alc_hp_automute(codec); |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 1313 | alc_line_automute(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1314 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1315 | } |
| 1316 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1317 | /* additional initialization for ALC888 variants */ |
| 1318 | static void alc888_coef_init(struct hda_codec *codec) |
| 1319 | { |
| 1320 | unsigned int tmp; |
| 1321 | |
| 1322 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1323 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1324 | 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] | 1325 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1326 | /* alc888S-VC */ |
| 1327 | snd_hda_codec_read(codec, 0x20, 0, |
| 1328 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1329 | else |
| 1330 | /* alc888-VB */ |
| 1331 | snd_hda_codec_read(codec, 0x20, 0, |
| 1332 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1333 | } |
| 1334 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1335 | static void alc889_coef_init(struct hda_codec *codec) |
| 1336 | { |
| 1337 | unsigned int tmp; |
| 1338 | |
| 1339 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1340 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1341 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1342 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1343 | } |
| 1344 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1345 | /* turn on/off EAPD control (only if available) */ |
| 1346 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1347 | { |
| 1348 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1349 | return; |
| 1350 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1351 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1352 | on ? 2 : 0); |
| 1353 | } |
| 1354 | |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1355 | /* turn on/off EAPD controls of the codec */ |
| 1356 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) |
| 1357 | { |
| 1358 | /* We currently only handle front, HP */ |
Takashi Iwai | 39fa84e | 2011-06-27 15:28:57 +0200 | [diff] [blame] | 1359 | static hda_nid_t pins[] = { |
| 1360 | 0x0f, 0x10, 0x14, 0x15, 0 |
| 1361 | }; |
| 1362 | hda_nid_t *p; |
| 1363 | for (p = pins; *p; p++) |
| 1364 | set_eapd(codec, *p, on); |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 1365 | } |
| 1366 | |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 1367 | /* generic shutup callback; |
| 1368 | * just turning off EPAD and a little pause for avoiding pop-noise |
| 1369 | */ |
| 1370 | static void alc_eapd_shutup(struct hda_codec *codec) |
| 1371 | { |
| 1372 | alc_auto_setup_eapd(codec, false); |
| 1373 | msleep(200); |
| 1374 | } |
| 1375 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1376 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1377 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1378 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1379 | |
Takashi Iwai | 39fa84e | 2011-06-27 15:28:57 +0200 | [diff] [blame] | 1380 | alc_auto_setup_eapd(codec, true); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1381 | switch (type) { |
| 1382 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1383 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1384 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1385 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1386 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1387 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1388 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1389 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1390 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1391 | case ALC_INIT_DEFAULT: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1392 | switch (codec->vendor_id) { |
| 1393 | case 0x10ec0260: |
| 1394 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1395 | AC_VERB_SET_COEF_INDEX, 7); |
| 1396 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1397 | AC_VERB_GET_PROC_COEF, 0); |
| 1398 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1399 | AC_VERB_SET_COEF_INDEX, 7); |
| 1400 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1401 | AC_VERB_SET_PROC_COEF, |
| 1402 | tmp | 0x2010); |
| 1403 | break; |
| 1404 | case 0x10ec0262: |
| 1405 | case 0x10ec0880: |
| 1406 | case 0x10ec0882: |
| 1407 | case 0x10ec0883: |
| 1408 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1409 | case 0x10ec0887: |
Takashi Iwai | 20b67dd | 2011-03-23 22:54:32 +0100 | [diff] [blame] | 1410 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1411 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1412 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1413 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1414 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1415 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1416 | #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] | 1417 | case 0x10ec0267: |
| 1418 | case 0x10ec0268: |
| 1419 | snd_hda_codec_write(codec, 0x20, 0, |
| 1420 | AC_VERB_SET_COEF_INDEX, 7); |
| 1421 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1422 | AC_VERB_GET_PROC_COEF, 0); |
| 1423 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1424 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1425 | snd_hda_codec_write(codec, 0x20, 0, |
| 1426 | AC_VERB_SET_PROC_COEF, |
| 1427 | tmp | 0x3000); |
| 1428 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1429 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1430 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1431 | break; |
| 1432 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1433 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1434 | |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1435 | static int alc_automute_mode_info(struct snd_kcontrol *kcontrol, |
| 1436 | struct snd_ctl_elem_info *uinfo) |
| 1437 | { |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1438 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1439 | struct alc_spec *spec = codec->spec; |
| 1440 | static const char * const texts2[] = { |
| 1441 | "Disabled", "Enabled" |
| 1442 | }; |
| 1443 | static const char * const texts3[] = { |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1444 | "Disabled", "Speaker Only", "Line-Out+Speaker" |
| 1445 | }; |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1446 | const char * const *texts; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1447 | |
| 1448 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 1449 | uinfo->count = 1; |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1450 | if (spec->automute_hp_lo) { |
| 1451 | uinfo->value.enumerated.items = 3; |
| 1452 | texts = texts3; |
| 1453 | } else { |
| 1454 | uinfo->value.enumerated.items = 2; |
| 1455 | texts = texts2; |
| 1456 | } |
| 1457 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
| 1458 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1459 | strcpy(uinfo->value.enumerated.name, |
| 1460 | texts[uinfo->value.enumerated.item]); |
| 1461 | return 0; |
| 1462 | } |
| 1463 | |
| 1464 | static int alc_automute_mode_get(struct snd_kcontrol *kcontrol, |
| 1465 | struct snd_ctl_elem_value *ucontrol) |
| 1466 | { |
| 1467 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1468 | struct alc_spec *spec = codec->spec; |
| 1469 | unsigned int val; |
| 1470 | if (!spec->automute) |
| 1471 | val = 0; |
| 1472 | else if (!spec->automute_lines) |
| 1473 | val = 1; |
| 1474 | else |
| 1475 | val = 2; |
| 1476 | ucontrol->value.enumerated.item[0] = val; |
| 1477 | return 0; |
| 1478 | } |
| 1479 | |
| 1480 | static int alc_automute_mode_put(struct snd_kcontrol *kcontrol, |
| 1481 | struct snd_ctl_elem_value *ucontrol) |
| 1482 | { |
| 1483 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1484 | struct alc_spec *spec = codec->spec; |
| 1485 | |
| 1486 | switch (ucontrol->value.enumerated.item[0]) { |
| 1487 | case 0: |
| 1488 | if (!spec->automute) |
| 1489 | return 0; |
| 1490 | spec->automute = 0; |
| 1491 | break; |
| 1492 | case 1: |
| 1493 | if (spec->automute && !spec->automute_lines) |
| 1494 | return 0; |
| 1495 | spec->automute = 1; |
| 1496 | spec->automute_lines = 0; |
| 1497 | break; |
| 1498 | case 2: |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1499 | if (!spec->automute_hp_lo) |
| 1500 | return -EINVAL; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1501 | if (spec->automute && spec->automute_lines) |
| 1502 | return 0; |
| 1503 | spec->automute = 1; |
| 1504 | spec->automute_lines = 1; |
| 1505 | break; |
| 1506 | default: |
| 1507 | return -EINVAL; |
| 1508 | } |
| 1509 | update_speakers(codec); |
| 1510 | return 1; |
| 1511 | } |
| 1512 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 1513 | static const struct snd_kcontrol_new alc_automute_mode_enum = { |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1514 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1515 | .name = "Auto-Mute Mode", |
| 1516 | .info = alc_automute_mode_info, |
| 1517 | .get = alc_automute_mode_get, |
| 1518 | .put = alc_automute_mode_put, |
| 1519 | }; |
| 1520 | |
| 1521 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec); |
| 1522 | |
| 1523 | static int alc_add_automute_mode_enum(struct hda_codec *codec) |
| 1524 | { |
| 1525 | struct alc_spec *spec = codec->spec; |
| 1526 | struct snd_kcontrol_new *knew; |
| 1527 | |
| 1528 | knew = alc_kcontrol_new(spec); |
| 1529 | if (!knew) |
| 1530 | return -ENOMEM; |
| 1531 | *knew = alc_automute_mode_enum; |
| 1532 | knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL); |
| 1533 | if (!knew->name) |
| 1534 | return -ENOMEM; |
| 1535 | return 0; |
| 1536 | } |
| 1537 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1538 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1539 | { |
| 1540 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1541 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 1daf5f4 | 2011-04-28 17:57:46 +0200 | [diff] [blame] | 1542 | int present = 0; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1543 | int i; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1544 | |
Takashi Iwai | 1daf5f4 | 2011-04-28 17:57:46 +0200 | [diff] [blame] | 1545 | if (cfg->hp_pins[0]) |
| 1546 | present++; |
| 1547 | if (cfg->line_out_pins[0]) |
| 1548 | present++; |
| 1549 | if (cfg->speaker_pins[0]) |
| 1550 | present++; |
| 1551 | if (present < 2) /* need two different output types */ |
| 1552 | return; |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1553 | if (present == 3) |
| 1554 | spec->automute_hp_lo = 1; /* both HP and LO automute */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1555 | |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1556 | if (!cfg->speaker_pins[0]) { |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1557 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 1558 | sizeof(cfg->speaker_pins)); |
| 1559 | cfg->speaker_outs = cfg->line_outs; |
| 1560 | } |
| 1561 | |
| 1562 | if (!cfg->hp_pins[0]) { |
| 1563 | memcpy(cfg->hp_pins, cfg->line_out_pins, |
| 1564 | sizeof(cfg->hp_pins)); |
| 1565 | cfg->hp_outs = cfg->line_outs; |
| 1566 | } |
| 1567 | |
| 1568 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1569 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | 06dec22 | 2011-05-17 10:00:16 +0200 | [diff] [blame] | 1570 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1571 | continue; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1572 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1573 | nid); |
| 1574 | snd_hda_codec_write_cache(codec, nid, 0, |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1575 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1576 | AC_USRSP_EN | ALC880_HP_EVENT); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 1577 | spec->automute = 1; |
| 1578 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bb35feb | 2010-09-08 15:30:49 +0200 | [diff] [blame] | 1579 | } |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1580 | if (spec->automute && cfg->line_out_pins[0] && |
| 1581 | cfg->line_out_pins[0] != cfg->hp_pins[0] && |
| 1582 | cfg->line_out_pins[0] != cfg->speaker_pins[0]) { |
| 1583 | for (i = 0; i < cfg->line_outs; i++) { |
| 1584 | hda_nid_t nid = cfg->line_out_pins[i]; |
Takashi Iwai | 06dec22 | 2011-05-17 10:00:16 +0200 | [diff] [blame] | 1585 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1586 | continue; |
| 1587 | snd_printdd("realtek: Enable Line-Out auto-muting " |
| 1588 | "on NID 0x%x\n", nid); |
| 1589 | snd_hda_codec_write_cache(codec, nid, 0, |
| 1590 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1591 | AC_USRSP_EN | ALC880_FRONT_EVENT); |
| 1592 | spec->detect_line = 1; |
| 1593 | } |
Takashi Iwai | 52d3cb8 | 2011-05-17 10:04:08 +0200 | [diff] [blame] | 1594 | spec->automute_lines = spec->detect_line; |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1595 | } |
Takashi Iwai | ae8a60a | 2011-04-28 18:09:52 +0200 | [diff] [blame] | 1596 | |
| 1597 | if (spec->automute) { |
| 1598 | /* create a control for automute mode */ |
| 1599 | alc_add_automute_mode_enum(codec); |
| 1600 | spec->unsol_event = alc_sku_unsol_event; |
| 1601 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1602 | } |
| 1603 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1604 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1605 | { |
| 1606 | struct alc_spec *spec = codec->spec; |
| 1607 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1608 | hda_nid_t fixed, ext, dock; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1609 | int i; |
| 1610 | |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1611 | fixed = ext = dock = 0; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 1612 | for (i = 0; i < cfg->num_inputs; i++) { |
| 1613 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1614 | unsigned int defcfg; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1615 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1616 | switch (snd_hda_get_input_pin_attr(defcfg)) { |
| 1617 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1618 | if (fixed) |
| 1619 | return; /* already occupied */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1620 | if (cfg->inputs[i].type != AUTO_PIN_MIC) |
| 1621 | return; /* invalid type */ |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1622 | fixed = nid; |
| 1623 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1624 | case INPUT_PIN_ATTR_UNUSED: |
| 1625 | return; /* invalid entry */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1626 | case INPUT_PIN_ATTR_DOCK: |
| 1627 | if (dock) |
| 1628 | return; /* already occupied */ |
| 1629 | if (cfg->inputs[i].type > AUTO_PIN_LINE_IN) |
| 1630 | return; /* invalid type */ |
| 1631 | dock = nid; |
| 1632 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 1633 | default: |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1634 | if (ext) |
| 1635 | return; /* already occupied */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1636 | if (cfg->inputs[i].type != AUTO_PIN_MIC) |
| 1637 | return; /* invalid type */ |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1638 | ext = nid; |
| 1639 | break; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1640 | } |
| 1641 | } |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1642 | if (!ext && dock) { |
| 1643 | ext = dock; |
| 1644 | dock = 0; |
| 1645 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1646 | if (!ext || !fixed) |
| 1647 | return; |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 1648 | if (!is_jack_detectable(codec, ext)) |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1649 | return; /* no unsol support */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1650 | if (dock && !is_jack_detectable(codec, dock)) |
| 1651 | return; /* no unsol support */ |
| 1652 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n", |
| 1653 | ext, fixed, dock); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1654 | spec->ext_mic.pin = ext; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1655 | spec->dock_mic.pin = dock; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1656 | spec->int_mic.pin = fixed; |
| 1657 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 1658 | spec->dock_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1659 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1660 | spec->auto_mic = 1; |
| 1661 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1662 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1663 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1664 | spec->unsol_event = alc_sku_unsol_event; |
| 1665 | } |
| 1666 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1667 | /* Could be any non-zero and even value. When used as fixup, tells |
| 1668 | * the driver to ignore any present sku defines. |
| 1669 | */ |
| 1670 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 1671 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1672 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1673 | { |
| 1674 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1675 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1676 | struct alc_spec *spec = codec->spec; |
| 1677 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1678 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1679 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1680 | if (spec->cdefine.fixup) { |
| 1681 | ass = spec->cdefine.sku_cfg; |
| 1682 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1683 | return -1; |
| 1684 | goto do_sku; |
| 1685 | } |
| 1686 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1687 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1688 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1689 | goto do_sku; |
| 1690 | |
| 1691 | nid = 0x1d; |
| 1692 | if (codec->vendor_id == 0x10ec0260) |
| 1693 | nid = 0x17; |
| 1694 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1695 | |
| 1696 | if (!(ass & 1)) { |
| 1697 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1698 | codec->chip_name, ass); |
| 1699 | return -1; |
| 1700 | } |
| 1701 | |
| 1702 | /* check sum */ |
| 1703 | tmp = 0; |
| 1704 | for (i = 1; i < 16; i++) { |
| 1705 | if ((ass >> i) & 1) |
| 1706 | tmp++; |
| 1707 | } |
| 1708 | if (((ass >> 16) & 0xf) != tmp) |
| 1709 | return -1; |
| 1710 | |
| 1711 | spec->cdefine.port_connectivity = ass >> 30; |
| 1712 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1713 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1714 | spec->cdefine.customization = ass >> 8; |
| 1715 | do_sku: |
| 1716 | spec->cdefine.sku_cfg = ass; |
| 1717 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1718 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1719 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1720 | spec->cdefine.override = ass & 0x1; |
| 1721 | |
| 1722 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1723 | nid, spec->cdefine.sku_cfg); |
| 1724 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1725 | spec->cdefine.port_connectivity); |
| 1726 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1727 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1728 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1729 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1730 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1731 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1732 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1733 | |
| 1734 | return 0; |
| 1735 | } |
| 1736 | |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 1737 | static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) |
| 1738 | { |
| 1739 | int i; |
| 1740 | for (i = 0; i < nums; i++) |
| 1741 | if (list[i] == nid) |
| 1742 | return true; |
| 1743 | return false; |
| 1744 | } |
| 1745 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1746 | /* check subsystem ID and set up device-specific initialization; |
| 1747 | * return 1 if initialized, 0 if invalid SSID |
| 1748 | */ |
| 1749 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1750 | * 31 ~ 16 : Manufacture ID |
| 1751 | * 15 ~ 8 : SKU ID |
| 1752 | * 7 ~ 0 : Assembly ID |
| 1753 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1754 | */ |
| 1755 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1756 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1757 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1758 | { |
| 1759 | unsigned int ass, tmp, i; |
| 1760 | unsigned nid; |
| 1761 | struct alc_spec *spec = codec->spec; |
| 1762 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 1763 | if (spec->cdefine.fixup) { |
| 1764 | ass = spec->cdefine.sku_cfg; |
| 1765 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 1766 | return 0; |
| 1767 | goto do_sku; |
| 1768 | } |
| 1769 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1770 | ass = codec->subsystem_id & 0xffff; |
| 1771 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1772 | goto do_sku; |
| 1773 | |
| 1774 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1775 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1776 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1777 | * 29~21 : reserve |
| 1778 | * 20 : PCBEEP input |
| 1779 | * 19~16 : Check sum (15:1) |
| 1780 | * 15~1 : Custom |
| 1781 | * 0 : override |
| 1782 | */ |
| 1783 | nid = 0x1d; |
| 1784 | if (codec->vendor_id == 0x10ec0260) |
| 1785 | nid = 0x17; |
| 1786 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1787 | snd_printd("realtek: No valid SSID, " |
| 1788 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1789 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1790 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1791 | return 0; |
| 1792 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1793 | return 0; |
| 1794 | |
| 1795 | /* check sum */ |
| 1796 | tmp = 0; |
| 1797 | for (i = 1; i < 16; i++) { |
| 1798 | if ((ass >> i) & 1) |
| 1799 | tmp++; |
| 1800 | } |
| 1801 | if (((ass >> 16) & 0xf) != tmp) |
| 1802 | return 0; |
| 1803 | do_sku: |
| 1804 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1805 | ass & 0xffff, codec->vendor_id); |
| 1806 | /* |
| 1807 | * 0 : override |
| 1808 | * 1 : Swap Jack |
| 1809 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1810 | * 3~5 : External Amplifier control |
| 1811 | * 7~6 : Reserved |
| 1812 | */ |
| 1813 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1814 | switch (tmp) { |
| 1815 | case 1: |
| 1816 | spec->init_amp = ALC_INIT_GPIO1; |
| 1817 | break; |
| 1818 | case 3: |
| 1819 | spec->init_amp = ALC_INIT_GPIO2; |
| 1820 | break; |
| 1821 | case 7: |
| 1822 | spec->init_amp = ALC_INIT_GPIO3; |
| 1823 | break; |
| 1824 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 1825 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1826 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1827 | break; |
| 1828 | } |
| 1829 | |
| 1830 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1831 | * when the external headphone out jack is plugged" |
| 1832 | */ |
| 1833 | if (!(ass & 0x8000)) |
| 1834 | return 1; |
| 1835 | /* |
| 1836 | * 10~8 : Jack location |
| 1837 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1838 | * 14~13: Resvered |
| 1839 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1840 | * when the external headphone out jack is plugged" |
| 1841 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1842 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1843 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1844 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1845 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1846 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1847 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1848 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1849 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1850 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1851 | else if (tmp == 3) |
| 1852 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1853 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1854 | return 1; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 1855 | if (found_in_nid_list(nid, spec->autocfg.line_out_pins, |
| 1856 | spec->autocfg.line_outs)) |
| 1857 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1858 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1859 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1860 | return 1; |
| 1861 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1862 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1863 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1864 | hda_nid_t porta, hda_nid_t porte, |
| 1865 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1866 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1867 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1868 | struct alc_spec *spec = codec->spec; |
| 1869 | snd_printd("realtek: " |
| 1870 | "Enable default setup for auto mode as fallback\n"); |
| 1871 | spec->init_amp = ALC_INIT_DEFAULT; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1872 | } |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 1873 | |
| 1874 | alc_init_auto_hp(codec); |
| 1875 | alc_init_auto_mic(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1876 | } |
| 1877 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1878 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1879 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1880 | */ |
| 1881 | |
| 1882 | struct alc_pincfg { |
| 1883 | hda_nid_t nid; |
| 1884 | u32 val; |
| 1885 | }; |
| 1886 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1887 | struct alc_model_fixup { |
| 1888 | const int id; |
| 1889 | const char *name; |
| 1890 | }; |
| 1891 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1892 | struct alc_fixup { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1893 | int type; |
Takashi Iwai | 361fe6e | 2011-01-14 09:55:32 +0100 | [diff] [blame] | 1894 | bool chained; |
| 1895 | int chain_id; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1896 | union { |
| 1897 | unsigned int sku; |
| 1898 | const struct alc_pincfg *pins; |
| 1899 | const struct hda_verb *verbs; |
| 1900 | void (*func)(struct hda_codec *codec, |
| 1901 | const struct alc_fixup *fix, |
| 1902 | int action); |
| 1903 | } v; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1904 | }; |
| 1905 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1906 | enum { |
| 1907 | ALC_FIXUP_INVALID, |
| 1908 | ALC_FIXUP_SKU, |
| 1909 | ALC_FIXUP_PINS, |
| 1910 | ALC_FIXUP_VERBS, |
| 1911 | ALC_FIXUP_FUNC, |
| 1912 | }; |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1913 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1914 | enum { |
| 1915 | ALC_FIXUP_ACT_PRE_PROBE, |
| 1916 | ALC_FIXUP_ACT_PROBE, |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 1917 | ALC_FIXUP_ACT_INIT, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1918 | }; |
| 1919 | |
| 1920 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1921 | { |
| 1922 | struct alc_spec *spec = codec->spec; |
| 1923 | int id = spec->fixup_id; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1924 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1925 | const char *modelname = spec->fixup_name; |
Takashi Iwai | aa1d0c5 | 2011-01-19 17:27:58 +0100 | [diff] [blame] | 1926 | #endif |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1927 | int depth = 0; |
| 1928 | |
| 1929 | if (!spec->fixup_list) |
| 1930 | return; |
| 1931 | |
| 1932 | while (id >= 0) { |
| 1933 | const struct alc_fixup *fix = spec->fixup_list + id; |
| 1934 | const struct alc_pincfg *cfg; |
| 1935 | |
| 1936 | switch (fix->type) { |
| 1937 | case ALC_FIXUP_SKU: |
| 1938 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
| 1939 | break;; |
| 1940 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1941 | "Apply sku override for %s\n", |
| 1942 | codec->chip_name, modelname); |
| 1943 | spec->cdefine.sku_cfg = fix->v.sku; |
| 1944 | spec->cdefine.fixup = 1; |
| 1945 | break; |
| 1946 | case ALC_FIXUP_PINS: |
| 1947 | cfg = fix->v.pins; |
| 1948 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg) |
| 1949 | break; |
| 1950 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1951 | "Apply pincfg for %s\n", |
| 1952 | codec->chip_name, modelname); |
| 1953 | for (; cfg->nid; cfg++) |
| 1954 | snd_hda_codec_set_pincfg(codec, cfg->nid, |
| 1955 | cfg->val); |
| 1956 | break; |
| 1957 | case ALC_FIXUP_VERBS: |
| 1958 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| 1959 | break; |
| 1960 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1961 | "Apply fix-verbs for %s\n", |
| 1962 | codec->chip_name, modelname); |
| 1963 | add_verb(codec->spec, fix->v.verbs); |
| 1964 | break; |
| 1965 | case ALC_FIXUP_FUNC: |
| 1966 | if (!fix->v.func) |
| 1967 | break; |
| 1968 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1969 | "Apply fix-func for %s\n", |
| 1970 | codec->chip_name, modelname); |
| 1971 | fix->v.func(codec, fix, action); |
| 1972 | break; |
| 1973 | default: |
| 1974 | snd_printk(KERN_ERR "hda_codec: %s: " |
| 1975 | "Invalid fixup type %d\n", |
| 1976 | codec->chip_name, fix->type); |
| 1977 | break; |
| 1978 | } |
Takashi Iwai | 24af2b1 | 2011-05-02 13:55:36 +0200 | [diff] [blame] | 1979 | if (!fix->chained) |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1980 | break; |
| 1981 | if (++depth > 10) |
| 1982 | break; |
Takashi Iwai | 24af2b1 | 2011-05-02 13:55:36 +0200 | [diff] [blame] | 1983 | id = fix->chain_id; |
Takashi Iwai | 9d57883 | 2010-11-22 13:29:19 +0100 | [diff] [blame] | 1984 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1985 | } |
| 1986 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1987 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1988 | const struct alc_model_fixup *models, |
| 1989 | const struct snd_pci_quirk *quirk, |
| 1990 | const struct alc_fixup *fixlist) |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1991 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1992 | struct alc_spec *spec = codec->spec; |
| 1993 | int id = -1; |
| 1994 | const char *name = NULL; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1995 | |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 1996 | if (codec->modelname && models) { |
| 1997 | while (models->name) { |
| 1998 | if (!strcmp(codec->modelname, models->name)) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 1999 | id = models->id; |
| 2000 | name = models->name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 2001 | break; |
| 2002 | } |
| 2003 | models++; |
| 2004 | } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 2005 | } |
| 2006 | if (id < 0) { |
| 2007 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 2008 | if (quirk) { |
| 2009 | id = quirk->value; |
| 2010 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 2011 | name = quirk->name; |
| 2012 | #endif |
| 2013 | } |
| 2014 | } |
| 2015 | |
| 2016 | spec->fixup_id = id; |
| 2017 | if (id >= 0) { |
| 2018 | spec->fixup_list = fixlist; |
| 2019 | spec->fixup_name = name; |
Todd Broch | e1eb5f1 | 2010-12-06 11:19:51 -0800 | [diff] [blame] | 2020 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 2021 | } |
| 2022 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 2023 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 2024 | unsigned int coef_idx) |
| 2025 | { |
| 2026 | unsigned int val; |
| 2027 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 2028 | coef_idx); |
| 2029 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 2030 | AC_VERB_GET_PROC_COEF, 0); |
| 2031 | return val; |
| 2032 | } |
| 2033 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 2034 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 2035 | unsigned int coef_val) |
| 2036 | { |
| 2037 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 2038 | coef_idx); |
| 2039 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 2040 | coef_val); |
| 2041 | } |
| 2042 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 2043 | /* set right pin controls for digital I/O */ |
| 2044 | static void alc_auto_init_digital(struct hda_codec *codec) |
| 2045 | { |
| 2046 | struct alc_spec *spec = codec->spec; |
| 2047 | int i; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 2048 | hda_nid_t pin, dac; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 2049 | |
| 2050 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 2051 | pin = spec->autocfg.dig_out_pins[i]; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 2052 | if (!pin) |
| 2053 | continue; |
| 2054 | snd_hda_codec_write(codec, pin, 0, |
| 2055 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 2056 | if (!i) |
| 2057 | dac = spec->multiout.dig_out_nid; |
| 2058 | else |
| 2059 | dac = spec->slave_dig_outs[i - 1]; |
| 2060 | if (!dac || !(get_wcaps(codec, dac) & AC_WCAP_OUT_AMP)) |
| 2061 | continue; |
| 2062 | snd_hda_codec_write(codec, dac, 0, |
| 2063 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 2064 | AMP_OUT_UNMUTE); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 2065 | } |
| 2066 | pin = spec->autocfg.dig_in_pin; |
| 2067 | if (pin) |
| 2068 | snd_hda_codec_write(codec, pin, 0, |
| 2069 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2070 | PIN_IN); |
| 2071 | } |
| 2072 | |
| 2073 | /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */ |
| 2074 | static void alc_auto_parse_digital(struct hda_codec *codec) |
| 2075 | { |
| 2076 | struct alc_spec *spec = codec->spec; |
| 2077 | int i, err; |
| 2078 | hda_nid_t dig_nid; |
| 2079 | |
| 2080 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
| 2081 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 2082 | err = snd_hda_get_connections(codec, |
| 2083 | spec->autocfg.dig_out_pins[i], |
| 2084 | &dig_nid, 1); |
| 2085 | if (err < 0) |
| 2086 | continue; |
| 2087 | if (!i) { |
| 2088 | spec->multiout.dig_out_nid = dig_nid; |
| 2089 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 2090 | } else { |
| 2091 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 2092 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 2093 | break; |
| 2094 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 2095 | } |
| 2096 | } |
| 2097 | |
| 2098 | if (spec->autocfg.dig_in_pin) { |
Takashi Iwai | 01fdf18 | 2010-09-24 09:09:42 +0200 | [diff] [blame] | 2099 | dig_nid = codec->start_nid; |
| 2100 | for (i = 0; i < codec->num_nodes; i++, dig_nid++) { |
| 2101 | unsigned int wcaps = get_wcaps(codec, dig_nid); |
| 2102 | if (get_wcaps_type(wcaps) != AC_WID_AUD_IN) |
| 2103 | continue; |
| 2104 | if (!(wcaps & AC_WCAP_DIGITAL)) |
| 2105 | continue; |
| 2106 | if (!(wcaps & AC_WCAP_CONN_LIST)) |
| 2107 | continue; |
| 2108 | err = get_connection_index(codec, dig_nid, |
| 2109 | spec->autocfg.dig_in_pin); |
| 2110 | if (err >= 0) { |
| 2111 | spec->dig_in_nid = dig_nid; |
| 2112 | break; |
| 2113 | } |
| 2114 | } |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 2115 | } |
| 2116 | } |
| 2117 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 2118 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2119 | * ALC888 |
| 2120 | */ |
| 2121 | |
| 2122 | /* |
| 2123 | * 2ch mode |
| 2124 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2125 | static const struct hda_verb alc888_4ST_ch2_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2126 | /* Mic-in jack as mic in */ |
| 2127 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2128 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2129 | /* Line-in jack as Line in */ |
| 2130 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2131 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2132 | /* Line-Out as Front */ |
| 2133 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2134 | { } /* end */ |
| 2135 | }; |
| 2136 | |
| 2137 | /* |
| 2138 | * 4ch mode |
| 2139 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2140 | static const struct hda_verb alc888_4ST_ch4_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2141 | /* Mic-in jack as mic in */ |
| 2142 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2143 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2144 | /* Line-in jack as Surround */ |
| 2145 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2146 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2147 | /* Line-Out as Front */ |
| 2148 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2149 | { } /* end */ |
| 2150 | }; |
| 2151 | |
| 2152 | /* |
| 2153 | * 6ch mode |
| 2154 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2155 | static const struct hda_verb alc888_4ST_ch6_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2156 | /* Mic-in jack as CLFE */ |
| 2157 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2158 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2159 | /* Line-in jack as Surround */ |
| 2160 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2161 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2162 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 2163 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2164 | { } /* end */ |
| 2165 | }; |
| 2166 | |
| 2167 | /* |
| 2168 | * 8ch mode |
| 2169 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2170 | static const struct hda_verb alc888_4ST_ch8_intel_init[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2171 | /* Mic-in jack as CLFE */ |
| 2172 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2173 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2174 | /* Line-in jack as Surround */ |
| 2175 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2176 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2177 | /* Line-Out as Side */ |
| 2178 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2179 | { } /* end */ |
| 2180 | }; |
| 2181 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2182 | static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2183 | { 2, alc888_4ST_ch2_intel_init }, |
| 2184 | { 4, alc888_4ST_ch4_intel_init }, |
| 2185 | { 6, alc888_4ST_ch6_intel_init }, |
| 2186 | { 8, alc888_4ST_ch8_intel_init }, |
| 2187 | }; |
| 2188 | |
| 2189 | /* |
| 2190 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 2191 | */ |
| 2192 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2193 | static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2194 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2195 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2196 | /* Connect Internal HP to Front */ |
| 2197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2198 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2199 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2200 | /* Connect Bass HP to Front */ |
| 2201 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2202 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2203 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2204 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 2205 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2206 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2207 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2208 | /* Connect Mic jack to CLFE */ |
| 2209 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2210 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2211 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2212 | /* Connect Line-in jack to Surround */ |
| 2213 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2214 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2215 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2216 | /* Connect HP out jack to Front */ |
| 2217 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2218 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2219 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2220 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 2221 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2222 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2223 | {} |
| 2224 | }; |
| 2225 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2226 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2227 | { |
| 2228 | struct alc_spec *spec = codec->spec; |
| 2229 | |
| 2230 | spec->autocfg.hp_pins[0] = 0x15; |
| 2231 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2232 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2233 | spec->autocfg.speaker_pins[2] = 0x17; |
| 2234 | spec->autocfg.speaker_pins[3] = 0x19; |
| 2235 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2236 | spec->automute = 1; |
| 2237 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2238 | } |
| 2239 | |
| 2240 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 2241 | { |
| 2242 | alc889_coef_init(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2243 | alc_hp_automute(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 2244 | } |
| 2245 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2246 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2247 | { |
| 2248 | struct alc_spec *spec = codec->spec; |
| 2249 | |
| 2250 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 2251 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 2252 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 2253 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2254 | spec->automute = 1; |
| 2255 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2256 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2257 | |
| 2258 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2259 | * ALC888 Acer Aspire 4930G model |
| 2260 | */ |
| 2261 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2262 | static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2263 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2264 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2265 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 2267 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2268 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2269 | /* Connect Internal HP to front */ |
| 2270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2271 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2272 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2273 | /* Connect HP out to front */ |
| 2274 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2275 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2276 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e2e9329 | 2011-01-12 08:03:39 +0100 | [diff] [blame] | 2277 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2278 | { } |
| 2279 | }; |
| 2280 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2281 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2282 | * ALC888 Acer Aspire 6530G model |
| 2283 | */ |
| 2284 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2285 | static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2286 | /* Route to built-in subwoofer as well as speakers */ |
| 2287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2289 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2290 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2291 | /* Bias voltage on for external mic port */ |
| 2292 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2293 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2294 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2295 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2296 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2297 | /* Enable unsolicited event for HP jack */ |
| 2298 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2299 | /* Enable speaker output */ |
| 2300 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2301 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2302 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2303 | /* Enable headphone output */ |
| 2304 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2305 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2306 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 2307 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2308 | { } |
| 2309 | }; |
| 2310 | |
| 2311 | /* |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2312 | *ALC888 Acer Aspire 7730G model |
| 2313 | */ |
| 2314 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2315 | static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2316 | /* Bias voltage on for external mic port */ |
| 2317 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
| 2318 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2319 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2320 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2321 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2322 | /* Enable unsolicited event for HP jack */ |
| 2323 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2324 | /* Enable speaker output */ |
| 2325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2326 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2327 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2328 | /* Enable headphone output */ |
| 2329 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 2330 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2331 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2332 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2333 | /*Enable internal subwoofer */ |
| 2334 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2335 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2336 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2337 | {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 2338 | { } |
| 2339 | }; |
| 2340 | |
| 2341 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2342 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2343 | */ |
| 2344 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2345 | static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2346 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 2347 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2348 | /* Unselect Front Mic by default in input mixer 3 */ |
| 2349 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 2350 | /* Enable unsolicited event for HP jack */ |
| 2351 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 2352 | /* Connect Internal Front to Front */ |
| 2353 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2354 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2355 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2356 | /* Connect Internal Rear to Rear */ |
| 2357 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2358 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2359 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2360 | /* Connect Internal CLFE to CLFE */ |
| 2361 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2362 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2363 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2364 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2365 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2366 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2367 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2368 | /* Enable all DACs */ |
| 2369 | /* DAC DISABLE/MUTE 1? */ |
| 2370 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 2371 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 2372 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 2373 | /* DAC DISABLE/MUTE 2? */ |
| 2374 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 2375 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 2376 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2377 | /* DMIC fix |
| 2378 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 2379 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 2380 | * makes the signal become a difference/sum signal instead of standard |
| 2381 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 2382 | * codec replicate the sum signal to both channels, turning it into a |
| 2383 | * normal mono mic. |
| 2384 | */ |
| 2385 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 2386 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 2387 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2388 | { } |
| 2389 | }; |
| 2390 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2391 | static const struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2392 | /* Front mic only available on one ADC */ |
| 2393 | { |
| 2394 | .num_items = 4, |
| 2395 | .items = { |
| 2396 | { "Mic", 0x0 }, |
| 2397 | { "Line", 0x2 }, |
| 2398 | { "CD", 0x4 }, |
| 2399 | { "Front Mic", 0xb }, |
| 2400 | }, |
| 2401 | }, |
| 2402 | { |
| 2403 | .num_items = 3, |
| 2404 | .items = { |
| 2405 | { "Mic", 0x0 }, |
| 2406 | { "Line", 0x2 }, |
| 2407 | { "CD", 0x4 }, |
| 2408 | }, |
| 2409 | } |
| 2410 | }; |
| 2411 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2412 | static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2413 | /* Interal mic only available on one ADC */ |
| 2414 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2415 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2416 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2417 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2418 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2419 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2420 | { "Input Mix", 0xa }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 2421 | { "Internal Mic", 0xb }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2422 | }, |
| 2423 | }, |
| 2424 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2425 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2426 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 2427 | { "Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2428 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2429 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 2430 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 2431 | }, |
| 2432 | } |
| 2433 | }; |
| 2434 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2435 | static const struct hda_input_mux alc889_capture_sources[3] = { |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 2436 | /* Digital mic only available on first "ADC" */ |
| 2437 | { |
| 2438 | .num_items = 5, |
| 2439 | .items = { |
| 2440 | { "Mic", 0x0 }, |
| 2441 | { "Line", 0x2 }, |
| 2442 | { "CD", 0x4 }, |
| 2443 | { "Front Mic", 0xb }, |
| 2444 | { "Input Mix", 0xa }, |
| 2445 | }, |
| 2446 | }, |
| 2447 | { |
| 2448 | .num_items = 4, |
| 2449 | .items = { |
| 2450 | { "Mic", 0x0 }, |
| 2451 | { "Line", 0x2 }, |
| 2452 | { "CD", 0x4 }, |
| 2453 | { "Input Mix", 0xa }, |
| 2454 | }, |
| 2455 | }, |
| 2456 | { |
| 2457 | .num_items = 4, |
| 2458 | .items = { |
| 2459 | { "Mic", 0x0 }, |
| 2460 | { "Line", 0x2 }, |
| 2461 | { "CD", 0x4 }, |
| 2462 | { "Input Mix", 0xa }, |
| 2463 | }, |
| 2464 | } |
| 2465 | }; |
| 2466 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2467 | static const struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2468 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2469 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2470 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2471 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2472 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2473 | HDA_OUTPUT), |
| 2474 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2475 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2476 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2477 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2478 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2480 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2481 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2482 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2484 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2486 | { } /* end */ |
| 2487 | }; |
| 2488 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2489 | static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2490 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2491 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2492 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2493 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2494 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 2495 | HDA_OUTPUT), |
Łukasz Wojniłowicz | 786c51f | 2011-02-24 10:03:31 +0100 | [diff] [blame] | 2496 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2497 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2498 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2499 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
| 2500 | 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] | 2501 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2502 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2504 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2505 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2506 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 2507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2508 | { } /* end */ |
| 2509 | }; |
| 2510 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2511 | static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2512 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2513 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2514 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2515 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2516 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 2517 | HDA_OUTPUT), |
| 2518 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2519 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2520 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2521 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2522 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2523 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 2524 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 2525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2526 | { } /* end */ |
| 2527 | }; |
| 2528 | |
| 2529 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2530 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2531 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2532 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2533 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2534 | spec->autocfg.hp_pins[0] = 0x15; |
| 2535 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 2536 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2537 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2538 | spec->automute = 1; |
| 2539 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2540 | } |
| 2541 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2542 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2543 | { |
| 2544 | struct alc_spec *spec = codec->spec; |
| 2545 | |
| 2546 | spec->autocfg.hp_pins[0] = 0x15; |
| 2547 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2548 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2549 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2550 | spec->automute = 1; |
| 2551 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 2552 | } |
| 2553 | |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2554 | static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) |
| 2555 | { |
| 2556 | struct alc_spec *spec = codec->spec; |
| 2557 | |
| 2558 | spec->autocfg.hp_pins[0] = 0x15; |
| 2559 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2560 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2561 | spec->autocfg.speaker_pins[2] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2562 | spec->automute = 1; |
| 2563 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 2564 | } |
| 2565 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2566 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2567 | { |
| 2568 | struct alc_spec *spec = codec->spec; |
| 2569 | |
| 2570 | spec->autocfg.hp_pins[0] = 0x15; |
| 2571 | spec->autocfg.speaker_pins[0] = 0x14; |
| 2572 | spec->autocfg.speaker_pins[1] = 0x16; |
| 2573 | spec->autocfg.speaker_pins[2] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 2574 | spec->automute = 1; |
| 2575 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 2576 | } |
| 2577 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 2578 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2579 | * ALC880 3-stack model |
| 2580 | * |
| 2581 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2582 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 2583 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2584 | */ |
| 2585 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2586 | static const hda_nid_t alc880_dac_nids[4] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | /* front, rear, clfe, rear_surr */ |
| 2588 | 0x02, 0x05, 0x04, 0x03 |
| 2589 | }; |
| 2590 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2591 | static const hda_nid_t alc880_adc_nids[3] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2592 | /* ADC0-2 */ |
| 2593 | 0x07, 0x08, 0x09, |
| 2594 | }; |
| 2595 | |
| 2596 | /* The datasheet says the node 0x07 is connected from inputs, |
| 2597 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2598 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2599 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2600 | static const hda_nid_t alc880_adc_nids_alt[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2601 | /* ADC1-2 */ |
| 2602 | 0x08, 0x09, |
| 2603 | }; |
| 2604 | |
| 2605 | #define ALC880_DIGOUT_NID 0x06 |
| 2606 | #define ALC880_DIGIN_NID 0x0a |
| 2607 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2608 | static const struct hda_input_mux alc880_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2609 | .num_items = 4, |
| 2610 | .items = { |
| 2611 | { "Mic", 0x0 }, |
| 2612 | { "Front Mic", 0x3 }, |
| 2613 | { "Line", 0x2 }, |
| 2614 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2615 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2616 | }; |
| 2617 | |
| 2618 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2619 | /* 2ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2620 | static const struct hda_verb alc880_threestack_ch2_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2621 | /* set line-in to input, mute it */ |
| 2622 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2623 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2624 | /* set mic-in to input vref 80%, mute it */ |
| 2625 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2626 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2627 | { } /* end */ |
| 2628 | }; |
| 2629 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2630 | /* 6ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2631 | static const struct hda_verb alc880_threestack_ch6_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2632 | /* set line-in to output, unmute it */ |
| 2633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2635 | /* set mic-in to output, unmute it */ |
| 2636 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2637 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2638 | { } /* end */ |
| 2639 | }; |
| 2640 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2641 | static const struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2642 | { 2, alc880_threestack_ch2_init }, |
| 2643 | { 6, alc880_threestack_ch6_init }, |
| 2644 | }; |
| 2645 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2646 | static const struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2647 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2648 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2649 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2650 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2651 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2652 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2653 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2654 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2655 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2656 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2657 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2658 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2661 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2662 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2663 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2664 | { |
| 2665 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2666 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2667 | .info = alc_ch_mode_info, |
| 2668 | .get = alc_ch_mode_get, |
| 2669 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | }, |
| 2671 | { } /* end */ |
| 2672 | }; |
| 2673 | |
| 2674 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2675 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2676 | struct snd_ctl_elem_info *uinfo) |
| 2677 | { |
| 2678 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2679 | struct alc_spec *spec = codec->spec; |
| 2680 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2681 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2682 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2683 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2684 | HDA_INPUT); |
| 2685 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2686 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2687 | return err; |
| 2688 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2689 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2690 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2691 | unsigned int size, unsigned int __user *tlv) |
| 2692 | { |
| 2693 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2694 | struct alc_spec *spec = codec->spec; |
| 2695 | int err; |
| 2696 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2697 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2698 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2699 | HDA_INPUT); |
| 2700 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2701 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2702 | return err; |
| 2703 | } |
| 2704 | |
| 2705 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2706 | struct snd_ctl_elem_value *ucontrol); |
| 2707 | |
| 2708 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2709 | struct snd_ctl_elem_value *ucontrol, |
| 2710 | getput_call_t func) |
| 2711 | { |
| 2712 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2713 | struct alc_spec *spec = codec->spec; |
| 2714 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2715 | int err; |
| 2716 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2717 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2718 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2719 | 3, 0, HDA_INPUT); |
| 2720 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2721 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2722 | return err; |
| 2723 | } |
| 2724 | |
| 2725 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2726 | struct snd_ctl_elem_value *ucontrol) |
| 2727 | { |
| 2728 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2729 | snd_hda_mixer_amp_volume_get); |
| 2730 | } |
| 2731 | |
| 2732 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2733 | struct snd_ctl_elem_value *ucontrol) |
| 2734 | { |
| 2735 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2736 | snd_hda_mixer_amp_volume_put); |
| 2737 | } |
| 2738 | |
| 2739 | /* capture mixer elements */ |
| 2740 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2741 | |
| 2742 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2743 | struct snd_ctl_elem_value *ucontrol) |
| 2744 | { |
| 2745 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2746 | snd_hda_mixer_amp_switch_get); |
| 2747 | } |
| 2748 | |
| 2749 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2750 | struct snd_ctl_elem_value *ucontrol) |
| 2751 | { |
| 2752 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2753 | snd_hda_mixer_amp_switch_put); |
| 2754 | } |
| 2755 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2756 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2757 | { \ |
| 2758 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2759 | .name = "Capture Switch", \ |
| 2760 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2761 | .count = num, \ |
| 2762 | .info = alc_cap_sw_info, \ |
| 2763 | .get = alc_cap_sw_get, \ |
| 2764 | .put = alc_cap_sw_put, \ |
| 2765 | }, \ |
| 2766 | { \ |
| 2767 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2768 | .name = "Capture Volume", \ |
| 2769 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2770 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2771 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2772 | .count = num, \ |
| 2773 | .info = alc_cap_vol_info, \ |
| 2774 | .get = alc_cap_vol_get, \ |
| 2775 | .put = alc_cap_vol_put, \ |
| 2776 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2777 | } |
| 2778 | |
| 2779 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2780 | { \ |
| 2781 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2782 | /* .name = "Capture Source", */ \ |
| 2783 | .name = "Input Source", \ |
| 2784 | .count = num, \ |
| 2785 | .info = alc_mux_enum_info, \ |
| 2786 | .get = alc_mux_enum_get, \ |
| 2787 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2788 | } |
| 2789 | |
| 2790 | #define DEFINE_CAPMIX(num) \ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2791 | static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2792 | _DEFINE_CAPMIX(num), \ |
| 2793 | _DEFINE_CAPSRC(num), \ |
| 2794 | { } /* end */ \ |
| 2795 | } |
| 2796 | |
| 2797 | #define DEFINE_CAPMIX_NOSRC(num) \ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2798 | static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2799 | _DEFINE_CAPMIX(num), \ |
| 2800 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | /* up to three ADCs */ |
| 2804 | DEFINE_CAPMIX(1); |
| 2805 | DEFINE_CAPMIX(2); |
| 2806 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2807 | DEFINE_CAPMIX_NOSRC(1); |
| 2808 | DEFINE_CAPMIX_NOSRC(2); |
| 2809 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2810 | |
| 2811 | /* |
| 2812 | * ALC880 5-stack model |
| 2813 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2814 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2815 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2816 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2817 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2818 | */ |
| 2819 | |
| 2820 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2821 | static const struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2822 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2823 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2824 | { } /* end */ |
| 2825 | }; |
| 2826 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2827 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2828 | /* 6ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2829 | static const struct hda_verb alc880_fivestack_ch6_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2830 | /* set line-in to input, mute it */ |
| 2831 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2832 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2833 | { } /* end */ |
| 2834 | }; |
| 2835 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2836 | /* 8ch mode */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2837 | static const struct hda_verb alc880_fivestack_ch8_init[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2838 | /* set line-in to output, unmute it */ |
| 2839 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2840 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2841 | { } /* end */ |
| 2842 | }; |
| 2843 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2844 | static const struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2845 | { 6, alc880_fivestack_ch6_init }, |
| 2846 | { 8, alc880_fivestack_ch8_init }, |
| 2847 | }; |
| 2848 | |
| 2849 | |
| 2850 | /* |
| 2851 | * ALC880 6-stack model |
| 2852 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2853 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2854 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2855 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2856 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2857 | */ |
| 2858 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2859 | static const hda_nid_t alc880_6st_dac_nids[4] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2860 | /* front, rear, clfe, rear_surr */ |
| 2861 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2862 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2863 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2864 | static const struct hda_input_mux alc880_6stack_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2865 | .num_items = 4, |
| 2866 | .items = { |
| 2867 | { "Mic", 0x0 }, |
| 2868 | { "Front Mic", 0x1 }, |
| 2869 | { "Line", 0x2 }, |
| 2870 | { "CD", 0x4 }, |
| 2871 | }, |
| 2872 | }; |
| 2873 | |
| 2874 | /* fixed 8-channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2875 | static const struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2876 | { 8, NULL }, |
| 2877 | }; |
| 2878 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2879 | static const struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2880 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2881 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2882 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2883 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2884 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2885 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2886 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2887 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2888 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2889 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2890 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2891 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2892 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2893 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2896 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2897 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2898 | { |
| 2899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2900 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2901 | .info = alc_ch_mode_info, |
| 2902 | .get = alc_ch_mode_get, |
| 2903 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2904 | }, |
| 2905 | { } /* end */ |
| 2906 | }; |
| 2907 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2908 | |
| 2909 | /* |
| 2910 | * ALC880 W810 model |
| 2911 | * |
| 2912 | * W810 has rear IO for: |
| 2913 | * Front (DAC 02) |
| 2914 | * Surround (DAC 03) |
| 2915 | * Center/LFE (DAC 04) |
| 2916 | * Digital out (06) |
| 2917 | * |
| 2918 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2919 | * 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] | 2920 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2921 | * There is a variable resistor to control the speaker or headphone |
| 2922 | * volume. This is a hardware-only device without a software API. |
| 2923 | * |
| 2924 | * Plugging headphones in will disable the internal speakers. This is |
| 2925 | * implemented in hardware, not via the driver using jack sense. In |
| 2926 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2927 | * disable both the speakers and headphones. |
| 2928 | * |
| 2929 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2930 | * These may not do anything useful with this driver yet, because I |
| 2931 | * haven't setup any initialization verbs for these yet... |
| 2932 | */ |
| 2933 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2934 | static const hda_nid_t alc880_w810_dac_nids[3] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2935 | /* front, rear/surround, clfe */ |
| 2936 | 0x02, 0x03, 0x04 |
| 2937 | }; |
| 2938 | |
| 2939 | /* fixed 6 channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2940 | static const struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2941 | { 6, NULL } |
| 2942 | }; |
| 2943 | |
| 2944 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2945 | static const struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2946 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2947 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2948 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2949 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2950 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2951 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2952 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2953 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2954 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2955 | { } /* end */ |
| 2956 | }; |
| 2957 | |
| 2958 | |
| 2959 | /* |
| 2960 | * Z710V model |
| 2961 | * |
| 2962 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2963 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2964 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2965 | */ |
| 2966 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2967 | static const hda_nid_t alc880_z71v_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2968 | 0x02 |
| 2969 | }; |
| 2970 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2971 | |
| 2972 | /* fixed 2 channels */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2973 | static const struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2974 | { 2, NULL } |
| 2975 | }; |
| 2976 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2977 | static const struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2978 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2979 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2980 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2981 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2982 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2983 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2984 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2985 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2986 | { } /* end */ |
| 2987 | }; |
| 2988 | |
| 2989 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2990 | /* |
| 2991 | * ALC880 F1734 model |
| 2992 | * |
| 2993 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2994 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2995 | */ |
| 2996 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 2997 | static const hda_nid_t alc880_f1734_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2998 | 0x03 |
| 2999 | }; |
| 3000 | #define ALC880_F1734_HP_DAC 0x02 |
| 3001 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3002 | static const struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3003 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3004 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3005 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3006 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3007 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3008 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3009 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3010 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3011 | { } /* end */ |
| 3012 | }; |
| 3013 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3014 | static const struct hda_input_mux alc880_f1734_capture_source = { |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3015 | .num_items = 2, |
| 3016 | .items = { |
| 3017 | { "Mic", 0x1 }, |
| 3018 | { "CD", 0x4 }, |
| 3019 | }, |
| 3020 | }; |
| 3021 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3022 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3023 | /* |
| 3024 | * ALC880 ASUS model |
| 3025 | * |
| 3026 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 3027 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 3028 | * Mic = 0x18, Line = 0x1a |
| 3029 | */ |
| 3030 | |
| 3031 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 3032 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 3033 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3034 | static const struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3035 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3036 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3037 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3038 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3039 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3040 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3041 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3042 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3043 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3044 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 3045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 3047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3049 | { |
| 3050 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3051 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3052 | .info = alc_ch_mode_info, |
| 3053 | .get = alc_ch_mode_get, |
| 3054 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3055 | }, |
| 3056 | { } /* end */ |
| 3057 | }; |
| 3058 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3059 | /* |
| 3060 | * ALC880 ASUS W1V model |
| 3061 | * |
| 3062 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 3063 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 3064 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 3065 | */ |
| 3066 | |
| 3067 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3068 | static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3069 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 3070 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3071 | { } /* end */ |
| 3072 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3074 | /* TCL S700 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3075 | static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3076 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3077 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 3078 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 3079 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 3080 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 3081 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 3082 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 3083 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 3084 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3085 | { } /* end */ |
| 3086 | }; |
| 3087 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3088 | /* Uniwill */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3089 | static const struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3090 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3091 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3092 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3093 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3094 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3095 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3096 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3097 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3098 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3099 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 3100 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3101 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 3102 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3103 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3104 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3105 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3106 | { |
| 3107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3108 | .name = "Channel Mode", |
| 3109 | .info = alc_ch_mode_info, |
| 3110 | .get = alc_ch_mode_get, |
| 3111 | .put = alc_ch_mode_put, |
| 3112 | }, |
| 3113 | { } /* end */ |
| 3114 | }; |
| 3115 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3116 | static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3117 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3118 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3119 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3120 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3121 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 3122 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 3123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 3125 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3126 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3127 | { } /* end */ |
| 3128 | }; |
| 3129 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3130 | static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3131 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3132 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3133 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3134 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3137 | { } /* end */ |
| 3138 | }; |
| 3139 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3140 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3141 | * virtual master controls |
| 3142 | */ |
| 3143 | |
| 3144 | /* |
| 3145 | * slave controls for virtual master |
| 3146 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3147 | static const char * const alc_slave_vols[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3148 | "Front Playback Volume", |
| 3149 | "Surround Playback Volume", |
| 3150 | "Center Playback Volume", |
| 3151 | "LFE Playback Volume", |
| 3152 | "Side Playback Volume", |
| 3153 | "Headphone Playback Volume", |
| 3154 | "Speaker Playback Volume", |
| 3155 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3156 | "Line-Out Playback Volume", |
| 3157 | NULL, |
| 3158 | }; |
| 3159 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3160 | static const char * const alc_slave_sws[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3161 | "Front Playback Switch", |
| 3162 | "Surround Playback Switch", |
| 3163 | "Center Playback Switch", |
| 3164 | "LFE Playback Switch", |
| 3165 | "Side Playback Switch", |
| 3166 | "Headphone Playback Switch", |
| 3167 | "Speaker Playback Switch", |
| 3168 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 3169 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 3170 | "Line-Out Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3171 | NULL, |
| 3172 | }; |
| 3173 | |
| 3174 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3175 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3176 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3177 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3178 | #define NID_MAPPING (-1) |
| 3179 | |
| 3180 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 3181 | #define SUBDEV_HP_ (1 << 6) |
| 3182 | #define SUBDEV_LINE_ (2 << 6) |
| 3183 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 3184 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 3185 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 3186 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3187 | static void alc_free_kctls(struct hda_codec *codec); |
| 3188 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3189 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3190 | /* additional beep mixers; the actual parameters are overwritten at build */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3191 | static const struct snd_kcontrol_new alc_beep_mixer[] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3192 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3193 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3194 | { } /* end */ |
| 3195 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 3196 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 3197 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3198 | static int alc_build_controls(struct hda_codec *codec) |
| 3199 | { |
| 3200 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 3201 | struct snd_kcontrol *kctl = NULL; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3202 | const struct snd_kcontrol_new *knew; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3203 | int i, j, err; |
| 3204 | unsigned int u; |
| 3205 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3206 | |
| 3207 | for (i = 0; i < spec->num_mixers; i++) { |
| 3208 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 3209 | if (err < 0) |
| 3210 | return err; |
| 3211 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3212 | if (spec->cap_mixer) { |
| 3213 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 3214 | if (err < 0) |
| 3215 | return err; |
| 3216 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3217 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3218 | err = snd_hda_create_spdif_out_ctls(codec, |
Stephen Warren | 74b654c | 2011-06-01 11:14:18 -0600 | [diff] [blame] | 3219 | spec->multiout.dig_out_nid, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 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), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4879 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4880 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4881 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4882 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4883 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4884 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4885 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4886 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4887 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4888 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4889 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4890 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4891 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4892 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4893 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4894 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4895 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4896 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4897 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4898 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4899 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4900 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4901 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4902 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4903 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4904 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4905 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4906 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4907 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Justin P. Mattock | a2e2bc2 | 2011-02-24 22:16:02 -0800 | [diff] [blame] | 4908 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4909 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4910 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4911 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4912 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4913 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4914 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4915 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4916 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4917 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4918 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4919 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4920 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
Daniel T Chen | 77c4d5c | 2010-12-02 22:45:45 -0500 | [diff] [blame] | 4921 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4922 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4923 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4924 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4925 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4926 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4927 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4928 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4929 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4930 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4931 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4932 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4933 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4934 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4935 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4936 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4937 | /* default Intel */ |
| 4938 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4939 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4940 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4941 | {} |
| 4942 | }; |
| 4943 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4944 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4945 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4946 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 4947 | static const struct alc_config_preset alc880_presets[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4948 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4949 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4950 | .init_verbs = { alc880_volume_init_verbs, |
| 4951 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4952 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4953 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4954 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4955 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4956 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4957 | .input_mux = &alc880_capture_source, |
| 4958 | }, |
| 4959 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4960 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4961 | .init_verbs = { alc880_volume_init_verbs, |
| 4962 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4963 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4964 | .dac_nids = alc880_dac_nids, |
| 4965 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4966 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4967 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4968 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4969 | .input_mux = &alc880_capture_source, |
| 4970 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4971 | [ALC880_TCL_S700] = { |
| 4972 | .mixers = { alc880_tcl_s700_mixer }, |
| 4973 | .init_verbs = { alc880_volume_init_verbs, |
| 4974 | alc880_pin_tcl_S700_init_verbs, |
| 4975 | alc880_gpio2_init_verbs }, |
| 4976 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4977 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4978 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4979 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4980 | .hp_nid = 0x03, |
| 4981 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4982 | .channel_mode = alc880_2_jack_modes, |
| 4983 | .input_mux = &alc880_capture_source, |
| 4984 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4985 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4986 | .mixers = { alc880_three_stack_mixer, |
| 4987 | alc880_five_stack_mixer}, |
| 4988 | .init_verbs = { alc880_volume_init_verbs, |
| 4989 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4990 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4991 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4992 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4993 | .channel_mode = alc880_fivestack_modes, |
| 4994 | .input_mux = &alc880_capture_source, |
| 4995 | }, |
| 4996 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4997 | .mixers = { alc880_three_stack_mixer, |
| 4998 | alc880_five_stack_mixer }, |
| 4999 | .init_verbs = { alc880_volume_init_verbs, |
| 5000 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5001 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5002 | .dac_nids = alc880_dac_nids, |
| 5003 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5004 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 5005 | .channel_mode = alc880_fivestack_modes, |
| 5006 | .input_mux = &alc880_capture_source, |
| 5007 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 5008 | [ALC880_6ST] = { |
| 5009 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5010 | .init_verbs = { alc880_volume_init_verbs, |
| 5011 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 5012 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 5013 | .dac_nids = alc880_6st_dac_nids, |
| 5014 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 5015 | .channel_mode = alc880_sixstack_modes, |
| 5016 | .input_mux = &alc880_6stack_capture_source, |
| 5017 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5018 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5019 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5020 | .init_verbs = { alc880_volume_init_verbs, |
| 5021 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5022 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 5023 | .dac_nids = alc880_6st_dac_nids, |
| 5024 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5025 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 5026 | .channel_mode = alc880_sixstack_modes, |
| 5027 | .input_mux = &alc880_6stack_capture_source, |
| 5028 | }, |
| 5029 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5030 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5031 | .init_verbs = { alc880_volume_init_verbs, |
| 5032 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 5033 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5034 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 5035 | .dac_nids = alc880_w810_dac_nids, |
| 5036 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5037 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 5038 | .channel_mode = alc880_w810_modes, |
| 5039 | .input_mux = &alc880_capture_source, |
| 5040 | }, |
| 5041 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5042 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5043 | .init_verbs = { alc880_volume_init_verbs, |
| 5044 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5045 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 5046 | .dac_nids = alc880_z71v_dac_nids, |
| 5047 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5048 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5049 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5050 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5051 | .input_mux = &alc880_capture_source, |
| 5052 | }, |
| 5053 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5054 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5055 | .init_verbs = { alc880_volume_init_verbs, |
| 5056 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5057 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 5058 | .dac_nids = alc880_f1734_dac_nids, |
| 5059 | .hp_nid = 0x02, |
| 5060 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5061 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 5062 | .input_mux = &alc880_f1734_capture_source, |
| 5063 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5064 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5065 | .init_hook = alc_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5066 | }, |
| 5067 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5068 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5069 | .init_verbs = { alc880_volume_init_verbs, |
| 5070 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5071 | alc880_gpio1_init_verbs }, |
| 5072 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5073 | .dac_nids = alc880_asus_dac_nids, |
| 5074 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5075 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5076 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5077 | .input_mux = &alc880_capture_source, |
| 5078 | }, |
| 5079 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5080 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5081 | .init_verbs = { alc880_volume_init_verbs, |
| 5082 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5083 | alc880_gpio1_init_verbs }, |
| 5084 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5085 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5086 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5087 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5088 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5089 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5090 | .input_mux = &alc880_capture_source, |
| 5091 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5092 | [ALC880_ASUS_DIG2] = { |
| 5093 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5094 | .init_verbs = { alc880_volume_init_verbs, |
| 5095 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5096 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 5097 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5098 | .dac_nids = alc880_asus_dac_nids, |
| 5099 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5100 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5101 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5102 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5103 | .input_mux = &alc880_capture_source, |
| 5104 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5105 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5106 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5107 | .init_verbs = { alc880_volume_init_verbs, |
| 5108 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5109 | alc880_gpio1_init_verbs }, |
| 5110 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5111 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5112 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5113 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5114 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5115 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5116 | .input_mux = &alc880_capture_source, |
| 5117 | }, |
| 5118 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5119 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5120 | .init_verbs = { alc880_volume_init_verbs, |
| 5121 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5122 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5123 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5124 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5125 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 5126 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5127 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5128 | .input_mux = &alc880_capture_source, |
| 5129 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5130 | [ALC880_UNIWILL] = { |
| 5131 | .mixers = { alc880_uniwill_mixer }, |
| 5132 | .init_verbs = { alc880_volume_init_verbs, |
| 5133 | alc880_uniwill_init_verbs }, |
| 5134 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5135 | .dac_nids = alc880_asus_dac_nids, |
| 5136 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5137 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5138 | .channel_mode = alc880_threestack_modes, |
| 5139 | .need_dac_fix = 1, |
| 5140 | .input_mux = &alc880_capture_source, |
| 5141 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5142 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 5143 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5144 | }, |
| 5145 | [ALC880_UNIWILL_P53] = { |
| 5146 | .mixers = { alc880_uniwill_p53_mixer }, |
| 5147 | .init_verbs = { alc880_volume_init_verbs, |
| 5148 | alc880_uniwill_p53_init_verbs }, |
| 5149 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 5150 | .dac_nids = alc880_asus_dac_nids, |
| 5151 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5152 | .channel_mode = alc880_threestack_modes, |
| 5153 | .input_mux = &alc880_capture_source, |
| 5154 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5155 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5156 | .init_hook = alc_hp_automute, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5157 | }, |
| 5158 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5159 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5160 | .init_verbs = { alc880_volume_init_verbs, |
| 5161 | alc880_uniwill_p53_init_verbs, |
| 5162 | alc880_beep_init_verbs }, |
| 5163 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5164 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 5165 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 5166 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5167 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5168 | .input_mux = &alc880_capture_source, |
| 5169 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5170 | .setup = alc880_uniwill_p53_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5171 | .init_hook = alc_hp_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 5172 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5173 | [ALC880_CLEVO] = { |
| 5174 | .mixers = { alc880_three_stack_mixer }, |
| 5175 | .init_verbs = { alc880_volume_init_verbs, |
| 5176 | alc880_pin_clevo_init_verbs }, |
| 5177 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5178 | .dac_nids = alc880_dac_nids, |
| 5179 | .hp_nid = 0x03, |
| 5180 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5181 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5182 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5183 | .input_mux = &alc880_capture_source, |
| 5184 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5185 | [ALC880_LG] = { |
| 5186 | .mixers = { alc880_lg_mixer }, |
| 5187 | .init_verbs = { alc880_volume_init_verbs, |
| 5188 | alc880_lg_init_verbs }, |
| 5189 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 5190 | .dac_nids = alc880_lg_dac_nids, |
| 5191 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5192 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 5193 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5194 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5195 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5196 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5197 | .setup = alc880_lg_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5198 | .init_hook = alc_hp_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5199 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5200 | .loopbacks = alc880_lg_loopbacks, |
| 5201 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5202 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5203 | [ALC880_LG_LW] = { |
| 5204 | .mixers = { alc880_lg_lw_mixer }, |
| 5205 | .init_verbs = { alc880_volume_init_verbs, |
| 5206 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5207 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5208 | .dac_nids = alc880_dac_nids, |
| 5209 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 5210 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 5211 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5212 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5213 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5214 | .setup = alc880_lg_lw_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 5215 | .init_hook = alc_hp_automute, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 5216 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5217 | [ALC880_MEDION_RIM] = { |
| 5218 | .mixers = { alc880_medion_rim_mixer }, |
| 5219 | .init_verbs = { alc880_volume_init_verbs, |
| 5220 | alc880_medion_rim_init_verbs, |
| 5221 | alc_gpio2_init_verbs }, |
| 5222 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 5223 | .dac_nids = alc880_dac_nids, |
| 5224 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 5225 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 5226 | .channel_mode = alc880_2_jack_modes, |
| 5227 | .input_mux = &alc880_medion_rim_capture_source, |
| 5228 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 5229 | .setup = alc880_medion_rim_setup, |
| 5230 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 5231 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5232 | #ifdef CONFIG_SND_DEBUG |
| 5233 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5234 | .mixers = { alc880_test_mixer }, |
| 5235 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5236 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 5237 | .dac_nids = alc880_test_dac_nids, |
| 5238 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5239 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 5240 | .channel_mode = alc880_test_modes, |
| 5241 | .input_mux = &alc880_test_capture_source, |
| 5242 | }, |
| 5243 | #endif |
| 5244 | }; |
| 5245 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5246 | /* |
| 5247 | * Automatic parse of I/O pins from the BIOS configuration |
| 5248 | */ |
| 5249 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5250 | enum { |
| 5251 | ALC_CTL_WIDGET_VOL, |
| 5252 | ALC_CTL_WIDGET_MUTE, |
| 5253 | ALC_CTL_BIND_MUTE, |
| 5254 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5255 | static const struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5256 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 5257 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5258 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5259 | }; |
| 5260 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5261 | static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) |
| 5262 | { |
| 5263 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
| 5264 | return snd_array_new(&spec->kctls); |
| 5265 | } |
| 5266 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5267 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5268 | 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] | 5269 | int cidx, unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5270 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5271 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5272 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5273 | knew = alc_kcontrol_new(spec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5274 | if (!knew) |
| 5275 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5276 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 5277 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5278 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5279 | return -ENOMEM; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5280 | knew->index = cidx; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 5281 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 5282 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5283 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5284 | return 0; |
| 5285 | } |
| 5286 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5287 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 5288 | const char *pfx, const char *dir, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5289 | const char *sfx, int cidx, unsigned long val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5290 | { |
| 5291 | char name[32]; |
| 5292 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5293 | return add_control(spec, type, name, cidx, val); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5294 | } |
| 5295 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5296 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 5297 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val) |
| 5298 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 5299 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val) |
| 5300 | #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \ |
| 5301 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val) |
| 5302 | #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \ |
| 5303 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5304 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5305 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 5306 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 5307 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 5308 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5309 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 5310 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 5311 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 5312 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 5313 | #define ALC880_PIN_CD_NID 0x1c |
| 5314 | |
| 5315 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 5316 | static int alc880_auto_fill_dac_nids(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5317 | { |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 5318 | struct alc_spec *spec = codec->spec; |
| 5319 | const struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 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 | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5355 | static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, |
| 5356 | bool can_be_master, int *index) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5357 | { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5358 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5359 | static const char * const chname[4] = { |
| 5360 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 5361 | }; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5362 | |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5363 | *index = 0; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5364 | if (cfg->line_outs == 1 && !spec->multi_ios && |
| 5365 | !cfg->hp_outs && !cfg->speaker_outs && can_be_master) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5366 | return "Master"; |
| 5367 | |
| 5368 | switch (cfg->line_out_type) { |
| 5369 | case AUTO_PIN_SPEAKER_OUT: |
David Henningsson | ebbeb3d | 2011-03-04 14:08:30 +0100 | [diff] [blame] | 5370 | if (cfg->line_outs == 1) |
| 5371 | return "Speaker"; |
| 5372 | break; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5373 | case AUTO_PIN_HP_OUT: |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5374 | /* for multi-io case, only the primary out */ |
| 5375 | if (ch && spec->multi_ios) |
| 5376 | break; |
| 5377 | *index = ch; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5378 | return "Headphone"; |
| 5379 | default: |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5380 | if (cfg->line_outs == 1 && !spec->multi_ios) |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5381 | return "PCM"; |
| 5382 | break; |
| 5383 | } |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5384 | return chname[ch]; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5385 | } |
| 5386 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5387 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5388 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5389 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5390 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5391 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5392 | int i, err, noutputs; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5393 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5394 | noutputs = cfg->line_outs; |
| 5395 | if (spec->multi_ios > 0) |
| 5396 | noutputs += spec->multi_ios; |
| 5397 | |
| 5398 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5399 | const char *name; |
| 5400 | int index; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5401 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5402 | continue; |
| 5403 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 5404 | name = alc_get_line_out_pfx(spec, i, false, &index); |
| 5405 | if (!name) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5406 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5407 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5408 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5409 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 5410 | HDA_OUTPUT)); |
| 5411 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5412 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5413 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 5414 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5415 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 5416 | HDA_OUTPUT)); |
| 5417 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5418 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5419 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5420 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5421 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 5422 | HDA_INPUT)); |
| 5423 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5424 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5425 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 5426 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5427 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 5428 | HDA_INPUT)); |
| 5429 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5430 | return err; |
| 5431 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5432 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5433 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5434 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 5435 | HDA_OUTPUT)); |
| 5436 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5437 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 5438 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 7e59e09 | 2011-03-04 14:22:25 +0100 | [diff] [blame] | 5439 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5440 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 5441 | HDA_INPUT)); |
| 5442 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5443 | return err; |
| 5444 | } |
| 5445 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5446 | return 0; |
| 5447 | } |
| 5448 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5449 | /* add playback controls for speaker and HP outputs */ |
| 5450 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 5451 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5452 | { |
| 5453 | hda_nid_t nid; |
| 5454 | int err; |
| 5455 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5456 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5457 | return 0; |
| 5458 | |
| 5459 | if (alc880_is_fixed_pin(pin)) { |
| 5460 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5461 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5462 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5463 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5464 | else |
| 5465 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5466 | /* control HP volume/switch on the output mixer amp */ |
| 5467 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5468 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5469 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 5470 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5471 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5472 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5473 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 5474 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5475 | return err; |
| 5476 | } else if (alc880_is_multi_pin(pin)) { |
| 5477 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5478 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 5479 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5480 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 5481 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5482 | return err; |
| 5483 | } |
| 5484 | return 0; |
| 5485 | } |
| 5486 | |
| 5487 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5488 | 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] | 5489 | const char *ctlname, int ctlidx, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5490 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5491 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5492 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5493 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5494 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5495 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5496 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5497 | return err; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5498 | err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5499 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 5500 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5501 | return err; |
| 5502 | return 0; |
| 5503 | } |
| 5504 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5505 | 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] | 5506 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5507 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 5508 | return (pincap & AC_PINCAP_IN) != 0; |
| 5509 | } |
| 5510 | |
| 5511 | /* create playback/capture controls for input pins */ |
| 5512 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 5513 | const struct auto_pin_cfg *cfg, |
| 5514 | hda_nid_t mixer, |
| 5515 | hda_nid_t cap1, hda_nid_t cap2) |
| 5516 | { |
| 5517 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5518 | struct hda_input_mux *imux = &spec->private_imux[0]; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5519 | int i, err, idx, type_idx = 0; |
| 5520 | const char *prev_label = NULL; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5521 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5522 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5523 | hda_nid_t pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5524 | const char *label; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5525 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5526 | pin = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5527 | if (!alc_is_input_pin(codec, pin)) |
| 5528 | continue; |
| 5529 | |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5530 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 5531 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5532 | type_idx++; |
| 5533 | else |
| 5534 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 5535 | prev_label = label; |
| 5536 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5537 | if (mixer) { |
| 5538 | idx = get_connection_index(codec, mixer, pin); |
| 5539 | if (idx >= 0) { |
| 5540 | err = new_analog_input(spec, pin, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5541 | label, type_idx, |
| 5542 | idx, mixer); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5543 | if (err < 0) |
| 5544 | return err; |
| 5545 | } |
| 5546 | } |
| 5547 | |
| 5548 | if (!cap1) |
| 5549 | continue; |
| 5550 | idx = get_connection_index(codec, cap1, pin); |
| 5551 | if (idx < 0 && cap2) |
| 5552 | idx = get_connection_index(codec, cap2, pin); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 5553 | if (idx >= 0) |
| 5554 | snd_hda_add_imux_item(imux, label, idx, NULL); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5555 | } |
| 5556 | return 0; |
| 5557 | } |
| 5558 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5559 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 5560 | const struct auto_pin_cfg *cfg) |
| 5561 | { |
| 5562 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 5563 | } |
| 5564 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5565 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 5566 | unsigned int pin_type) |
| 5567 | { |
| 5568 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5569 | pin_type); |
| 5570 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 5571 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5572 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5573 | } |
| 5574 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5575 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5576 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5577 | int dac_idx) |
| 5578 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5579 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5580 | /* need the manual connection? */ |
| 5581 | if (alc880_is_multi_pin(nid)) { |
| 5582 | struct alc_spec *spec = codec->spec; |
| 5583 | int idx = alc880_multi_pin_idx(nid); |
| 5584 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 5585 | AC_VERB_SET_CONNECT_SEL, |
| 5586 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 5587 | } |
| 5588 | } |
| 5589 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5590 | static int get_pin_type(int line_out_type) |
| 5591 | { |
| 5592 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 5593 | return PIN_HP; |
| 5594 | else |
| 5595 | return PIN_OUT; |
| 5596 | } |
| 5597 | |
Takashi Iwai | 050ea75 | 2011-06-27 15:48:17 +0200 | [diff] [blame] | 5598 | static void alc880_auto_init_dac(struct hda_codec *codec, hda_nid_t dac) |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5599 | { |
Takashi Iwai | 050ea75 | 2011-06-27 15:48:17 +0200 | [diff] [blame] | 5600 | hda_nid_t nid, mix; |
| 5601 | |
| 5602 | if (!dac) |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5603 | return; |
Takashi Iwai | 050ea75 | 2011-06-27 15:48:17 +0200 | [diff] [blame] | 5604 | mix = alc880_idx_to_mixer(alc880_dac_to_idx(dac)); |
| 5605 | if (query_amp_caps(codec, dac, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS) |
| 5606 | nid = dac; |
| 5607 | else if (query_amp_caps(codec, mix, HDA_OUTPUT) & AC_AMPCAP_NUM_STEPS) |
| 5608 | nid = mix; |
| 5609 | else |
| 5610 | nid = 0; |
| 5611 | if (nid) |
| 5612 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5613 | AMP_OUT_ZERO); |
| 5614 | if (query_amp_caps(codec, mix, HDA_INPUT) & AC_AMPCAP_MUTE) { |
| 5615 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5616 | AMP_IN_UNMUTE(0)); |
| 5617 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 5618 | AMP_IN_UNMUTE(1)); |
| 5619 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5620 | } |
| 5621 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5622 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 5623 | { |
| 5624 | struct alc_spec *spec = codec->spec; |
| 5625 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5626 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5627 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 5628 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5629 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5630 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5631 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5632 | /* mute DACs */ |
| 5633 | for (i = 0; i < spec->multiout.num_dacs; i++) |
| 5634 | alc880_auto_init_dac(codec, spec->multiout.dac_nids[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5635 | } |
| 5636 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5637 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5638 | { |
| 5639 | struct alc_spec *spec = codec->spec; |
| 5640 | hda_nid_t pin; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5641 | int i; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5642 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5643 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5644 | if (pin) /* connect to front */ |
| 5645 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5646 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5647 | if (pin) /* connect to front */ |
| 5648 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5649 | /* mute DACs */ |
| 5650 | alc880_auto_init_dac(codec, spec->multiout.hp_nid); |
| 5651 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) |
| 5652 | alc880_auto_init_dac(codec, spec->multiout.extra_out_nid[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5653 | } |
| 5654 | |
| 5655 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 5656 | { |
| 5657 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5658 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5659 | int i; |
| 5660 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5661 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5662 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5663 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 30ea098 | 2010-09-16 18:47:56 +0200 | [diff] [blame] | 5664 | alc_set_input_pin(codec, nid, cfg->inputs[i].type); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5665 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5666 | snd_hda_codec_write(codec, nid, 0, |
| 5667 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5668 | AMP_OUT_MUTE); |
| 5669 | } |
| 5670 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5671 | |
| 5672 | /* mute all loopback inputs */ |
| 5673 | if (spec->mixer_nid) { |
| 5674 | int nums = snd_hda_get_conn_list(codec, spec->mixer_nid, NULL); |
| 5675 | for (i = 0; i < nums; i++) |
| 5676 | snd_hda_codec_write(codec, spec->mixer_nid, 0, |
| 5677 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 5678 | AMP_IN_MUTE(i)); |
| 5679 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5680 | } |
| 5681 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5682 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 5683 | { |
| 5684 | struct alc_spec *spec = codec->spec; |
| 5685 | int c; |
| 5686 | |
| 5687 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 5688 | unsigned int mux_idx; |
| 5689 | const struct hda_input_mux *imux; |
| 5690 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 5691 | imux = &spec->input_mux[mux_idx]; |
| 5692 | if (!imux->num_items && mux_idx > 0) |
| 5693 | imux = &spec->input_mux[0]; |
| 5694 | if (imux) |
| 5695 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5696 | AC_VERB_SET_CONNECT_SEL, |
| 5697 | imux->items[0].index); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 5698 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5699 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 5700 | AMP_IN_MUTE(0)); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5701 | } |
| 5702 | } |
| 5703 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 5704 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec, |
| 5705 | int (*fill_dac)(struct hda_codec *)); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5706 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5707 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5708 | /* return 1 if successful, 0 if the proper config is not found, |
| 5709 | * or a negative error code |
| 5710 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5711 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5712 | { |
| 5713 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5714 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5715 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5716 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5717 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5718 | alc880_ignore); |
| 5719 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5720 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5721 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5722 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5723 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 5724 | err = alc880_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5725 | if (err < 0) |
| 5726 | return err; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 5727 | err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 5728 | if (err < 0) |
| 5729 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5730 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5731 | if (err < 0) |
| 5732 | return err; |
| 5733 | err = alc880_auto_create_extra_out(spec, |
| 5734 | spec->autocfg.speaker_pins[0], |
| 5735 | "Speaker"); |
| 5736 | if (err < 0) |
| 5737 | return err; |
| 5738 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5739 | "Headphone"); |
| 5740 | if (err < 0) |
| 5741 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5742 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5743 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5744 | return err; |
| 5745 | |
| 5746 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5747 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5748 | alc_auto_parse_digital(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5749 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5750 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5751 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5752 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5753 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5754 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5755 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5756 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5757 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5758 | return 1; |
| 5759 | } |
| 5760 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5761 | /* additional initialization for auto-configuration model */ |
| 5762 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5763 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5764 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5765 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5766 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5767 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5768 | alc880_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 5769 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5770 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5771 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5772 | } |
| 5773 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5774 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5775 | * one of two digital mic pins, e.g. on ALC272 |
| 5776 | */ |
| 5777 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5778 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5779 | struct alc_spec *spec = codec->spec; |
| 5780 | int i; |
| 5781 | |
| 5782 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5783 | hda_nid_t cap = spec->capsrc_nids ? |
| 5784 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5785 | int iidx, eidx; |
| 5786 | |
| 5787 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5788 | if (iidx < 0) |
| 5789 | continue; |
| 5790 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5791 | if (eidx < 0) |
| 5792 | continue; |
| 5793 | spec->int_mic.mux_idx = iidx; |
| 5794 | spec->ext_mic.mux_idx = eidx; |
| 5795 | if (spec->capsrc_nids) |
| 5796 | spec->capsrc_nids += i; |
| 5797 | spec->adc_nids += i; |
| 5798 | spec->num_adc_nids = 1; |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5799 | /* optional dock-mic */ |
| 5800 | eidx = get_connection_index(codec, cap, spec->dock_mic.pin); |
| 5801 | if (eidx < 0) |
| 5802 | spec->dock_mic.pin = 0; |
| 5803 | else |
| 5804 | spec->dock_mic.mux_idx = eidx; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5805 | return; |
| 5806 | } |
| 5807 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5808 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5809 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5810 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5811 | } |
| 5812 | |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5813 | /* select or unmute the given capsrc route */ |
| 5814 | static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap, |
| 5815 | int idx) |
| 5816 | { |
| 5817 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5818 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5819 | HDA_AMP_MUTE, 0); |
| 5820 | } else { |
| 5821 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5822 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5823 | } |
| 5824 | } |
| 5825 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5826 | /* set the default connection to that pin */ |
| 5827 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5828 | { |
| 5829 | struct alc_spec *spec = codec->spec; |
| 5830 | int i; |
| 5831 | |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5832 | if (!pin) |
| 5833 | return 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5834 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5835 | hda_nid_t cap = spec->capsrc_nids ? |
| 5836 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5837 | int idx; |
| 5838 | |
| 5839 | idx = get_connection_index(codec, cap, pin); |
| 5840 | if (idx < 0) |
| 5841 | continue; |
Takashi Iwai | 748cce4 | 2010-08-04 07:37:39 +0200 | [diff] [blame] | 5842 | select_or_unmute_capsrc(codec, cap, idx); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5843 | return i; /* return the found index */ |
| 5844 | } |
| 5845 | return -1; /* not found */ |
| 5846 | } |
| 5847 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5848 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5849 | static void fixup_single_adc(struct hda_codec *codec) |
| 5850 | { |
| 5851 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5852 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5853 | int i; |
| 5854 | |
| 5855 | /* search for the input pin; there must be only one */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5856 | if (cfg->num_inputs != 1) |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5857 | return; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5858 | i = init_capsrc_for_pin(codec, cfg->inputs[0].pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5859 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5860 | /* use only this ADC */ |
| 5861 | if (spec->capsrc_nids) |
| 5862 | spec->capsrc_nids += i; |
| 5863 | spec->adc_nids += i; |
| 5864 | spec->num_adc_nids = 1; |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5865 | spec->single_input_src = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5866 | } |
| 5867 | } |
| 5868 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5869 | /* initialize dual adcs */ |
| 5870 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5871 | { |
| 5872 | struct alc_spec *spec = codec->spec; |
| 5873 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
Takashi Iwai | 8ed99d9 | 2011-05-17 12:05:02 +0200 | [diff] [blame] | 5874 | init_capsrc_for_pin(codec, spec->dock_mic.pin); |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5875 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5876 | } |
| 5877 | |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5878 | /* initialize some special cases for input sources */ |
| 5879 | static void alc_init_special_input_src(struct hda_codec *codec) |
| 5880 | { |
| 5881 | struct alc_spec *spec = codec->spec; |
| 5882 | if (spec->dual_adc_switch) |
| 5883 | fixup_dual_adc_switch(codec); |
| 5884 | else if (spec->single_input_src) |
| 5885 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); |
| 5886 | } |
| 5887 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5888 | static void set_capture_mixer(struct hda_codec *codec) |
| 5889 | { |
| 5890 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5891 | static const struct snd_kcontrol_new *caps[2][3] = { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5892 | { alc_capture_mixer_nosrc1, |
| 5893 | alc_capture_mixer_nosrc2, |
| 5894 | alc_capture_mixer_nosrc3 }, |
| 5895 | { alc_capture_mixer1, |
| 5896 | alc_capture_mixer2, |
| 5897 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5898 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5899 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5900 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5901 | int num_adcs = spec->num_adc_nids; |
| 5902 | if (spec->dual_adc_switch) |
Takashi Iwai | 584c0c4 | 2011-03-10 12:51:11 +0100 | [diff] [blame] | 5903 | num_adcs = 1; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5904 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5905 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5906 | else if (spec->input_mux) { |
| 5907 | if (spec->input_mux->num_items > 1) |
| 5908 | mux = 1; |
| 5909 | else if (spec->input_mux->num_items == 1) |
| 5910 | fixup_single_adc(codec); |
| 5911 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5912 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5913 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5914 | } |
| 5915 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5916 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5917 | 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] | 5918 | int num_nids) |
| 5919 | { |
| 5920 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5921 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5922 | int n; |
| 5923 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5924 | |
| 5925 | for (n = 0; n < num_nids; n++) { |
| 5926 | hda_nid_t adc, cap; |
| 5927 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5928 | int nconns, i, j; |
| 5929 | |
| 5930 | adc = nids[n]; |
| 5931 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5932 | continue; |
| 5933 | cap = adc; |
| 5934 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5935 | ARRAY_SIZE(conn)); |
| 5936 | if (nconns == 1) { |
| 5937 | cap = conn[0]; |
| 5938 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5939 | ARRAY_SIZE(conn)); |
| 5940 | } |
| 5941 | if (nconns <= 0) |
| 5942 | continue; |
| 5943 | if (!fallback_adc) { |
| 5944 | fallback_adc = adc; |
| 5945 | fallback_cap = cap; |
| 5946 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5947 | for (i = 0; i < cfg->num_inputs; i++) { |
| 5948 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5949 | for (j = 0; j < nconns; j++) { |
| 5950 | if (conn[j] == nid) |
| 5951 | break; |
| 5952 | } |
| 5953 | if (j >= nconns) |
| 5954 | break; |
| 5955 | } |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 5956 | if (i >= cfg->num_inputs) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5957 | int num_adcs = spec->num_adc_nids; |
| 5958 | spec->private_adc_nids[num_adcs] = adc; |
| 5959 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5960 | spec->num_adc_nids++; |
| 5961 | spec->adc_nids = spec->private_adc_nids; |
| 5962 | if (adc != cap) |
| 5963 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5964 | } |
| 5965 | } |
| 5966 | if (!spec->num_adc_nids) { |
| 5967 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5968 | " using fallback 0x%x\n", |
| 5969 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5970 | spec->private_adc_nids[0] = fallback_adc; |
| 5971 | spec->adc_nids = spec->private_adc_nids; |
| 5972 | if (fallback_adc != fallback_cap) { |
| 5973 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5974 | spec->capsrc_nids = spec->private_adc_nids; |
| 5975 | } |
| 5976 | } |
| 5977 | } |
| 5978 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5979 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5980 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5981 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5982 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 5983 | static const struct snd_pci_quirk beep_white_list[] = { |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5984 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 080dc7b | 2010-09-08 08:38:41 +0200 | [diff] [blame] | 5985 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
Daniel Cordero | a7e985e | 2011-04-29 08:18:06 +0200 | [diff] [blame] | 5986 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), |
Madis Janson | 39dfe13 | 2011-05-19 18:32:41 +0200 | [diff] [blame] | 5987 | SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1), |
Takashi Iwai | e096c8e | 2010-08-03 17:20:35 +0200 | [diff] [blame] | 5988 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5989 | {} |
| 5990 | }; |
| 5991 | |
| 5992 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5993 | { |
| 5994 | struct alc_spec *spec = codec->spec; |
| 5995 | const struct snd_pci_quirk *q; |
| 5996 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5997 | if (q) |
| 5998 | return q->value; |
| 5999 | return spec->cdefine.enable_pcbeep; |
| 6000 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 6001 | #else |
| 6002 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 6003 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 6004 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6005 | |
| 6006 | /* |
| 6007 | * OK, here we have finally the patch for ALC880 |
| 6008 | */ |
| 6009 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6010 | static int patch_alc880(struct hda_codec *codec) |
| 6011 | { |
| 6012 | struct alc_spec *spec; |
| 6013 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6015 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6016 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6017 | if (spec == NULL) |
| 6018 | return -ENOMEM; |
| 6019 | |
| 6020 | codec->spec = spec; |
| 6021 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 6022 | spec->mixer_nid = 0x0b; |
| 6023 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6024 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 6025 | alc880_models, |
| 6026 | alc880_cfg_tbl); |
| 6027 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6028 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6029 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6030 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6031 | } |
| 6032 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6033 | if (board_config == ALC880_AUTO) { |
| 6034 | /* automatic parse from the BIOS config */ |
| 6035 | err = alc880_parse_auto_config(codec); |
| 6036 | if (err < 0) { |
| 6037 | alc_free(codec); |
| 6038 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6039 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6040 | printk(KERN_INFO |
| 6041 | "hda_codec: Cannot set up configuration " |
| 6042 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6043 | board_config = ALC880_3ST; |
| 6044 | } |
| 6045 | } |
| 6046 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6047 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6048 | if (err < 0) { |
| 6049 | alc_free(codec); |
| 6050 | return err; |
| 6051 | } |
| 6052 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6053 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6054 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6055 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6056 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 6057 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6058 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6059 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6060 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 6061 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 6062 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6063 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6064 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 6065 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6066 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6067 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6068 | if (wcap != AC_WID_AUD_IN) { |
| 6069 | spec->adc_nids = alc880_adc_nids_alt; |
| 6070 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6071 | } else { |
| 6072 | spec->adc_nids = alc880_adc_nids; |
| 6073 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6074 | } |
| 6075 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6076 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6077 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6078 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6079 | spec->vmaster_nid = 0x0c; |
| 6080 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6081 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6082 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6083 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6084 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6085 | if (!spec->loopback.amplist) |
| 6086 | spec->loopback.amplist = alc880_loopbacks; |
| 6087 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6088 | |
| 6089 | return 0; |
| 6090 | } |
| 6091 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6092 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6093 | /* |
| 6094 | * ALC260 support |
| 6095 | */ |
| 6096 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6097 | static const hda_nid_t alc260_dac_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6098 | /* front */ |
| 6099 | 0x02, |
| 6100 | }; |
| 6101 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6102 | static const hda_nid_t alc260_adc_nids[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6103 | /* ADC0 */ |
| 6104 | 0x04, |
| 6105 | }; |
| 6106 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6107 | static const hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6108 | /* ADC1 */ |
| 6109 | 0x05, |
| 6110 | }; |
| 6111 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6112 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 6113 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 6114 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6115 | static const hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6116 | /* ADC0, ADC1 */ |
| 6117 | 0x04, 0x05 |
| 6118 | }; |
| 6119 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6120 | #define ALC260_DIGOUT_NID 0x03 |
| 6121 | #define ALC260_DIGIN_NID 0x06 |
| 6122 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6123 | static const struct hda_input_mux alc260_capture_source = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6124 | .num_items = 4, |
| 6125 | .items = { |
| 6126 | { "Mic", 0x0 }, |
| 6127 | { "Front Mic", 0x1 }, |
| 6128 | { "Line", 0x2 }, |
| 6129 | { "CD", 0x4 }, |
| 6130 | }, |
| 6131 | }; |
| 6132 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6133 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6134 | * headphone jack and the internal CD lines since these are the only pins at |
| 6135 | * which audio can appear. For flexibility, also allow the option of |
| 6136 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 6137 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6138 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6139 | static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6140 | { |
| 6141 | .num_items = 3, |
| 6142 | .items = { |
| 6143 | { "Mic/Line", 0x0 }, |
| 6144 | { "CD", 0x4 }, |
| 6145 | { "Headphone", 0x2 }, |
| 6146 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6147 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6148 | { |
| 6149 | .num_items = 4, |
| 6150 | .items = { |
| 6151 | { "Mic/Line", 0x0 }, |
| 6152 | { "CD", 0x4 }, |
| 6153 | { "Headphone", 0x2 }, |
| 6154 | { "Mixer", 0x5 }, |
| 6155 | }, |
| 6156 | }, |
| 6157 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6158 | }; |
| 6159 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6160 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 6161 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6162 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6163 | static const struct hda_input_mux alc260_acer_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6164 | { |
| 6165 | .num_items = 4, |
| 6166 | .items = { |
| 6167 | { "Mic", 0x0 }, |
| 6168 | { "Line", 0x2 }, |
| 6169 | { "CD", 0x4 }, |
| 6170 | { "Headphone", 0x5 }, |
| 6171 | }, |
| 6172 | }, |
| 6173 | { |
| 6174 | .num_items = 5, |
| 6175 | .items = { |
| 6176 | { "Mic", 0x0 }, |
| 6177 | { "Line", 0x2 }, |
| 6178 | { "CD", 0x4 }, |
| 6179 | { "Headphone", 0x6 }, |
| 6180 | { "Mixer", 0x5 }, |
| 6181 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6182 | }, |
| 6183 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6184 | |
| 6185 | /* Maxdata Favorit 100XS */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6186 | static const struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6187 | { |
| 6188 | .num_items = 2, |
| 6189 | .items = { |
| 6190 | { "Line/Mic", 0x0 }, |
| 6191 | { "CD", 0x4 }, |
| 6192 | }, |
| 6193 | }, |
| 6194 | { |
| 6195 | .num_items = 3, |
| 6196 | .items = { |
| 6197 | { "Line/Mic", 0x0 }, |
| 6198 | { "CD", 0x4 }, |
| 6199 | { "Mixer", 0x5 }, |
| 6200 | }, |
| 6201 | }, |
| 6202 | }; |
| 6203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6204 | /* |
| 6205 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 6206 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 6207 | * element which allows changing the channel mode, so the verb list is |
| 6208 | * never used. |
| 6209 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6210 | static const struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6211 | { 2, NULL }, |
| 6212 | }; |
| 6213 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6214 | |
| 6215 | /* Mixer combinations |
| 6216 | * |
| 6217 | * basic: base_output + input + pc_beep + capture |
| 6218 | * HP: base_output + input + capture_alt |
| 6219 | * HP_3013: hp_3013 + input + capture |
| 6220 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6221 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6222 | */ |
| 6223 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6224 | static const struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6225 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6226 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6227 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6228 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6229 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6230 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6231 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6232 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6233 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6234 | static const struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6235 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6236 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6237 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6238 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6239 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6240 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6241 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6242 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6243 | { } /* end */ |
| 6244 | }; |
| 6245 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6246 | /* update HP, line and mono out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6247 | static void alc260_hp_master_update(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6248 | { |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6249 | update_speakers(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6250 | } |
| 6251 | |
| 6252 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 6253 | struct snd_ctl_elem_value *ucontrol) |
| 6254 | { |
| 6255 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6256 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6257 | *ucontrol->value.integer.value = !spec->master_mute; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6258 | return 0; |
| 6259 | } |
| 6260 | |
| 6261 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 6262 | struct snd_ctl_elem_value *ucontrol) |
| 6263 | { |
| 6264 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6265 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6266 | int val = !*ucontrol->value.integer.value; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6267 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6268 | if (val == spec->master_mute) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6269 | return 0; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6270 | spec->master_mute = val; |
| 6271 | alc260_hp_master_update(codec); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6272 | return 1; |
| 6273 | } |
| 6274 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6275 | static const struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6276 | { |
| 6277 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6278 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6279 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6280 | .info = snd_ctl_boolean_mono_info, |
| 6281 | .get = alc260_hp_master_sw_get, |
| 6282 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6283 | }, |
| 6284 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6285 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 6286 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6287 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 6288 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 6289 | HDA_OUTPUT), |
| 6290 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6291 | { } /* end */ |
| 6292 | }; |
| 6293 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6294 | static const struct hda_verb alc260_hp_unsol_verbs[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6295 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6296 | {}, |
| 6297 | }; |
| 6298 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6299 | static void alc260_hp_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6300 | { |
| 6301 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6302 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6303 | spec->autocfg.hp_pins[0] = 0x0f; |
| 6304 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6305 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6306 | spec->automute = 1; |
| 6307 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6308 | } |
| 6309 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6310 | static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6311 | { |
| 6312 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6313 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 6314 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6315 | .info = snd_ctl_boolean_mono_info, |
| 6316 | .get = alc260_hp_master_sw_get, |
| 6317 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6318 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6320 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6321 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6322 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6323 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6324 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6325 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6326 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6327 | { } /* end */ |
| 6328 | }; |
| 6329 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6330 | static void alc260_hp_3013_setup(struct hda_codec *codec) |
| 6331 | { |
| 6332 | struct alc_spec *spec = codec->spec; |
| 6333 | |
| 6334 | spec->autocfg.hp_pins[0] = 0x15; |
| 6335 | spec->autocfg.speaker_pins[0] = 0x10; |
| 6336 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6337 | spec->automute = 1; |
| 6338 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 6339 | } |
| 6340 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6341 | static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6342 | .ops = &snd_hda_bind_vol, |
| 6343 | .values = { |
| 6344 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 6345 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 6346 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 6347 | 0 |
| 6348 | }, |
| 6349 | }; |
| 6350 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6351 | static const struct hda_bind_ctls alc260_dc7600_bind_switch = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6352 | .ops = &snd_hda_bind_sw, |
| 6353 | .values = { |
| 6354 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 6355 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 6356 | 0 |
| 6357 | }, |
| 6358 | }; |
| 6359 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6360 | static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6361 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 6362 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 6363 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 6364 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 6365 | { } /* end */ |
| 6366 | }; |
| 6367 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6368 | static const struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6369 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6370 | {}, |
| 6371 | }; |
| 6372 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6373 | static void alc260_hp_3012_setup(struct hda_codec *codec) |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6374 | { |
| 6375 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6376 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 6377 | spec->autocfg.hp_pins[0] = 0x10; |
| 6378 | spec->autocfg.speaker_pins[0] = 0x0f; |
| 6379 | spec->autocfg.speaker_pins[1] = 0x11; |
| 6380 | spec->autocfg.speaker_pins[2] = 0x15; |
| 6381 | spec->automute = 1; |
| 6382 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6383 | } |
| 6384 | |
| 6385 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6386 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 6387 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6388 | static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6389 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6390 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6391 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6392 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6393 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6394 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6395 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6396 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6397 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6398 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6399 | { } /* end */ |
| 6400 | }; |
| 6401 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6402 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 6403 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 6404 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 6405 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 6406 | * whether this behaviour is intentional or is a hardware bug in chip |
| 6407 | * revisions available in early 2006. Therefore for now allow the |
| 6408 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 6409 | * that the lack of mic bias for this NID is intentional we could change the |
| 6410 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6411 | * |
| 6412 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 6413 | * don't appear to make the mic bias available from the "line" jack, even |
| 6414 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 6415 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 6416 | * and the output jack. If this turns out to be the case for all such |
| 6417 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 6418 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6419 | * |
| 6420 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 6421 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 6422 | * controls for such models. On models without a "mono speaker" the control |
| 6423 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6424 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6425 | static const struct snd_kcontrol_new alc260_acer_mixer[] = { |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6426 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6427 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6428 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6429 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6430 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 6431 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6432 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6433 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6434 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 6435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6437 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6438 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6439 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6440 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6441 | { } /* end */ |
| 6442 | }; |
| 6443 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6444 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 6445 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6446 | static const struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6447 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6448 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 6449 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6450 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6451 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6452 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6453 | { } /* end */ |
| 6454 | }; |
| 6455 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6456 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 6457 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 6458 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6459 | static const struct snd_kcontrol_new alc260_will_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6460 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6461 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6463 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6464 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6466 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6467 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6468 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6469 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6470 | { } /* end */ |
| 6471 | }; |
| 6472 | |
| 6473 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 6474 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 6475 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6476 | static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6477 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6478 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 6479 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 6480 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 6481 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 6482 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 6483 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 6484 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6485 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6486 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6487 | { } /* end */ |
| 6488 | }; |
| 6489 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | /* |
| 6491 | * initialization verbs |
| 6492 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6493 | static const struct hda_verb alc260_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6494 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6496 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6497 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6498 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6499 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6500 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6501 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6502 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6503 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6504 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 6505 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6506 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6507 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6508 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6509 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6510 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6511 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6512 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6513 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6514 | /* set connection select to line in (default select for this ADC) */ |
| 6515 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6516 | /* mute capture amp left and right */ |
| 6517 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6518 | /* set connection select to line in (default select for this ADC) */ |
| 6519 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6520 | /* set vol=0 Line-Out mixer amp left and right */ |
| 6521 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6522 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6523 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6524 | /* set vol=0 HP mixer amp left and right */ |
| 6525 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6526 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6527 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6528 | /* set vol=0 Mono mixer amp left and right */ |
| 6529 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6530 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 6531 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6532 | /* unmute LINE-2 out pin */ |
| 6533 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6534 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6535 | * Line In 2 = 0x03 |
| 6536 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6537 | /* mute analog inputs */ |
| 6538 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6539 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6540 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6541 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6542 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6543 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6544 | /* mute Front out path */ |
| 6545 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6546 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6547 | /* mute Headphone out path */ |
| 6548 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6549 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6550 | /* mute Mono out path */ |
| 6551 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6552 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6553 | { } |
| 6554 | }; |
| 6555 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6556 | #if 0 /* should be identical with alc260_init_verbs? */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6557 | static const struct hda_verb alc260_hp_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6558 | /* Headphone and output */ |
| 6559 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6560 | /* mono output */ |
| 6561 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6562 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6563 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6564 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6565 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6566 | /* Line In pin widget for input */ |
| 6567 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6568 | /* Line-2 pin widget for output */ |
| 6569 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6570 | /* CD pin widget for input */ |
| 6571 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6572 | /* unmute amp left and right */ |
| 6573 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6574 | /* set connection select to line in (default select for this ADC) */ |
| 6575 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6576 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6577 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6578 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6579 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6580 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6581 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6582 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6583 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6584 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6585 | * Line In 2 = 0x03 |
| 6586 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6587 | /* mute analog inputs */ |
| 6588 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6589 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6590 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6591 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6592 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6593 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6594 | /* Unmute Front out path */ |
| 6595 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6596 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6597 | /* Unmute Headphone out path */ |
| 6598 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6599 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6600 | /* Unmute Mono out path */ |
| 6601 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6602 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6603 | { } |
| 6604 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 6605 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6606 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6607 | static const struct hda_verb alc260_hp_3013_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6608 | /* Line out and output */ |
| 6609 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6610 | /* mono output */ |
| 6611 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 6612 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 6613 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6614 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 6615 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 6616 | /* Line In pin widget for input */ |
| 6617 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6618 | /* Headphone pin widget for output */ |
| 6619 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 6620 | /* CD pin widget for input */ |
| 6621 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 6622 | /* unmute amp left and right */ |
| 6623 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 6624 | /* set connection select to line in (default select for this ADC) */ |
| 6625 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6626 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 6627 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6628 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 6630 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 6631 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 6632 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 6633 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6634 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 6635 | * Line In 2 = 0x03 |
| 6636 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6637 | /* mute analog inputs */ |
| 6638 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6639 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6640 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6641 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6642 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6643 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 6644 | /* Unmute Front out path */ |
| 6645 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6646 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6647 | /* Unmute Headphone out path */ |
| 6648 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6649 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6650 | /* Unmute Mono out path */ |
| 6651 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6652 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 6653 | { } |
| 6654 | }; |
| 6655 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6656 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6657 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 6658 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6659 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6660 | static const struct hda_verb alc260_fujitsu_init_verbs[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6661 | /* Disable all GPIOs */ |
| 6662 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 6663 | /* Internal speaker is connected to headphone pin */ |
| 6664 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6665 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 6666 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6667 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 6668 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6669 | /* Ensure all other unused pins are disabled and muted. */ |
| 6670 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6671 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6672 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6673 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6674 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6675 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6676 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6677 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6678 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6679 | /* Disable digital (SPDIF) pins */ |
| 6680 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6681 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6682 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6683 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6684 | * when acting as an output. |
| 6685 | */ |
| 6686 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6687 | |
| 6688 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6689 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6690 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6691 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6692 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6693 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6694 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6695 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6696 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6697 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6698 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6699 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6700 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6701 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6702 | * If the pin mode is changed by the user the pin mode control will |
| 6703 | * take care of enabling the pin's input/output buffers as needed. |
| 6704 | * Therefore there's no need to enable the input buffer at this |
| 6705 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6706 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6707 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6708 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6709 | * mixer ctrl) |
| 6710 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6711 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6712 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6713 | /* Mute capture amp left and right */ |
| 6714 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6715 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6716 | * in (on mic1 pin) |
| 6717 | */ |
| 6718 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6719 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6720 | /* Do the same for the second ADC: mute capture input amp and |
| 6721 | * set ADC connection to line in (on mic1 pin) |
| 6722 | */ |
| 6723 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6724 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6725 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6726 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6727 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6728 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6729 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6730 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6731 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6732 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6733 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6734 | {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] | 6735 | |
| 6736 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6737 | }; |
| 6738 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6739 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6740 | * similar laptops (adapted from Fujitsu init verbs). |
| 6741 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6742 | static const struct hda_verb alc260_acer_init_verbs[] = { |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6743 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6744 | * the headphone jack. Turn this on and rely on the standard mute |
| 6745 | * methods whenever the user wants to turn these outputs off. |
| 6746 | */ |
| 6747 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6748 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6749 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6750 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6751 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6752 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6753 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6754 | /* Line In jack is connected to Line1 pin */ |
| 6755 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6756 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6757 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6758 | /* Ensure all other unused pins are disabled and muted. */ |
| 6759 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6760 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6761 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6762 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6763 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6764 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6765 | /* Disable digital (SPDIF) pins */ |
| 6766 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6767 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6768 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6769 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6770 | * bus when acting as outputs. |
| 6771 | */ |
| 6772 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6773 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6774 | |
| 6775 | /* Start with output sum widgets muted and their output gains at min */ |
| 6776 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6777 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6778 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6779 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6780 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6781 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6782 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6783 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6784 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6785 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6786 | /* Unmute Line-out pin widget amp left and right |
| 6787 | * (no equiv mixer ctrl) |
| 6788 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6789 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6790 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6791 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6792 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6793 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6794 | * will take care of enabling the pin's input/output buffers as needed. |
| 6795 | * Therefore there's no need to enable the input buffer at this |
| 6796 | * stage. |
| 6797 | */ |
| 6798 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6799 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6800 | |
| 6801 | /* Mute capture amp left and right */ |
| 6802 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6803 | /* Set ADC connection select to match default mixer setting - mic |
| 6804 | * (on mic1 pin) |
| 6805 | */ |
| 6806 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6807 | |
| 6808 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6809 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6810 | */ |
| 6811 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6812 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6813 | |
| 6814 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6815 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6817 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6820 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6821 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6822 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6823 | |
| 6824 | { } |
| 6825 | }; |
| 6826 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6827 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6828 | * (adapted from Acer init verbs). |
| 6829 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6830 | static const struct hda_verb alc260_favorit100_init_verbs[] = { |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6831 | /* GPIO 0 enables the output jack. |
| 6832 | * Turn this on and rely on the standard mute |
| 6833 | * methods whenever the user wants to turn these outputs off. |
| 6834 | */ |
| 6835 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6836 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6837 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6838 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6839 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6840 | /* Ensure all other unused pins are disabled and muted. */ |
| 6841 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6842 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6843 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6844 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6845 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6846 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6847 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6848 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6849 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6851 | /* Disable digital (SPDIF) pins */ |
| 6852 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6853 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6854 | |
| 6855 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6856 | * bus when acting as outputs. |
| 6857 | */ |
| 6858 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6859 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6860 | |
| 6861 | /* Start with output sum widgets muted and their output gains at min */ |
| 6862 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6863 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6864 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6865 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6866 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6867 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6868 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6869 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6870 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6871 | |
| 6872 | /* Unmute Line-out pin widget amp left and right |
| 6873 | * (no equiv mixer ctrl) |
| 6874 | */ |
| 6875 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6876 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6877 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6878 | * will take care of enabling the pin's input/output buffers as needed. |
| 6879 | * Therefore there's no need to enable the input buffer at this |
| 6880 | * stage. |
| 6881 | */ |
| 6882 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6883 | |
| 6884 | /* Mute capture amp left and right */ |
| 6885 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6886 | /* Set ADC connection select to match default mixer setting - mic |
| 6887 | * (on mic1 pin) |
| 6888 | */ |
| 6889 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6890 | |
| 6891 | /* Do similar with the second ADC: mute capture input amp and |
| 6892 | * set ADC connection to mic to match ALSA's default state. |
| 6893 | */ |
| 6894 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6895 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6896 | |
| 6897 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6904 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6905 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6906 | |
| 6907 | { } |
| 6908 | }; |
| 6909 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6910 | static const struct hda_verb alc260_will_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6911 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6912 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6913 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6914 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6915 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6916 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6917 | {} |
| 6918 | }; |
| 6919 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6920 | static const struct hda_verb alc260_replacer_672v_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6921 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6922 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6923 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6924 | |
| 6925 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6926 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6927 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6928 | |
| 6929 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6930 | {} |
| 6931 | }; |
| 6932 | |
| 6933 | /* toggle speaker-output according to the hp-jack state */ |
| 6934 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6935 | { |
| 6936 | unsigned int present; |
| 6937 | |
| 6938 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6939 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6940 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6941 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6942 | AC_VERB_SET_GPIO_DATA, 1); |
| 6943 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6944 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6945 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6946 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6947 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6948 | AC_VERB_SET_GPIO_DATA, 0); |
| 6949 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6950 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6951 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6952 | } |
| 6953 | } |
| 6954 | |
| 6955 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6956 | unsigned int res) |
| 6957 | { |
| 6958 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6959 | alc260_replacer_672v_automute(codec); |
| 6960 | } |
| 6961 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6962 | static const struct hda_verb alc260_hp_dc7600_verbs[] = { |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6963 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6964 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6965 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6966 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6967 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6969 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6970 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6971 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6972 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6973 | {} |
| 6974 | }; |
| 6975 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6976 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6977 | * configuration. |
| 6978 | */ |
| 6979 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6980 | static const hda_nid_t alc260_test_dac_nids[1] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6981 | 0x02, |
| 6982 | }; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6983 | static const hda_nid_t alc260_test_adc_nids[2] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6984 | 0x04, 0x05, |
| 6985 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6986 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6987 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6988 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6989 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 6990 | static const struct hda_input_mux alc260_test_capture_sources[2] = { |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6991 | { |
| 6992 | .num_items = 7, |
| 6993 | .items = { |
| 6994 | { "MIC1 pin", 0x0 }, |
| 6995 | { "MIC2 pin", 0x1 }, |
| 6996 | { "LINE1 pin", 0x2 }, |
| 6997 | { "LINE2 pin", 0x3 }, |
| 6998 | { "CD pin", 0x4 }, |
| 6999 | { "LINE-OUT pin", 0x5 }, |
| 7000 | { "HP-OUT pin", 0x6 }, |
| 7001 | }, |
| 7002 | }, |
| 7003 | { |
| 7004 | .num_items = 8, |
| 7005 | .items = { |
| 7006 | { "MIC1 pin", 0x0 }, |
| 7007 | { "MIC2 pin", 0x1 }, |
| 7008 | { "LINE1 pin", 0x2 }, |
| 7009 | { "LINE2 pin", 0x3 }, |
| 7010 | { "CD pin", 0x4 }, |
| 7011 | { "Mixer", 0x5 }, |
| 7012 | { "LINE-OUT pin", 0x6 }, |
| 7013 | { "HP-OUT pin", 0x7 }, |
| 7014 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7015 | }, |
| 7016 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7017 | static const struct snd_kcontrol_new alc260_test_mixer[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7018 | /* Output driver widgets */ |
| 7019 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 7020 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 7021 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 7022 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 7023 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 7024 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 7025 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7026 | /* Modes for retasking pin widgets |
| 7027 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 7028 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 7029 | * mention this restriction. At this stage it's not clear whether |
| 7030 | * this behaviour is intentional or is a hardware bug in chip |
| 7031 | * revisions available at least up until early 2006. Therefore for |
| 7032 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 7033 | * choices, but if it turns out that the lack of mic bias for these |
| 7034 | * NIDs is intentional we could change their modes from |
| 7035 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 7036 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7037 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 7038 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 7039 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 7040 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 7041 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 7042 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 7043 | |
| 7044 | /* Loopback mixer controls */ |
| 7045 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 7046 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 7047 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 7048 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 7049 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 7050 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 7051 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 7052 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 7053 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 7054 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7055 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 7056 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 7057 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 7058 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 7059 | |
| 7060 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 7061 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 7062 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 7063 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 7064 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 7065 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 7066 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 7067 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7068 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 7069 | */ |
| 7070 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 7071 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 7072 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 7073 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 7074 | * this output to turn on an external amplifier. |
| 7075 | */ |
| 7076 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 7077 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 7078 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7079 | { } /* end */ |
| 7080 | }; |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7081 | static const struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 7082 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 7083 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 7084 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 7085 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 7086 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7087 | /* Enable retasking pins as output, initially without power amp */ |
| 7088 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7089 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7090 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7091 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7092 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7093 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7094 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 7095 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 7096 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 7097 | * payload also sets the generation to 0, output to be in "consumer" |
| 7098 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 7099 | * control. |
| 7100 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7101 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 7102 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 7103 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7104 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7105 | * OUT1 sum bus when acting as an output. |
| 7106 | */ |
| 7107 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7108 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7109 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7110 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 7111 | |
| 7112 | /* Start with output sum widgets muted and their output gains at min */ |
| 7113 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7114 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7115 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7117 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7118 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7119 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7120 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7121 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7122 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 7123 | /* Unmute retasking pin widget output buffers since the default |
| 7124 | * state appears to be output. As the pin mode is changed by the |
| 7125 | * user the pin mode control will take care of enabling the pin's |
| 7126 | * input/output buffers as needed. |
| 7127 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7128 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7129 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7130 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7131 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7132 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7133 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7134 | /* Also unmute the mono-out pin widget */ |
| 7135 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7136 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7137 | /* Mute capture amp left and right */ |
| 7138 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 7139 | /* Set ADC connection select to match default mixer setting (mic1 |
| 7140 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7141 | */ |
| 7142 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7143 | |
| 7144 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 7145 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7146 | */ |
| 7147 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7148 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7149 | |
| 7150 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 7151 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 7152 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 7153 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 7154 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 7155 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 7156 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 7157 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 7158 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 7159 | |
| 7160 | { } |
| 7161 | }; |
| 7162 | #endif |
| 7163 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7164 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 7165 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7166 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7167 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 7168 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 7169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7170 | /* |
| 7171 | * for BIOS auto-configuration |
| 7172 | */ |
| 7173 | |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7174 | /* convert from pin to volume-mixer widget */ |
| 7175 | static hda_nid_t alc260_pin_to_vol_mix(hda_nid_t nid) |
| 7176 | { |
| 7177 | if (nid >= 0x0f && nid <= 0x11) |
| 7178 | return nid - 0x7; |
| 7179 | else if (nid >= 0x12 && nid <= 0x15) |
| 7180 | return 0x08; |
| 7181 | else |
| 7182 | return 0; |
| 7183 | } |
| 7184 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7185 | 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] | 7186 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7187 | { |
| 7188 | hda_nid_t nid_vol; |
| 7189 | unsigned long vol_val, sw_val; |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7190 | int chs, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7191 | |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7192 | nid_vol = alc260_pin_to_vol_mix(nid); |
| 7193 | if (!nid_vol) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7194 | return 0; /* N/A */ |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7195 | if (nid == 0x11) |
| 7196 | chs = 2; |
| 7197 | else |
| 7198 | chs = 3; |
| 7199 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, chs, 0, HDA_OUTPUT); |
| 7200 | sw_val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7201 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7202 | if (!(*vol_bits & (1 << nid_vol))) { |
| 7203 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7204 | 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] | 7205 | if (err < 0) |
| 7206 | return err; |
| 7207 | *vol_bits |= (1 << nid_vol); |
| 7208 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 7209 | 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] | 7210 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7211 | return err; |
| 7212 | return 1; |
| 7213 | } |
| 7214 | |
| 7215 | /* add playback controls from the parsed DAC table */ |
| 7216 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 7217 | const struct auto_pin_cfg *cfg) |
| 7218 | { |
| 7219 | hda_nid_t nid; |
| 7220 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7221 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7222 | |
| 7223 | spec->multiout.num_dacs = 1; |
| 7224 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 7225 | spec->private_dac_nids[0] = 0x02; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7226 | |
| 7227 | nid = cfg->line_out_pins[0]; |
| 7228 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 7229 | const char *pfx; |
Takashi Iwai | 2e925dd | 2011-06-24 11:27:22 +0200 | [diff] [blame] | 7230 | int index; |
| 7231 | pfx = alc_get_line_out_pfx(spec, 0, true, &index); |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 7232 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7233 | if (err < 0) |
| 7234 | return err; |
| 7235 | } |
| 7236 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7237 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7238 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7239 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7240 | if (err < 0) |
| 7241 | return err; |
| 7242 | } |
| 7243 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7244 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7245 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 7246 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 7247 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7248 | if (err < 0) |
| 7249 | return err; |
| 7250 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7251 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7252 | } |
| 7253 | |
| 7254 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7255 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7256 | const struct auto_pin_cfg *cfg) |
| 7257 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7258 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7259 | } |
| 7260 | |
| 7261 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7262 | hda_nid_t nid, int pin_type, |
| 7263 | int sel_idx) |
| 7264 | { |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7265 | hda_nid_t mix; |
| 7266 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7267 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7268 | /* need the manual connection? */ |
| 7269 | if (nid >= 0x12) { |
| 7270 | int idx = nid - 0x12; |
| 7271 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 7272 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7273 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7274 | |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7275 | mix = alc260_pin_to_vol_mix(nid); |
| 7276 | if (!mix) |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7277 | return; |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7278 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7279 | AMP_OUT_ZERO); |
Takashi Iwai | 6d86b4f | 2011-06-27 15:00:48 +0200 | [diff] [blame] | 7280 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7281 | AMP_IN_UNMUTE(0)); |
| 7282 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7283 | AMP_IN_UNMUTE(1)); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7284 | } |
| 7285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7286 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 7287 | { |
| 7288 | struct alc_spec *spec = codec->spec; |
| 7289 | hda_nid_t nid; |
| 7290 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7291 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7292 | if (nid) { |
| 7293 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 7294 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 7295 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7296 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 7297 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7298 | if (nid) |
| 7299 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 7300 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7301 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7302 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7303 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7304 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7305 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7306 | #define alc260_auto_init_analog_input alc880_auto_init_analog_input |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7307 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 7308 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7309 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 7310 | { |
| 7311 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7312 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7313 | static const hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7314 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7315 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 7316 | alc260_ignore); |
| 7317 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7318 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7319 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 7320 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 7321 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7322 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7323 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 7324 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7325 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7326 | return err; |
| 7327 | |
| 7328 | spec->multiout.max_channels = 2; |
| 7329 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 7330 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7331 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 7332 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 7333 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7334 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7335 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 7336 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7337 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 7338 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 7339 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7340 | return 1; |
| 7341 | } |
| 7342 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7343 | /* additional initialization for auto-configuration model */ |
| 7344 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7345 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7346 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7347 | alc260_auto_init_multi_out(codec); |
| 7348 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 7349 | alc260_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 7350 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7351 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 7352 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7353 | } |
| 7354 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7355 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7356 | static const struct hda_amp_list alc260_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7357 | { 0x07, HDA_INPUT, 0 }, |
| 7358 | { 0x07, HDA_INPUT, 1 }, |
| 7359 | { 0x07, HDA_INPUT, 2 }, |
| 7360 | { 0x07, HDA_INPUT, 3 }, |
| 7361 | { 0x07, HDA_INPUT, 4 }, |
| 7362 | { } /* end */ |
| 7363 | }; |
| 7364 | #endif |
| 7365 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7366 | /* |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7367 | * Pin config fixes |
| 7368 | */ |
| 7369 | enum { |
| 7370 | PINFIX_HP_DC5750, |
| 7371 | }; |
| 7372 | |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7373 | static const struct alc_fixup alc260_fixups[] = { |
| 7374 | [PINFIX_HP_DC5750] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7375 | .type = ALC_FIXUP_PINS, |
| 7376 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 7377 | { 0x11, 0x90130110 }, /* speaker */ |
| 7378 | { } |
| 7379 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7380 | }, |
| 7381 | }; |
| 7382 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7383 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7384 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), |
| 7385 | {} |
| 7386 | }; |
| 7387 | |
| 7388 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7389 | * ALC260 configurations |
| 7390 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 7391 | static const char * const alc260_models[ALC260_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7392 | [ALC260_BASIC] = "basic", |
| 7393 | [ALC260_HP] = "hp", |
| 7394 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 7395 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7396 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 7397 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7398 | [ALC260_WILL] = "will", |
| 7399 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7400 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7401 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7402 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7403 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7404 | [ALC260_AUTO] = "auto", |
| 7405 | }; |
| 7406 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7407 | static const struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 7408 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 7409 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7410 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7411 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 7412 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 7413 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7414 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 7415 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7416 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7417 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 7418 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 7419 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 7420 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 7421 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 7422 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 7423 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 7424 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 7425 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7426 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7427 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7428 | {} |
| 7429 | }; |
| 7430 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7431 | static const struct alc_config_preset alc260_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7432 | [ALC260_BASIC] = { |
| 7433 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7434 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7435 | .init_verbs = { alc260_init_verbs }, |
| 7436 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7437 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7438 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 7439 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7440 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7441 | .channel_mode = alc260_modes, |
| 7442 | .input_mux = &alc260_capture_source, |
| 7443 | }, |
| 7444 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7445 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7446 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7447 | .init_verbs = { alc260_init_verbs, |
| 7448 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7449 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7450 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7451 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7452 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7453 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7454 | .channel_mode = alc260_modes, |
| 7455 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7456 | .unsol_event = alc_sku_unsol_event, |
| 7457 | .setup = alc260_hp_setup, |
| 7458 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7459 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7460 | [ALC260_HP_DC7600] = { |
| 7461 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7462 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7463 | .init_verbs = { alc260_init_verbs, |
| 7464 | alc260_hp_dc7600_verbs }, |
| 7465 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7466 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7467 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7468 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7469 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7470 | .channel_mode = alc260_modes, |
| 7471 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7472 | .unsol_event = alc_sku_unsol_event, |
| 7473 | .setup = alc260_hp_3012_setup, |
| 7474 | .init_hook = alc_inithook, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 7475 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7476 | [ALC260_HP_3013] = { |
| 7477 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7478 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 7479 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 7480 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7481 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7482 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7483 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 7484 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7485 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7486 | .channel_mode = alc260_modes, |
| 7487 | .input_mux = &alc260_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 7488 | .unsol_event = alc_sku_unsol_event, |
| 7489 | .setup = alc260_hp_3013_setup, |
| 7490 | .init_hook = alc_inithook, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7491 | }, |
| 7492 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7493 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7494 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 7495 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7496 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 7497 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7498 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7499 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7500 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7501 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 7502 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7503 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7504 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7505 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7506 | .init_verbs = { alc260_acer_init_verbs }, |
| 7507 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7508 | .dac_nids = alc260_dac_nids, |
| 7509 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7510 | .adc_nids = alc260_dual_adc_nids, |
| 7511 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7512 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7513 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 7514 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 7515 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 7516 | [ALC260_FAVORIT100] = { |
| 7517 | .mixers = { alc260_favorit100_mixer }, |
| 7518 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 7519 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7520 | .dac_nids = alc260_dac_nids, |
| 7521 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 7522 | .adc_nids = alc260_dual_adc_nids, |
| 7523 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7524 | .channel_mode = alc260_modes, |
| 7525 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 7526 | .input_mux = alc260_favorit100_capture_sources, |
| 7527 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7528 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7529 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7530 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 7531 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7532 | .dac_nids = alc260_dac_nids, |
| 7533 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7534 | .adc_nids = alc260_adc_nids, |
| 7535 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7536 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7537 | .channel_mode = alc260_modes, |
| 7538 | .input_mux = &alc260_capture_source, |
| 7539 | }, |
| 7540 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7541 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7542 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 7543 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 7544 | .dac_nids = alc260_dac_nids, |
| 7545 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 7546 | .adc_nids = alc260_adc_nids, |
| 7547 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 7548 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7549 | .channel_mode = alc260_modes, |
| 7550 | .input_mux = &alc260_capture_source, |
| 7551 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 7552 | .init_hook = alc260_replacer_672v_automute, |
| 7553 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7554 | #ifdef CONFIG_SND_DEBUG |
| 7555 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7556 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7557 | .init_verbs = { alc260_test_init_verbs }, |
| 7558 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 7559 | .dac_nids = alc260_test_dac_nids, |
| 7560 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 7561 | .adc_nids = alc260_test_adc_nids, |
| 7562 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 7563 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 7564 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 7565 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 7566 | }, |
| 7567 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7568 | }; |
| 7569 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7570 | static int patch_alc260(struct hda_codec *codec) |
| 7571 | { |
| 7572 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7573 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7574 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 7575 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7576 | if (spec == NULL) |
| 7577 | return -ENOMEM; |
| 7578 | |
| 7579 | codec->spec = spec; |
| 7580 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 7581 | spec->mixer_nid = 0x07; |
| 7582 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7583 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 7584 | alc260_models, |
| 7585 | alc260_cfg_tbl); |
| 7586 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 7587 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 7588 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7589 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7590 | } |
| 7591 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7592 | if (board_config == ALC260_AUTO) { |
| 7593 | alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups); |
| 7594 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 7595 | } |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7596 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7597 | if (board_config == ALC260_AUTO) { |
| 7598 | /* automatic parse from the BIOS config */ |
| 7599 | err = alc260_parse_auto_config(codec); |
| 7600 | if (err < 0) { |
| 7601 | alc_free(codec); |
| 7602 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7603 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7604 | printk(KERN_INFO |
| 7605 | "hda_codec: Cannot set up configuration " |
| 7606 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7607 | board_config = ALC260_BASIC; |
| 7608 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7609 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7610 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 7611 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 7612 | if (err < 0) { |
| 7613 | alc_free(codec); |
| 7614 | return err; |
| 7615 | } |
| 7616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7617 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 7618 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7619 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7620 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 7621 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
Jonathan Woithe | 53bacfb | 2010-08-08 00:17:05 +0930 | [diff] [blame] | 7622 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7623 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 7624 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 7625 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 7626 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7627 | if (!spec->adc_nids && spec->input_mux) { |
| 7628 | /* check whether NID 0x04 is valid */ |
| 7629 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 7630 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 7631 | /* get type */ |
| 7632 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 7633 | spec->adc_nids = alc260_adc_nids_alt; |
| 7634 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 7635 | } else { |
| 7636 | spec->adc_nids = alc260_adc_nids; |
| 7637 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 7638 | } |
| 7639 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 7640 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7641 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7642 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 7643 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | fc09176 | 2010-08-04 23:53:36 +0200 | [diff] [blame] | 7644 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7645 | spec->vmaster_nid = 0x08; |
| 7646 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7647 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7648 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 7649 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 7650 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7651 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7652 | if (!spec->loopback.amplist) |
| 7653 | spec->loopback.amplist = alc260_loopbacks; |
| 7654 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7655 | |
| 7656 | return 0; |
| 7657 | } |
| 7658 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7659 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7660 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7661 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7662 | * |
| 7663 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7664 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7665 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7666 | * 6-channel independent captures. |
| 7667 | * |
| 7668 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7669 | * driver yet). |
| 7670 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7671 | #define ALC882_DIGOUT_NID 0x06 |
| 7672 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7673 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7674 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7675 | #define ALC1200_DIGOUT_NID 0x10 |
| 7676 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7677 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7678 | static const struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7679 | { 8, NULL } |
| 7680 | }; |
| 7681 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7682 | /* DACs */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7683 | static const hda_nid_t alc882_dac_nids[4] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7684 | /* front, rear, clfe, rear_surr */ |
| 7685 | 0x02, 0x03, 0x04, 0x05 |
| 7686 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7687 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7688 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7689 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7690 | #define alc882_adc_nids alc880_adc_nids |
| 7691 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7692 | #define alc883_adc_nids alc882_adc_nids_alt |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7693 | static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7694 | static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7695 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7696 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7697 | static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7698 | static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7699 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7700 | static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7701 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7702 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7703 | /* input MUX */ |
| 7704 | /* FIXME: should be a matrix-type input source selection */ |
| 7705 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7706 | static const struct hda_input_mux alc882_capture_source = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7707 | .num_items = 4, |
| 7708 | .items = { |
| 7709 | { "Mic", 0x0 }, |
| 7710 | { "Front Mic", 0x1 }, |
| 7711 | { "Line", 0x2 }, |
| 7712 | { "CD", 0x4 }, |
| 7713 | }, |
| 7714 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7715 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7716 | #define alc883_capture_source alc882_capture_source |
| 7717 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7718 | static const struct hda_input_mux alc889_capture_source = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7719 | .num_items = 3, |
| 7720 | .items = { |
| 7721 | { "Front Mic", 0x0 }, |
| 7722 | { "Mic", 0x3 }, |
| 7723 | { "Line", 0x2 }, |
| 7724 | }, |
| 7725 | }; |
| 7726 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7727 | static const struct hda_input_mux mb5_capture_source = { |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7728 | .num_items = 3, |
| 7729 | .items = { |
| 7730 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7731 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7732 | { "CD", 0x4 }, |
| 7733 | }, |
| 7734 | }; |
| 7735 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7736 | static const struct hda_input_mux macmini3_capture_source = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7737 | .num_items = 2, |
| 7738 | .items = { |
| 7739 | { "Line", 0x2 }, |
| 7740 | { "CD", 0x4 }, |
| 7741 | }, |
| 7742 | }; |
| 7743 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7744 | static const struct hda_input_mux alc883_3stack_6ch_intel = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7745 | .num_items = 4, |
| 7746 | .items = { |
| 7747 | { "Mic", 0x1 }, |
| 7748 | { "Front Mic", 0x0 }, |
| 7749 | { "Line", 0x2 }, |
| 7750 | { "CD", 0x4 }, |
| 7751 | }, |
| 7752 | }; |
| 7753 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7754 | static const struct hda_input_mux alc883_lenovo_101e_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7755 | .num_items = 2, |
| 7756 | .items = { |
| 7757 | { "Mic", 0x1 }, |
| 7758 | { "Line", 0x2 }, |
| 7759 | }, |
| 7760 | }; |
| 7761 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7762 | static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7763 | .num_items = 4, |
| 7764 | .items = { |
| 7765 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7766 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7767 | { "Line", 0x2 }, |
| 7768 | { "CD", 0x4 }, |
| 7769 | }, |
| 7770 | }; |
| 7771 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7772 | static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7773 | .num_items = 2, |
| 7774 | .items = { |
| 7775 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 7776 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7777 | }, |
| 7778 | }; |
| 7779 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7780 | static const struct hda_input_mux alc883_lenovo_sky_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7781 | .num_items = 3, |
| 7782 | .items = { |
| 7783 | { "Mic", 0x0 }, |
| 7784 | { "Front Mic", 0x1 }, |
| 7785 | { "Line", 0x4 }, |
| 7786 | }, |
| 7787 | }; |
| 7788 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7789 | static const struct hda_input_mux alc883_asus_eee1601_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7790 | .num_items = 2, |
| 7791 | .items = { |
| 7792 | { "Mic", 0x0 }, |
| 7793 | { "Line", 0x2 }, |
| 7794 | }, |
| 7795 | }; |
| 7796 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7797 | static const struct hda_input_mux alc889A_mb31_capture_source = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7798 | .num_items = 2, |
| 7799 | .items = { |
| 7800 | { "Mic", 0x0 }, |
| 7801 | /* Front Mic (0x01) unused */ |
| 7802 | { "Line", 0x2 }, |
| 7803 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7804 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7805 | }, |
| 7806 | }; |
| 7807 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7808 | static const struct hda_input_mux alc889A_imac91_capture_source = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7809 | .num_items = 2, |
| 7810 | .items = { |
| 7811 | { "Mic", 0x01 }, |
| 7812 | { "Line", 0x2 }, /* Not sure! */ |
| 7813 | }, |
| 7814 | }; |
| 7815 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7816 | /* |
| 7817 | * 2ch mode |
| 7818 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7819 | static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7820 | { 2, NULL } |
| 7821 | }; |
| 7822 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7823 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7824 | * 2ch mode |
| 7825 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7826 | static const struct hda_verb alc882_3ST_ch2_init[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7827 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7828 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7829 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7830 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7831 | { } /* end */ |
| 7832 | }; |
| 7833 | |
| 7834 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7835 | * 4ch mode |
| 7836 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7837 | static const struct hda_verb alc882_3ST_ch4_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7838 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7839 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7840 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7841 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7842 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7843 | { } /* end */ |
| 7844 | }; |
| 7845 | |
| 7846 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7847 | * 6ch mode |
| 7848 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7849 | static const struct hda_verb alc882_3ST_ch6_init[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7850 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7851 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7852 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7853 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7854 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7855 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7856 | { } /* end */ |
| 7857 | }; |
| 7858 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7859 | static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7860 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7861 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7862 | { 6, alc882_3ST_ch6_init }, |
| 7863 | }; |
| 7864 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7865 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7866 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7867 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7868 | * 2ch mode |
| 7869 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7870 | static const struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7871 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7872 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7873 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7874 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7875 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7876 | { } /* end */ |
| 7877 | }; |
| 7878 | |
| 7879 | /* |
| 7880 | * 4ch mode |
| 7881 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7882 | static const struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7883 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7884 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7885 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7886 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7887 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7888 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7889 | { } /* end */ |
| 7890 | }; |
| 7891 | |
| 7892 | /* |
| 7893 | * 6ch mode |
| 7894 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7895 | static const struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7896 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7897 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7898 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7899 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7900 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7901 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7902 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7903 | { } /* end */ |
| 7904 | }; |
| 7905 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7906 | 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] | 7907 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7908 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7909 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7910 | }; |
| 7911 | |
| 7912 | |
| 7913 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7914 | * 6ch mode |
| 7915 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7916 | static const struct hda_verb alc882_sixstack_ch6_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7917 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7918 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7919 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7920 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7921 | { } /* end */ |
| 7922 | }; |
| 7923 | |
| 7924 | /* |
| 7925 | * 8ch mode |
| 7926 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7927 | static const struct hda_verb alc882_sixstack_ch8_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7928 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7929 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7930 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7931 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7932 | { } /* end */ |
| 7933 | }; |
| 7934 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7935 | static const struct hda_channel_mode alc882_sixstack_modes[2] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7936 | { 6, alc882_sixstack_ch6_init }, |
| 7937 | { 8, alc882_sixstack_ch8_init }, |
| 7938 | }; |
| 7939 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7940 | |
| 7941 | /* Macbook Air 2,1 */ |
| 7942 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7943 | static const struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7944 | { 2, NULL }, |
| 7945 | }; |
| 7946 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7947 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7948 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7949 | */ |
| 7950 | |
| 7951 | /* |
| 7952 | * 2ch mode |
| 7953 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7954 | static const struct hda_verb alc885_mbp_ch2_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7955 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7956 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7957 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7958 | { } /* end */ |
| 7959 | }; |
| 7960 | |
| 7961 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7962 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7963 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7964 | static const struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7965 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7966 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7967 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7968 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7969 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7970 | { } /* end */ |
| 7971 | }; |
| 7972 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7973 | static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7974 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7975 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7976 | }; |
| 7977 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7978 | /* |
| 7979 | * 2ch |
| 7980 | * Speakers/Woofer/HP = Front |
| 7981 | * LineIn = Input |
| 7982 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7983 | static const struct hda_verb alc885_mb5_ch2_init[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7984 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7985 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7986 | { } /* end */ |
| 7987 | }; |
| 7988 | |
| 7989 | /* |
| 7990 | * 6ch mode |
| 7991 | * Speakers/HP = Front |
| 7992 | * Woofer = LFE |
| 7993 | * LineIn = Surround |
| 7994 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 7995 | static const struct hda_verb alc885_mb5_ch6_init[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7996 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7997 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7998 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7999 | { } /* end */ |
| 8000 | }; |
| 8001 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8002 | static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8003 | { 2, alc885_mb5_ch2_init }, |
| 8004 | { 6, alc885_mb5_ch6_init }, |
| 8005 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8006 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 8007 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8008 | |
| 8009 | /* |
| 8010 | * 2ch mode |
| 8011 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8012 | static const struct hda_verb alc883_4ST_ch2_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8013 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8014 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8015 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8016 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8017 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8018 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8019 | { } /* end */ |
| 8020 | }; |
| 8021 | |
| 8022 | /* |
| 8023 | * 4ch mode |
| 8024 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8025 | static const struct hda_verb alc883_4ST_ch4_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8026 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8027 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8028 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8029 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8030 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8031 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8032 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8033 | { } /* end */ |
| 8034 | }; |
| 8035 | |
| 8036 | /* |
| 8037 | * 6ch mode |
| 8038 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8039 | static const struct hda_verb alc883_4ST_ch6_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8040 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8041 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8042 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8043 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8044 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8045 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8046 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8047 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8048 | { } /* end */ |
| 8049 | }; |
| 8050 | |
| 8051 | /* |
| 8052 | * 8ch mode |
| 8053 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8054 | static const struct hda_verb alc883_4ST_ch8_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8055 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8056 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8057 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8058 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8059 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8060 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8061 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8062 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8063 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8064 | { } /* end */ |
| 8065 | }; |
| 8066 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8067 | static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8068 | { 2, alc883_4ST_ch2_init }, |
| 8069 | { 4, alc883_4ST_ch4_init }, |
| 8070 | { 6, alc883_4ST_ch6_init }, |
| 8071 | { 8, alc883_4ST_ch8_init }, |
| 8072 | }; |
| 8073 | |
| 8074 | |
| 8075 | /* |
| 8076 | * 2ch mode |
| 8077 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8078 | static const struct hda_verb alc883_3ST_ch2_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8079 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8080 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8081 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8082 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8083 | { } /* end */ |
| 8084 | }; |
| 8085 | |
| 8086 | /* |
| 8087 | * 4ch mode |
| 8088 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8089 | static const struct hda_verb alc883_3ST_ch4_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8090 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8091 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8092 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8093 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8094 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8095 | { } /* end */ |
| 8096 | }; |
| 8097 | |
| 8098 | /* |
| 8099 | * 6ch mode |
| 8100 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8101 | static const struct hda_verb alc883_3ST_ch6_intel_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8102 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8103 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8104 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8105 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8106 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8107 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8108 | { } /* end */ |
| 8109 | }; |
| 8110 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8111 | static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8112 | { 2, alc883_3ST_ch2_intel_init }, |
| 8113 | { 4, alc883_3ST_ch4_intel_init }, |
| 8114 | { 6, alc883_3ST_ch6_intel_init }, |
| 8115 | }; |
| 8116 | |
| 8117 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8118 | * 2ch mode |
| 8119 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8120 | static const struct hda_verb alc889_ch2_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8121 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8122 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8123 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8124 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8125 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8126 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8127 | { } /* end */ |
| 8128 | }; |
| 8129 | |
| 8130 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8131 | * 6ch mode |
| 8132 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8133 | static const struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8134 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8135 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8136 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8137 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8138 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8139 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8140 | { } /* end */ |
| 8141 | }; |
| 8142 | |
| 8143 | /* |
| 8144 | * 8ch mode |
| 8145 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8146 | static const struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8147 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 8148 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8149 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 8150 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 8151 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8152 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8153 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8154 | { } /* end */ |
| 8155 | }; |
| 8156 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8157 | static const struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 8158 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8159 | { 6, alc889_ch6_intel_init }, |
| 8160 | { 8, alc889_ch8_intel_init }, |
| 8161 | }; |
| 8162 | |
| 8163 | /* |
| 8164 | * 6ch mode |
| 8165 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8166 | static const struct hda_verb alc883_sixstack_ch6_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8167 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 8168 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8169 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8170 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8171 | { } /* end */ |
| 8172 | }; |
| 8173 | |
| 8174 | /* |
| 8175 | * 8ch mode |
| 8176 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8177 | static const struct hda_verb alc883_sixstack_ch8_init[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8178 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8179 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8180 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8181 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8182 | { } /* end */ |
| 8183 | }; |
| 8184 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8185 | static const struct hda_channel_mode alc883_sixstack_modes[2] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8186 | { 6, alc883_sixstack_ch6_init }, |
| 8187 | { 8, alc883_sixstack_ch8_init }, |
| 8188 | }; |
| 8189 | |
| 8190 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8191 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 8192 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 8193 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8194 | static const struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8195 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8196 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8197 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8198 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8199 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8200 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8201 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8202 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8203 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 8204 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8205 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8206 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8207 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8209 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8211 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8212 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8213 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8214 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8215 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8216 | { } /* end */ |
| 8217 | }; |
| 8218 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8219 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 8220 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8221 | static const struct snd_kcontrol_new alc885_mba21_mixer[] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8222 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8223 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 8224 | { } |
| 8225 | }; |
| 8226 | |
| 8227 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8228 | static const struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8229 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8230 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8231 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8232 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8233 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8234 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8235 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8236 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8237 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8238 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
| 8239 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8240 | { } /* end */ |
| 8241 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8242 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8243 | static const struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8244 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8245 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8246 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8247 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8248 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8249 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8250 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8251 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8252 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8253 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8254 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8255 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8256 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
| 8257 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8258 | { } /* end */ |
| 8259 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8260 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8261 | static const struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8263 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8264 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8265 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8266 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 8267 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 8268 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 8269 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 8270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 8271 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8272 | HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8273 | { } /* end */ |
| 8274 | }; |
| 8275 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8276 | static const struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8277 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8278 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8279 | { } /* end */ |
| 8280 | }; |
| 8281 | |
| 8282 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8283 | static const struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8284 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8285 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8286 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8287 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8288 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8289 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8290 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8291 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 8293 | { } /* end */ |
| 8294 | }; |
| 8295 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8296 | static const struct snd_kcontrol_new alc882_targa_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8297 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8298 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8299 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8300 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8301 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8302 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8303 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8306 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8307 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8308 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8309 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8310 | { } /* end */ |
| 8311 | }; |
| 8312 | |
| 8313 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 8314 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 8315 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8316 | static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8317 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8318 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8319 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8320 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 8321 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8322 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8323 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8324 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8325 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 8326 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 8327 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8328 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8329 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8330 | { } /* end */ |
| 8331 | }; |
| 8332 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8333 | static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8334 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8335 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8336 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8337 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8338 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8339 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8340 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8341 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 8342 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8343 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8344 | { } /* end */ |
| 8345 | }; |
| 8346 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8347 | static const struct snd_kcontrol_new alc882_chmode_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8348 | { |
| 8349 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8350 | .name = "Channel Mode", |
| 8351 | .info = alc_ch_mode_info, |
| 8352 | .get = alc_ch_mode_get, |
| 8353 | .put = alc_ch_mode_put, |
| 8354 | }, |
| 8355 | { } /* end */ |
| 8356 | }; |
| 8357 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8358 | static const struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8359 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8360 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8361 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8362 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8363 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8364 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8365 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8366 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8367 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8368 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8369 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8370 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8371 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8372 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8373 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8374 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8375 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8376 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8377 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8378 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8379 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8380 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8381 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8382 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8383 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8384 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8385 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8386 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8387 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8388 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8389 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8390 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8391 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 8392 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8393 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8394 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8395 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 8396 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8397 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 8398 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8399 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8400 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8401 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8402 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8403 | |
| 8404 | /* FIXME: use matrix-type input source selection */ |
| 8405 | /* 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] | 8406 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8407 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8408 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8409 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8410 | /* ADC2: mute amp left and right */ |
| 8411 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8412 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 8413 | /* ADC3: mute amp left and right */ |
| 8414 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 8415 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8416 | |
| 8417 | { } |
| 8418 | }; |
| 8419 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8420 | static const struct hda_verb alc882_adc1_init_verbs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8421 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8422 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8423 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8425 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8426 | /* ADC1: mute amp left and right */ |
| 8427 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8428 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8429 | { } |
| 8430 | }; |
| 8431 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8432 | static const struct hda_verb alc882_eapd_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8433 | /* change to EAPD mode */ |
| 8434 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8435 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8436 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 8437 | }; |
| 8438 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8439 | static const struct hda_verb alc889_eapd_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8440 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8441 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 8442 | { } |
| 8443 | }; |
| 8444 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8445 | static const struct hda_verb alc_hp15_unsol_verbs[] = { |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8446 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8448 | {} |
| 8449 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8450 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8451 | static const struct hda_verb alc885_init_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8452 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8453 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8454 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8455 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8456 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8457 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8458 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8459 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8460 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8461 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8462 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8463 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8464 | |
| 8465 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 8466 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8467 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8468 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8469 | /* Front Pin: output 0 (0x0c) */ |
| 8470 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8471 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8472 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8473 | /* Rear Pin: output 1 (0x0d) */ |
| 8474 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8475 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8476 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8477 | /* CLFE Pin: output 2 (0x0e) */ |
| 8478 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8479 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8480 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8481 | /* Side Pin: output 3 (0x0f) */ |
| 8482 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8483 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8484 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8485 | /* Mic (rear) pin: input vref at 80% */ |
| 8486 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8487 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8488 | /* Front Mic pin: input vref at 80% */ |
| 8489 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8490 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8491 | /* Line In pin: input */ |
| 8492 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8493 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8494 | |
| 8495 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 8496 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8497 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8498 | /* Input mixer2 */ |
| 8499 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8500 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8501 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8502 | /* ADC2: mute amp left and right */ |
| 8503 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8504 | /* ADC3: mute amp left and right */ |
| 8505 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8506 | |
| 8507 | { } |
| 8508 | }; |
| 8509 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8510 | static const struct hda_verb alc885_init_input_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8511 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8512 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 8513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 8514 | { } |
| 8515 | }; |
| 8516 | |
| 8517 | |
| 8518 | /* Unmute Selector 24h and set the default input to front mic */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8519 | static const struct hda_verb alc889_init_input_verbs[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8520 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8521 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8522 | { } |
| 8523 | }; |
| 8524 | |
| 8525 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8526 | #define alc883_init_verbs alc882_base_init_verbs |
| 8527 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8528 | /* Mac Pro test */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8529 | static const struct snd_kcontrol_new alc882_macpro_mixer[] = { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8530 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8531 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8532 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 8533 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8534 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8535 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 8536 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8537 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 8538 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8539 | { } /* end */ |
| 8540 | }; |
| 8541 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8542 | static const struct hda_verb alc882_macpro_init_verbs[] = { |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8543 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8544 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8545 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8547 | /* Front Pin: output 0 (0x0c) */ |
| 8548 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8549 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8550 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8551 | /* Front Mic pin: input vref at 80% */ |
| 8552 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8553 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8554 | /* Speaker: output */ |
| 8555 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8556 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8557 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 8558 | /* Headphone output (output 0 - 0x0c) */ |
| 8559 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8560 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8561 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8562 | |
| 8563 | /* FIXME: use matrix-type input source selection */ |
| 8564 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8565 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8566 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8567 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8568 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8569 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8570 | /* Input mixer2 */ |
| 8571 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8572 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8573 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8574 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8575 | /* Input mixer3 */ |
| 8576 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8577 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8580 | /* ADC1: mute amp left and right */ |
| 8581 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8582 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8583 | /* ADC2: mute amp left and right */ |
| 8584 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8585 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8586 | /* ADC3: mute amp left and right */ |
| 8587 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8588 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8589 | |
| 8590 | { } |
| 8591 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8592 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8593 | /* Macbook 5,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8594 | static const struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8595 | /* DACs */ |
| 8596 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8597 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8598 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8599 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8600 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8602 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8604 | /* Surround mixer */ |
| 8605 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8607 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8608 | /* LFE mixer */ |
| 8609 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8610 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8612 | /* HP mixer */ |
| 8613 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8614 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8615 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8616 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8617 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8618 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8619 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8620 | /* LFE Pin (0x0e) */ |
| 8621 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8622 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8623 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8624 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8625 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8626 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 8627 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8628 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8629 | /* Front Mic pin: input vref at 80% */ |
| 8630 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8631 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8632 | /* Line In pin */ |
| 8633 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8634 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8635 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 8636 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 8637 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 8638 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 8639 | { } |
| 8640 | }; |
| 8641 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8642 | /* Macmini 3,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8643 | static const struct hda_verb alc885_macmini3_init_verbs[] = { |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 8644 | /* DACs */ |
| 8645 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8646 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8647 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8648 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8649 | /* Front mixer */ |
| 8650 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8651 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8652 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8653 | /* Surround mixer */ |
| 8654 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8655 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8656 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8657 | /* LFE mixer */ |
| 8658 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8659 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8660 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8661 | /* HP mixer */ |
| 8662 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8663 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8664 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8665 | /* Front Pin (0x0c) */ |
| 8666 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8667 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8668 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8669 | /* LFE Pin (0x0e) */ |
| 8670 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8671 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8672 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8673 | /* HP Pin (0x0f) */ |
| 8674 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8675 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8676 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8677 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8678 | /* Line In pin */ |
| 8679 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8680 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8681 | |
| 8682 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8683 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8684 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8685 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8686 | { } |
| 8687 | }; |
| 8688 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8689 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8690 | static const struct hda_verb alc885_mba21_init_verbs[] = { |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8691 | /*Internal and HP Speaker Mixer*/ |
| 8692 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8695 | /*Internal Speaker Pin (0x0c)*/ |
| 8696 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8697 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8698 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8699 | /* HP Pin: output 0 (0x0e) */ |
| 8700 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8701 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8702 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8703 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8704 | /* Line in (is hp when jack connected)*/ |
| 8705 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8706 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8707 | |
| 8708 | { } |
| 8709 | }; |
| 8710 | |
| 8711 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8712 | /* Macbook Pro rev3 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8713 | static const struct hda_verb alc885_mbp3_init_verbs[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8714 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8716 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8717 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8718 | /* Rear mixer */ |
| 8719 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8720 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8721 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8722 | /* HP mixer */ |
| 8723 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8724 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8725 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8726 | /* Front Pin: output 0 (0x0c) */ |
| 8727 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8728 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8729 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8730 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8732 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8733 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8734 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8735 | /* Mic (rear) pin: input vref at 80% */ |
| 8736 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8737 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8738 | /* Front Mic pin: input vref at 80% */ |
| 8739 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8740 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8741 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8742 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8743 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8744 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8745 | |
| 8746 | /* FIXME: use matrix-type input source selection */ |
| 8747 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8748 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8752 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8753 | /* Input mixer2 */ |
| 8754 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8755 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8756 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8757 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8758 | /* Input mixer3 */ |
| 8759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8762 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8763 | /* ADC1: mute amp left and right */ |
| 8764 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8765 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8766 | /* ADC2: mute amp left and right */ |
| 8767 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8768 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8769 | /* ADC3: mute amp left and right */ |
| 8770 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8771 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8772 | |
| 8773 | { } |
| 8774 | }; |
| 8775 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8776 | /* iMac 9,1 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8777 | static const struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8778 | /* Internal Speaker Pin (0x0c) */ |
| 8779 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8781 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8782 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8783 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8784 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8785 | /* HP Pin: Rear */ |
| 8786 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8787 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8788 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8789 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8790 | /* Line in Rear */ |
| 8791 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8793 | /* Front Mic pin: input vref at 80% */ |
| 8794 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8795 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8796 | /* Rear mixer */ |
| 8797 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8798 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8799 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8800 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8801 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8803 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8804 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8805 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8807 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8808 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8809 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8810 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8811 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8812 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8813 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8814 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8815 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8817 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8818 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8819 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8820 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8821 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8822 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8824 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8825 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8826 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8827 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8828 | { } |
| 8829 | }; |
| 8830 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8831 | /* iMac 24 mixer. */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8832 | static const struct snd_kcontrol_new alc885_imac24_mixer[] = { |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8833 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8834 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8835 | { } /* end */ |
| 8836 | }; |
| 8837 | |
| 8838 | /* iMac 24 init verbs. */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8839 | static const struct hda_verb alc885_imac24_init_verbs[] = { |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8840 | /* Internal speakers: output 0 (0x0c) */ |
| 8841 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8842 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8843 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8844 | /* Internal speakers: output 0 (0x0c) */ |
| 8845 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8846 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8847 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8848 | /* Headphone: output 0 (0x0c) */ |
| 8849 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8850 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8851 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8852 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8853 | /* Front Mic: input vref at 80% */ |
| 8854 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8855 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8856 | { } |
| 8857 | }; |
| 8858 | |
| 8859 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8860 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8861 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8862 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8863 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8864 | spec->autocfg.hp_pins[0] = 0x14; |
| 8865 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8866 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8867 | spec->automute = 1; |
| 8868 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8869 | } |
| 8870 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8871 | #define alc885_mb5_setup alc885_imac24_setup |
| 8872 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8873 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8874 | /* Macbook Air 2,1 */ |
| 8875 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8876 | { |
| 8877 | struct alc_spec *spec = codec->spec; |
| 8878 | |
| 8879 | spec->autocfg.hp_pins[0] = 0x14; |
| 8880 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8881 | spec->automute = 1; |
| 8882 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8883 | } |
| 8884 | |
| 8885 | |
| 8886 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8887 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8888 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8889 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8890 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8891 | spec->autocfg.hp_pins[0] = 0x15; |
| 8892 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8893 | spec->automute = 1; |
| 8894 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8895 | } |
| 8896 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8897 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8898 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8899 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8900 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8901 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8902 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8903 | spec->autocfg.speaker_pins[1] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8904 | spec->automute = 1; |
| 8905 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8906 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8907 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8908 | static const struct hda_verb alc882_targa_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8910 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8911 | |
| 8912 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8913 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8914 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8915 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8916 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8917 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8918 | |
| 8919 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8920 | { } /* end */ |
| 8921 | }; |
| 8922 | |
| 8923 | /* toggle speaker-output according to the hp-jack state */ |
| 8924 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8925 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8926 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8927 | alc_hp_automute(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8928 | 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] | 8929 | spec->jack_present ? 1 : 3); |
| 8930 | } |
| 8931 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8932 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8933 | { |
| 8934 | struct alc_spec *spec = codec->spec; |
| 8935 | |
| 8936 | spec->autocfg.hp_pins[0] = 0x14; |
| 8937 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 8938 | spec->automute = 1; |
| 8939 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8940 | } |
| 8941 | |
| 8942 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8943 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8944 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8945 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8946 | } |
| 8947 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8948 | static const struct hda_verb alc882_asus_a7j_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8949 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8951 | |
| 8952 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8953 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8954 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8955 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8956 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8957 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8958 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8959 | |
| 8960 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8961 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8962 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8963 | { } /* end */ |
| 8964 | }; |
| 8965 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 8966 | static const struct hda_verb alc882_asus_a7m_verbs[] = { |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8967 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8969 | |
| 8970 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8971 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8972 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8973 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8974 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8976 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8977 | |
| 8978 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8979 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8980 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8981 | { } /* end */ |
| 8982 | }; |
| 8983 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8984 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8985 | { |
| 8986 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8987 | |
| 8988 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8989 | AC_VERB_GET_GPIO_DATA, 0); |
| 8990 | |
| 8991 | if (!muted) |
| 8992 | gpiostate |= (1 << pin); |
| 8993 | else |
| 8994 | gpiostate &= ~(1 << pin); |
| 8995 | |
| 8996 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8997 | AC_VERB_GET_GPIO_MASK, 0); |
| 8998 | gpiomask |= (1 << pin); |
| 8999 | |
| 9000 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 9001 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 9002 | gpiodir |= (1 << pin); |
| 9003 | |
| 9004 | |
| 9005 | snd_hda_codec_write(codec, codec->afg, 0, |
| 9006 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 9007 | snd_hda_codec_write(codec, codec->afg, 0, |
| 9008 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 9009 | |
| 9010 | msleep(1); |
| 9011 | |
| 9012 | snd_hda_codec_write(codec, codec->afg, 0, |
| 9013 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 9014 | } |
| 9015 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 9016 | /* set up GPIO at initialization */ |
| 9017 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 9018 | { |
| 9019 | alc882_gpio_mute(codec, 0, 0); |
| 9020 | alc882_gpio_mute(codec, 1, 0); |
| 9021 | } |
| 9022 | |
| 9023 | /* set up GPIO and update auto-muting at initialization */ |
| 9024 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 9025 | { |
| 9026 | alc885_macpro_init_hook(codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9027 | alc_hp_automute(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 9028 | } |
| 9029 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9030 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9031 | static const struct hda_verb alc889A_mb31_ch2_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9032 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 9033 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9034 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 9035 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 9036 | { } /* end */ |
| 9037 | }; |
| 9038 | |
| 9039 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9040 | static const struct hda_verb alc889A_mb31_ch4_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9041 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 9042 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9043 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 9044 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 9045 | { } /* end */ |
| 9046 | }; |
| 9047 | |
| 9048 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9049 | static const struct hda_verb alc889A_mb31_ch5_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9050 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 9051 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 9052 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 9053 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 9054 | { } /* end */ |
| 9055 | }; |
| 9056 | |
| 9057 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9058 | static const struct hda_verb alc889A_mb31_ch6_init[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9059 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 9060 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 9061 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 9062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 9063 | { } /* end */ |
| 9064 | }; |
| 9065 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9066 | static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9067 | { 2, alc889A_mb31_ch2_init }, |
| 9068 | { 4, alc889A_mb31_ch4_init }, |
| 9069 | { 5, alc889A_mb31_ch5_init }, |
| 9070 | { 6, alc889A_mb31_ch6_init }, |
| 9071 | }; |
| 9072 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9073 | static const struct hda_verb alc883_medion_eapd_verbs[] = { |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9074 | /* eanable EAPD on medion laptop */ |
| 9075 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9076 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9077 | { } |
| 9078 | }; |
| 9079 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9080 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9081 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9082 | static const struct snd_kcontrol_new alc883_mitac_mixer[] = { |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9083 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9084 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9085 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9086 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9087 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9088 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9089 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9090 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9091 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9092 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9093 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9094 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9095 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9096 | { } /* end */ |
| 9097 | }; |
| 9098 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9099 | static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9100 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9101 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9102 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9103 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9104 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9105 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9107 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9108 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9109 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9110 | { } /* end */ |
| 9111 | }; |
| 9112 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9113 | static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9114 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9115 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9116 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9117 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9118 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9119 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9120 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9121 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9122 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9123 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9124 | { } /* end */ |
| 9125 | }; |
| 9126 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9127 | static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9128 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9129 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9131 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9132 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9133 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9134 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9136 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9137 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9138 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9139 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9140 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9141 | { } /* end */ |
| 9142 | }; |
| 9143 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9144 | static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9145 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9146 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9147 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9148 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9149 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9150 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9151 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9152 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9153 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9154 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9155 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9156 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9157 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9158 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9159 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9160 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9161 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9162 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9163 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9164 | { } /* end */ |
| 9165 | }; |
| 9166 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9167 | static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9168 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9169 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9170 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9171 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9172 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9173 | HDA_OUTPUT), |
| 9174 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9175 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9176 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9178 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9179 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9180 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9181 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9182 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9183 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9184 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9185 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9186 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9187 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9188 | { } /* end */ |
| 9189 | }; |
| 9190 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9191 | static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9194 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9195 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9196 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 9197 | HDA_OUTPUT), |
| 9198 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9199 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9200 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9201 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9202 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9203 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9204 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9205 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9207 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 9209 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9210 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9211 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9212 | { } /* end */ |
| 9213 | }; |
| 9214 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9215 | static const struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9216 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9217 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9218 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9219 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9220 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9221 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 9222 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9223 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9224 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9225 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9226 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9227 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9228 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9229 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9230 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9232 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9233 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9234 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9235 | { } /* end */ |
| 9236 | }; |
| 9237 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9238 | static const struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9240 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9241 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9242 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9243 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9244 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 9245 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 9246 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9247 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9248 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 9249 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9250 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9251 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9252 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9253 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9254 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9255 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9256 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9257 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9258 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9259 | static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9260 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9261 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9262 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9263 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9264 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9265 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9266 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9267 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9268 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9269 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9270 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9271 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9272 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9273 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9274 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9275 | static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9276 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9277 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9278 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9279 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9280 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9281 | { } /* end */ |
| 9282 | }; |
| 9283 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9284 | static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9285 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9286 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9287 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9288 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9290 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9291 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9293 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9294 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9295 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9296 | static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9297 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9298 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9299 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9303 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 9304 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9305 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9306 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9307 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9308 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9309 | static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9310 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9311 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9312 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 9314 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 9315 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 9316 | { } /* end */ |
| 9317 | }; |
| 9318 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9319 | static const struct hda_verb alc883_medion_wim2160_verbs[] = { |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9320 | /* Unmute front mixer */ |
| 9321 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9322 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9323 | |
| 9324 | /* Set speaker pin to front mixer */ |
| 9325 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9326 | |
| 9327 | /* Init headphone pin */ |
| 9328 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9329 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9330 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9331 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9332 | |
| 9333 | { } /* end */ |
| 9334 | }; |
| 9335 | |
| 9336 | /* toggle speaker-output according to the hp-jack state */ |
| 9337 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 9338 | { |
| 9339 | struct alc_spec *spec = codec->spec; |
| 9340 | |
| 9341 | spec->autocfg.hp_pins[0] = 0x1a; |
| 9342 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9343 | spec->automute = 1; |
| 9344 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9345 | } |
| 9346 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9347 | static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9348 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9349 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9351 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9352 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9354 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9355 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9356 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9357 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9358 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9359 | static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9360 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9361 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 9362 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9363 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9364 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9365 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9367 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9368 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9369 | { } /* end */ |
| 9370 | }; |
| 9371 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9372 | static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9373 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9374 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9375 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9376 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 9377 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 9378 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 9379 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 9380 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 9381 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 9382 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 9383 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9385 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9386 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9387 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9388 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9389 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9390 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9391 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9392 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9393 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9394 | { } /* end */ |
| 9395 | }; |
| 9396 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9397 | static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9398 | /* Output mixers */ |
| 9399 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 9400 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 9401 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 9402 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 9403 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 9404 | HDA_OUTPUT), |
| 9405 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 9406 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 9407 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 9408 | /* Output switches */ |
| 9409 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 9410 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 9411 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 9412 | /* Boost mixers */ |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9413 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT), |
| 9414 | HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT), |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9415 | /* Input mixers */ |
| 9416 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 9417 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 9418 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9419 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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 alc883_vaiott_mixer[] = { |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +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_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9428 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9429 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9430 | { } /* end */ |
| 9431 | }; |
| 9432 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9433 | static const struct hda_bind_ctls alc883_bind_cap_vol = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9434 | .ops = &snd_hda_bind_vol, |
| 9435 | .values = { |
| 9436 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9437 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9438 | 0 |
| 9439 | }, |
| 9440 | }; |
| 9441 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9442 | static const struct hda_bind_ctls alc883_bind_cap_switch = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9443 | .ops = &snd_hda_bind_sw, |
| 9444 | .values = { |
| 9445 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 9446 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 9447 | 0 |
| 9448 | }, |
| 9449 | }; |
| 9450 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9451 | static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9452 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9453 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9454 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9455 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9456 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 9458 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9459 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9460 | { } /* end */ |
| 9461 | }; |
| 9462 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9463 | static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9464 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 9465 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 9466 | { |
| 9467 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9468 | /* .name = "Capture Source", */ |
| 9469 | .name = "Input Source", |
| 9470 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 9471 | .info = alc_mux_enum_info, |
| 9472 | .get = alc_mux_enum_get, |
| 9473 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9474 | }, |
| 9475 | { } /* end */ |
| 9476 | }; |
| 9477 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9478 | static const struct snd_kcontrol_new alc883_chmode_mixer[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9479 | { |
| 9480 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9481 | .name = "Channel Mode", |
| 9482 | .info = alc_ch_mode_info, |
| 9483 | .get = alc_ch_mode_get, |
| 9484 | .put = alc_ch_mode_put, |
| 9485 | }, |
| 9486 | { } /* end */ |
| 9487 | }; |
| 9488 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9489 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9490 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9491 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9492 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9493 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9494 | spec->autocfg.hp_pins[0] = 0x15; |
| 9495 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9496 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9497 | spec->automute = 1; |
| 9498 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9499 | } |
| 9500 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9501 | static const struct hda_verb alc883_mitac_verbs[] = { |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9502 | /* HP */ |
| 9503 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9505 | /* Subwoofer */ |
| 9506 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9507 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9508 | |
| 9509 | /* enable unsolicited event */ |
| 9510 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9511 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 9512 | |
| 9513 | { } /* end */ |
| 9514 | }; |
| 9515 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9516 | static const struct hda_verb alc883_clevo_m540r_verbs[] = { |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9517 | /* HP */ |
| 9518 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9520 | /* Int speaker */ |
| 9521 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 9522 | |
| 9523 | /* enable unsolicited event */ |
| 9524 | /* |
| 9525 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9526 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9527 | */ |
| 9528 | |
| 9529 | { } /* end */ |
| 9530 | }; |
| 9531 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9532 | static const struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9533 | /* HP */ |
| 9534 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9535 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9536 | /* Int speaker */ |
| 9537 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9539 | |
| 9540 | /* enable unsolicited event */ |
| 9541 | {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] | 9542 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9543 | |
| 9544 | { } /* end */ |
| 9545 | }; |
| 9546 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9547 | static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9548 | /* HP */ |
| 9549 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9550 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9551 | /* Subwoofer */ |
| 9552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9553 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9554 | |
| 9555 | /* enable unsolicited event */ |
| 9556 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9557 | |
| 9558 | { } /* end */ |
| 9559 | }; |
| 9560 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9561 | static const struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9562 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9563 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9564 | |
| 9565 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9566 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9567 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9568 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 9569 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9570 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9571 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 9572 | /* Connect Mic jack to CLFE */ |
| 9573 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9574 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9575 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9576 | /* Connect Line-in jack to Surround */ |
| 9577 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9578 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9579 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9580 | /* Connect HP out jack to Front */ |
| 9581 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9582 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9583 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9584 | |
| 9585 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9586 | |
| 9587 | { } /* end */ |
| 9588 | }; |
| 9589 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9590 | static const struct hda_verb alc883_lenovo_101e_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9591 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9592 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 9593 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 9594 | { } /* end */ |
| 9595 | }; |
| 9596 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9597 | static const struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9598 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9599 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9600 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9602 | { } /* end */ |
| 9603 | }; |
| 9604 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9605 | static const struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9608 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9609 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9610 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9611 | { } /* end */ |
| 9612 | }; |
| 9613 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9614 | static const struct hda_verb alc883_haier_w66_verbs[] = { |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9615 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9616 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9617 | |
| 9618 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9619 | |
| 9620 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9621 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9622 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9623 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9624 | { } /* end */ |
| 9625 | }; |
| 9626 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9627 | static const struct hda_verb alc888_lenovo_sky_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9629 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9630 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9631 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9632 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9633 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9634 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9635 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9636 | { } /* end */ |
| 9637 | }; |
| 9638 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9639 | static const struct hda_verb alc888_6st_dell_verbs[] = { |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9640 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9641 | { } |
| 9642 | }; |
| 9643 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9644 | static const struct hda_verb alc883_vaiott_verbs[] = { |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9645 | /* HP */ |
| 9646 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9647 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9648 | |
| 9649 | /* enable unsolicited event */ |
| 9650 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9651 | |
| 9652 | { } /* end */ |
| 9653 | }; |
| 9654 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9655 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9656 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9657 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9658 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9659 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9660 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9661 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9662 | spec->autocfg.speaker_pins[2] = 0x18; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9663 | spec->automute = 1; |
| 9664 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9665 | } |
| 9666 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9667 | static const struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9668 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9669 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9670 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9671 | {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] | 9672 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9673 | }; |
| 9674 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9675 | /* |
| 9676 | * 2ch mode |
| 9677 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9678 | static const struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9679 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9680 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9681 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9682 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9683 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9684 | }; |
| 9685 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9686 | /* |
| 9687 | * 4ch mode |
| 9688 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9689 | static const struct hda_verb alc888_3st_hp_4ch_init[] = { |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9690 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9691 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9692 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9693 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9694 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9695 | { } /* end */ |
| 9696 | }; |
| 9697 | |
| 9698 | /* |
| 9699 | * 6ch mode |
| 9700 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9701 | static const struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9702 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9703 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9704 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9705 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9706 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9707 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9708 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9709 | }; |
| 9710 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9711 | static const struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9712 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9713 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9714 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9715 | }; |
| 9716 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9717 | static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9718 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9719 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9720 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9721 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9722 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9723 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9724 | spec->automute = 1; |
| 9725 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9726 | } |
| 9727 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9728 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 9729 | static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9730 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9731 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9732 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9733 | spec->autocfg.hp_pins[0] = 0x14; |
| 9734 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9735 | spec->automute = 1; |
| 9736 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9737 | } |
| 9738 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9739 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9740 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9741 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9742 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9743 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9744 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9745 | struct alc_spec *spec = codec->spec; |
| 9746 | |
| 9747 | spec->autocfg.hp_pins[0] = 0x15; |
| 9748 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9749 | spec->automute = 1; |
| 9750 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9751 | } |
| 9752 | |
| 9753 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9754 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9755 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9756 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9757 | } |
| 9758 | |
| 9759 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9760 | unsigned int res) |
| 9761 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9762 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9763 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 9764 | alc88x_simple_mic_automute(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9765 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9766 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9767 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9768 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9769 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9770 | } |
| 9771 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9772 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9773 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9774 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9775 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9776 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9777 | spec->autocfg.hp_pins[0] = 0x14; |
| 9778 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9779 | spec->automute = 1; |
| 9780 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9781 | } |
| 9782 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9783 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9784 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9785 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9786 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9787 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9788 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9789 | spec->automute = 1; |
| 9790 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9791 | } |
| 9792 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9793 | static void alc883_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9794 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9795 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9796 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 9797 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9798 | spec->autocfg.line_out_pins[0] = 0x14; |
| 9799 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9800 | spec->automute = 1; |
| 9801 | spec->detect_line = 1; |
| 9802 | spec->automute_lines = 1; |
| 9803 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9804 | } |
| 9805 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9806 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9807 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9808 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9809 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9810 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9811 | spec->autocfg.hp_pins[0] = 0x14; |
| 9812 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9813 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9814 | spec->automute = 1; |
| 9815 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9816 | } |
| 9817 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9818 | static const struct hda_verb alc883_acer_eapd_verbs[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9819 | /* HP Pin: output 0 (0x0c) */ |
| 9820 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9821 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9822 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9823 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9824 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9825 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9826 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9827 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9828 | /* eanable EAPD on medion laptop */ |
| 9829 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9830 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9831 | /* enable unsolicited event */ |
| 9832 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9833 | { } |
| 9834 | }; |
| 9835 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9836 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9837 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9838 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9839 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9840 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9841 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9842 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9843 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9844 | spec->autocfg.speaker_pins[3] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9845 | spec->automute = 1; |
| 9846 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9847 | } |
| 9848 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9849 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9850 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9851 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9852 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9853 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9854 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9855 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9856 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9857 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9858 | spec->autocfg.speaker_pins[4] = 0x1a; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9859 | spec->automute = 1; |
| 9860 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9861 | } |
| 9862 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9863 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9864 | { |
| 9865 | struct alc_spec *spec = codec->spec; |
| 9866 | |
| 9867 | spec->autocfg.hp_pins[0] = 0x15; |
| 9868 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9869 | spec->autocfg.speaker_pins[1] = 0x17; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9870 | spec->automute = 1; |
| 9871 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9872 | } |
| 9873 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9874 | static const struct hda_verb alc888_asus_m90v_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9875 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9876 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9877 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9878 | /* enable unsolicited event */ |
| 9879 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9880 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9881 | { } /* end */ |
| 9882 | }; |
| 9883 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9884 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9885 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9886 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9887 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9888 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9889 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9890 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9891 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9892 | spec->ext_mic.pin = 0x18; |
| 9893 | spec->int_mic.pin = 0x19; |
| 9894 | spec->ext_mic.mux_idx = 0; |
| 9895 | spec->int_mic.mux_idx = 1; |
| 9896 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9897 | spec->automute = 1; |
| 9898 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9899 | } |
| 9900 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9901 | static const struct hda_verb alc888_asus_eee1601_verbs[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9902 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9903 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9904 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9905 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9906 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9907 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9908 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9909 | /* enable unsolicited event */ |
| 9910 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9911 | { } /* end */ |
| 9912 | }; |
| 9913 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9914 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9915 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9916 | struct alc_spec *spec = codec->spec; |
| 9917 | |
| 9918 | spec->autocfg.hp_pins[0] = 0x14; |
| 9919 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 9920 | alc_hp_automute(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9921 | } |
| 9922 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9923 | static const struct hda_verb alc889A_mb31_verbs[] = { |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9924 | /* Init rear pin (used as headphone output) */ |
| 9925 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9926 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9927 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9928 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9929 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9930 | /* Init line 2 pin (used as headphone out by default) */ |
| 9931 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9932 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9933 | { } /* end */ |
| 9934 | }; |
| 9935 | |
| 9936 | /* Mute speakers according to the headphone jack state */ |
| 9937 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9938 | { |
| 9939 | unsigned int present; |
| 9940 | |
| 9941 | /* Mute only in 2ch or 4ch mode */ |
| 9942 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9943 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9944 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9945 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9946 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9947 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9948 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9949 | } |
| 9950 | } |
| 9951 | |
| 9952 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9953 | { |
| 9954 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9955 | alc889A_mb31_automute(codec); |
| 9956 | } |
| 9957 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9958 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9959 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9960 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9961 | #endif |
| 9962 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9963 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9964 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9965 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9966 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9967 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9968 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9969 | static const hda_nid_t alc883_slave_dig_outs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9970 | ALC1200_DIGOUT_NID, 0, |
| 9971 | }; |
| 9972 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 9973 | static const hda_nid_t alc1200_slave_dig_outs[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9974 | ALC883_DIGOUT_NID, 0, |
| 9975 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9976 | |
| 9977 | /* |
| 9978 | * configuration and preset |
| 9979 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 9980 | static const char * const alc882_models[ALC882_MODEL_LAST] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9981 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9982 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9983 | [ALC882_ARIMA] = "arima", |
| 9984 | [ALC882_W2JC] = "w2jc", |
| 9985 | [ALC882_TARGA] = "targa", |
| 9986 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9987 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9988 | [ALC885_MACPRO] = "macpro", |
| 9989 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9990 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9991 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9992 | [ALC885_MBP3] = "mbp3", |
| 9993 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9994 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9995 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9996 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9997 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9998 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9999 | [ALC883_TARGA_DIG] = "targa-dig", |
| 10000 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10001 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10002 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10003 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10004 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 10005 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10006 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10007 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10008 | [ALC883_MEDION] = "medion", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10009 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10010 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10011 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10012 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 10013 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10014 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10015 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10016 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10017 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10018 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10019 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10020 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10021 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10022 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10023 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10024 | [ALC889A_INTEL] = "intel-alc889a", |
| 10025 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10026 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10027 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10028 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10029 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10030 | }; |
| 10031 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10032 | static const struct snd_pci_quirk alc882_cfg_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10033 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 10034 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10035 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 10036 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 10037 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10038 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 10039 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 10040 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10041 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 10042 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 10043 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 10044 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10045 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 10046 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 10047 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 10048 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10049 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 10050 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 10051 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 10052 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 10053 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10054 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10055 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 10056 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 10057 | /* default Acer -- disabled as it causes more problems. |
| 10058 | * model=auto should work fine now |
| 10059 | */ |
| 10060 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10061 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10062 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10063 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 10064 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10065 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 10066 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 10067 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 10068 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 10069 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10070 | |
| 10071 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 10072 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 10073 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 10074 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10075 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 10076 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 10077 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10078 | 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] | 10079 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10080 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10081 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10082 | |
| 10083 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 10084 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10085 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10086 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10087 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 10088 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10089 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10090 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | ebb4724 | 2011-05-02 10:37:29 +0200 | [diff] [blame] | 10091 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10092 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10093 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 10094 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 10095 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10096 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 10097 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10098 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10099 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 10100 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10101 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 10102 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 10103 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 10104 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 10105 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 10106 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 10107 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10108 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 10109 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 10110 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 10111 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10112 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10113 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 10114 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 10115 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 10116 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 10117 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 10118 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 10119 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 10120 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 10121 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10122 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 10123 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10124 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10125 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 10126 | 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] | 10127 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 10128 | 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] | 10129 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 10130 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 10131 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10132 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 10133 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 10134 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 10135 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 10136 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10137 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10138 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10139 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10140 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 10141 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10142 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 10143 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 10144 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10145 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10146 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10147 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 10148 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 10149 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10150 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 10151 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 10152 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 10153 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10154 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10155 | {} |
| 10156 | }; |
| 10157 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10158 | /* codec SSID table for Intel Mac */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10159 | static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10160 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 10161 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 10162 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 10163 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 10164 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 10165 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 10166 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 10167 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 10168 | 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] | 10169 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 10170 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10171 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 10172 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 10173 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10174 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10175 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 10176 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10177 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 10178 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10179 | */ |
| 10180 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 10181 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10182 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10183 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10184 | }; |
| 10185 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10186 | static const struct alc_config_preset alc882_presets[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10187 | [ALC882_3ST_DIG] = { |
| 10188 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10189 | .init_verbs = { alc882_base_init_verbs, |
| 10190 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10191 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10192 | .dac_nids = alc882_dac_nids, |
| 10193 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10194 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10195 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10196 | .channel_mode = alc882_ch_modes, |
| 10197 | .need_dac_fix = 1, |
| 10198 | .input_mux = &alc882_capture_source, |
| 10199 | }, |
| 10200 | [ALC882_6ST_DIG] = { |
| 10201 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10202 | .init_verbs = { alc882_base_init_verbs, |
| 10203 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10204 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10205 | .dac_nids = alc882_dac_nids, |
| 10206 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10207 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10208 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10209 | .channel_mode = alc882_sixstack_modes, |
| 10210 | .input_mux = &alc882_capture_source, |
| 10211 | }, |
| 10212 | [ALC882_ARIMA] = { |
| 10213 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10214 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10215 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10216 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10217 | .dac_nids = alc882_dac_nids, |
| 10218 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 10219 | .channel_mode = alc882_sixstack_modes, |
| 10220 | .input_mux = &alc882_capture_source, |
| 10221 | }, |
| 10222 | [ALC882_W2JC] = { |
| 10223 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10224 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10225 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10226 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10227 | .dac_nids = alc882_dac_nids, |
| 10228 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10229 | .channel_mode = alc880_threestack_modes, |
| 10230 | .need_dac_fix = 1, |
| 10231 | .input_mux = &alc882_capture_source, |
| 10232 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10233 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10234 | [ALC885_MBA21] = { |
| 10235 | .mixers = { alc885_mba21_mixer }, |
| 10236 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 10237 | .num_dacs = 2, |
| 10238 | .dac_nids = alc882_dac_nids, |
| 10239 | .channel_mode = alc885_mba21_ch_modes, |
| 10240 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10241 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10242 | .unsol_event = alc_sku_unsol_event, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10243 | .setup = alc885_mba21_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10244 | .init_hook = alc_hp_automute, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 10245 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10246 | [ALC885_MBP3] = { |
| 10247 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 10248 | .init_verbs = { alc885_mbp3_init_verbs, |
| 10249 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10250 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10251 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 10252 | .hp_nid = 0x04, |
| 10253 | .channel_mode = alc885_mbp_4ch_modes, |
| 10254 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10255 | .input_mux = &alc882_capture_source, |
| 10256 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10257 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10258 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10259 | .setup = alc885_mbp3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10260 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10261 | }, |
| 10262 | [ALC885_MB5] = { |
| 10263 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 10264 | .init_verbs = { alc885_mb5_init_verbs, |
| 10265 | alc880_gpio1_init_verbs }, |
| 10266 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10267 | .dac_nids = alc882_dac_nids, |
| 10268 | .channel_mode = alc885_mb5_6ch_modes, |
| 10269 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 10270 | .input_mux = &mb5_capture_source, |
| 10271 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10272 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10273 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10274 | .setup = alc885_mb5_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10275 | .init_hook = alc_hp_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10276 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10277 | [ALC885_MACMINI3] = { |
| 10278 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 10279 | .init_verbs = { alc885_macmini3_init_verbs, |
| 10280 | alc880_gpio1_init_verbs }, |
| 10281 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10282 | .dac_nids = alc882_dac_nids, |
| 10283 | .channel_mode = alc885_macmini3_6ch_modes, |
| 10284 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 10285 | .input_mux = &macmini3_capture_source, |
| 10286 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10287 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10288 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10289 | .setup = alc885_macmini3_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10290 | .init_hook = alc_hp_automute, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 10291 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10292 | [ALC885_MACPRO] = { |
| 10293 | .mixers = { alc882_macpro_mixer }, |
| 10294 | .init_verbs = { alc882_macpro_init_verbs }, |
| 10295 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10296 | .dac_nids = alc882_dac_nids, |
| 10297 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10298 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10299 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10300 | .channel_mode = alc882_ch_modes, |
| 10301 | .input_mux = &alc882_capture_source, |
| 10302 | .init_hook = alc885_macpro_init_hook, |
| 10303 | }, |
| 10304 | [ALC885_IMAC24] = { |
| 10305 | .mixers = { alc885_imac24_mixer }, |
| 10306 | .init_verbs = { alc885_imac24_init_verbs }, |
| 10307 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10308 | .dac_nids = alc882_dac_nids, |
| 10309 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10310 | .dig_in_nid = ALC882_DIGIN_NID, |
| 10311 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 10312 | .channel_mode = alc882_ch_modes, |
| 10313 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10314 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10315 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10316 | .init_hook = alc885_imac24_init_hook, |
| 10317 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10318 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10319 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10320 | .init_verbs = { alc885_imac91_init_verbs, |
| 10321 | alc880_gpio1_init_verbs }, |
| 10322 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10323 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 10324 | .channel_mode = alc885_mba21_ch_modes, |
| 10325 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 10326 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10327 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10328 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10329 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 10330 | .setup = alc885_imac91_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10331 | .init_hook = alc_hp_automute, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 10332 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10333 | [ALC882_TARGA] = { |
| 10334 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10335 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 10336 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10337 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10338 | .dac_nids = alc882_dac_nids, |
| 10339 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10340 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10341 | .adc_nids = alc882_adc_nids, |
| 10342 | .capsrc_nids = alc882_capsrc_nids, |
| 10343 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10344 | .channel_mode = alc882_3ST_6ch_modes, |
| 10345 | .need_dac_fix = 1, |
| 10346 | .input_mux = &alc882_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10347 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10348 | .setup = alc882_targa_setup, |
| 10349 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10350 | }, |
| 10351 | [ALC882_ASUS_A7J] = { |
| 10352 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10353 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10354 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10355 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10356 | .dac_nids = alc882_dac_nids, |
| 10357 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10358 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 10359 | .adc_nids = alc882_adc_nids, |
| 10360 | .capsrc_nids = alc882_capsrc_nids, |
| 10361 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 10362 | .channel_mode = alc882_3ST_6ch_modes, |
| 10363 | .need_dac_fix = 1, |
| 10364 | .input_mux = &alc882_capture_source, |
| 10365 | }, |
| 10366 | [ALC882_ASUS_A7M] = { |
| 10367 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 10368 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 10369 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10370 | alc882_asus_a7m_verbs }, |
| 10371 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 10372 | .dac_nids = alc882_dac_nids, |
| 10373 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 10374 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 10375 | .channel_mode = alc880_threestack_modes, |
| 10376 | .need_dac_fix = 1, |
| 10377 | .input_mux = &alc882_capture_source, |
| 10378 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10379 | [ALC883_3ST_2ch_DIG] = { |
| 10380 | .mixers = { alc883_3ST_2ch_mixer }, |
| 10381 | .init_verbs = { alc883_init_verbs }, |
| 10382 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10383 | .dac_nids = alc883_dac_nids, |
| 10384 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10385 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10386 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10387 | .channel_mode = alc883_3ST_2ch_modes, |
| 10388 | .input_mux = &alc883_capture_source, |
| 10389 | }, |
| 10390 | [ALC883_3ST_6ch_DIG] = { |
| 10391 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10392 | .init_verbs = { alc883_init_verbs }, |
| 10393 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10394 | .dac_nids = alc883_dac_nids, |
| 10395 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10396 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10397 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10398 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10399 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10400 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10401 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10402 | [ALC883_3ST_6ch] = { |
| 10403 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10404 | .init_verbs = { alc883_init_verbs }, |
| 10405 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10406 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10407 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10408 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 10409 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10410 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10411 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10412 | [ALC883_3ST_6ch_INTEL] = { |
| 10413 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 10414 | .init_verbs = { alc883_init_verbs }, |
| 10415 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10416 | .dac_nids = alc883_dac_nids, |
| 10417 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10418 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 10419 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 10420 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 10421 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 10422 | .need_dac_fix = 1, |
| 10423 | .input_mux = &alc883_3stack_6ch_intel, |
| 10424 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10425 | [ALC889A_INTEL] = { |
| 10426 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10427 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 10428 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10429 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10430 | .dac_nids = alc883_dac_nids, |
| 10431 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10432 | .adc_nids = alc889_adc_nids, |
| 10433 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10434 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10435 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10436 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10437 | .channel_mode = alc889_8ch_intel_modes, |
| 10438 | .capsrc_nids = alc889_capsrc_nids, |
| 10439 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10440 | .setup = alc889_automute_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10441 | .init_hook = alc_hp_automute, |
| 10442 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10443 | .need_dac_fix = 1, |
| 10444 | }, |
| 10445 | [ALC889_INTEL] = { |
| 10446 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 10447 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10448 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10449 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10450 | .dac_nids = alc883_dac_nids, |
| 10451 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10452 | .adc_nids = alc889_adc_nids, |
| 10453 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10454 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10455 | .slave_dig_outs = alc883_slave_dig_outs, |
| 10456 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 10457 | .channel_mode = alc889_8ch_intel_modes, |
| 10458 | .capsrc_nids = alc889_capsrc_nids, |
| 10459 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10460 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 10461 | .init_hook = alc889_intel_init_hook, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10462 | .unsol_event = alc_sku_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 10463 | .need_dac_fix = 1, |
| 10464 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10465 | [ALC883_6ST_DIG] = { |
| 10466 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10467 | .init_verbs = { alc883_init_verbs }, |
| 10468 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10469 | .dac_nids = alc883_dac_nids, |
| 10470 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10471 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10472 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10473 | .channel_mode = alc883_sixstack_modes, |
| 10474 | .input_mux = &alc883_capture_source, |
| 10475 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10476 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10477 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10478 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10479 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10480 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10481 | .dac_nids = alc883_dac_nids, |
| 10482 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10483 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10484 | .channel_mode = alc883_3ST_6ch_modes, |
| 10485 | .need_dac_fix = 1, |
| 10486 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10487 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10488 | .setup = alc882_targa_setup, |
| 10489 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10490 | }, |
| 10491 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10492 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 10493 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 10494 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10495 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10496 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10497 | .adc_nids = alc883_adc_nids_alt, |
| 10498 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10499 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10500 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10501 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10502 | .channel_mode = alc883_3ST_2ch_modes, |
| 10503 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10504 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10505 | .setup = alc882_targa_setup, |
| 10506 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10507 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10508 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 10509 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 10510 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10511 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10512 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10513 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10514 | .dac_nids = alc883_dac_nids, |
| 10515 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10516 | .adc_nids = alc883_adc_nids_rev, |
| 10517 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10518 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10519 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10520 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 10521 | .channel_mode = alc883_4ST_8ch_modes, |
| 10522 | .need_dac_fix = 1, |
| 10523 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10524 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10525 | .setup = alc882_targa_setup, |
| 10526 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 10527 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10528 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10529 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10530 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 10531 | * and the headphone jack. Turn this on and rely on the |
| 10532 | * standard mute methods whenever the user wants to turn |
| 10533 | * these outputs off. |
| 10534 | */ |
| 10535 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 10536 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10537 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 10538 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10539 | .channel_mode = alc883_3ST_2ch_modes, |
| 10540 | .input_mux = &alc883_capture_source, |
| 10541 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10542 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10543 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10544 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10546 | .dac_nids = alc883_dac_nids, |
| 10547 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 10548 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10549 | .channel_mode = alc883_3ST_2ch_modes, |
| 10550 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10551 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10552 | .setup = alc883_acer_aspire_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10553 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10554 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10555 | [ALC888_ACER_ASPIRE_4930G] = { |
Łukasz Wojniłowicz | 460c92f | 2011-02-07 13:13:27 +0100 | [diff] [blame] | 10556 | .mixers = { alc888_acer_aspire_4930g_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10557 | alc883_chmode_mixer }, |
| 10558 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10559 | alc888_acer_aspire_4930g_verbs }, |
| 10560 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10561 | .dac_nids = alc883_dac_nids, |
| 10562 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10563 | .adc_nids = alc883_adc_nids_rev, |
| 10564 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10565 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10566 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10567 | .channel_mode = alc883_3ST_6ch_modes, |
| 10568 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10569 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10570 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10571 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10572 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10573 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10574 | .setup = alc888_acer_aspire_4930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10575 | .init_hook = alc_hp_automute, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10576 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10577 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10578 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10579 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10580 | alc888_acer_aspire_6530g_verbs }, |
| 10581 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10582 | .dac_nids = alc883_dac_nids, |
| 10583 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10584 | .adc_nids = alc883_adc_nids_rev, |
| 10585 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10586 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10587 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10588 | .channel_mode = alc883_3ST_2ch_modes, |
| 10589 | .num_mux_defs = |
| 10590 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10591 | .input_mux = alc888_acer_aspire_6530_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10592 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10593 | .setup = alc888_acer_aspire_6530g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10594 | .init_hook = alc_hp_automute, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10595 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10596 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10597 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10598 | alc883_chmode_mixer }, |
| 10599 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10600 | alc889_acer_aspire_8930g_verbs, |
| 10601 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10602 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10603 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10604 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10605 | .adc_nids = alc889_adc_nids, |
| 10606 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10607 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10608 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10609 | .channel_mode = alc883_3ST_6ch_modes, |
| 10610 | .need_dac_fix = 1, |
| 10611 | .const_channel_count = 6, |
| 10612 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10613 | ARRAY_SIZE(alc889_capture_sources), |
| 10614 | .input_mux = alc889_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10615 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10616 | .setup = alc889_acer_aspire_8930g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10617 | .init_hook = alc_hp_automute, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10618 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10619 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10620 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10621 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10622 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10623 | .mixers = { alc883_3ST_6ch_mixer, |
| 10624 | alc883_chmode_mixer }, |
| 10625 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10626 | alc888_acer_aspire_7730G_verbs }, |
| 10627 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10628 | .dac_nids = alc883_dac_nids, |
| 10629 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10630 | .adc_nids = alc883_adc_nids_rev, |
| 10631 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10632 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10633 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10634 | .channel_mode = alc883_3ST_6ch_modes, |
| 10635 | .need_dac_fix = 1, |
| 10636 | .const_channel_count = 6, |
| 10637 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10638 | .unsol_event = alc_sku_unsol_event, |
Denis Kuplyakov | d947720 | 2010-11-24 06:01:09 +0100 | [diff] [blame] | 10639 | .setup = alc888_acer_aspire_7730g_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10640 | .init_hook = alc_hp_automute, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10641 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10642 | [ALC883_MEDION] = { |
| 10643 | .mixers = { alc883_fivestack_mixer, |
| 10644 | alc883_chmode_mixer }, |
| 10645 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10646 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10647 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10648 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10649 | .adc_nids = alc883_adc_nids_alt, |
| 10650 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10651 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10652 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10653 | .channel_mode = alc883_sixstack_modes, |
| 10654 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10655 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10656 | [ALC883_MEDION_WIM2160] = { |
| 10657 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10658 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10659 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10660 | .dac_nids = alc883_dac_nids, |
| 10661 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10662 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10663 | .adc_nids = alc883_adc_nids, |
| 10664 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10665 | .channel_mode = alc883_3ST_2ch_modes, |
| 10666 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10667 | .unsol_event = alc_sku_unsol_event, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10668 | .setup = alc883_medion_wim2160_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10669 | .init_hook = alc_hp_automute, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10670 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10671 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10672 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10673 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10674 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10675 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10676 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10677 | .channel_mode = alc883_3ST_2ch_modes, |
| 10678 | .input_mux = &alc883_capture_source, |
| 10679 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10680 | [ALC883_CLEVO_M540R] = { |
| 10681 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10682 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10683 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10684 | .dac_nids = alc883_dac_nids, |
| 10685 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10686 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10687 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10688 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10689 | .need_dac_fix = 1, |
| 10690 | .input_mux = &alc883_capture_source, |
| 10691 | /* This machine has the hardware HP auto-muting, thus |
| 10692 | * we need no software mute via unsol event |
| 10693 | */ |
| 10694 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10695 | [ALC883_CLEVO_M720] = { |
| 10696 | .mixers = { alc883_clevo_m720_mixer }, |
| 10697 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10698 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10699 | .dac_nids = alc883_dac_nids, |
| 10700 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10701 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10702 | .channel_mode = alc883_3ST_2ch_modes, |
| 10703 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10704 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10705 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10706 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10707 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10708 | [ALC883_LENOVO_101E_2ch] = { |
| 10709 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10710 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10711 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10712 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10713 | .adc_nids = alc883_adc_nids_alt, |
| 10714 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10715 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10716 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10717 | .channel_mode = alc883_3ST_2ch_modes, |
| 10718 | .input_mux = &alc883_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10719 | .setup = alc883_lenovo_101e_setup, |
| 10720 | .unsol_event = alc_sku_unsol_event, |
| 10721 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10722 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10723 | [ALC883_LENOVO_NB0763] = { |
| 10724 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10725 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10726 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10727 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10728 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10729 | .channel_mode = alc883_3ST_2ch_modes, |
| 10730 | .need_dac_fix = 1, |
| 10731 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10732 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | dc427170 | 2010-11-29 07:42:59 +0100 | [diff] [blame] | 10733 | .setup = alc883_lenovo_nb0763_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10734 | .init_hook = alc_hp_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10735 | }, |
| 10736 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10737 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10738 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10739 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10740 | .dac_nids = alc883_dac_nids, |
| 10741 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10742 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10743 | .channel_mode = alc883_3ST_6ch_modes, |
| 10744 | .need_dac_fix = 1, |
| 10745 | .input_mux = &alc883_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 10746 | .unsol_event = alc_sku_unsol_event, |
| 10747 | .setup = alc888_lenovo_ms7195_setup, |
| 10748 | .init_hook = alc_inithook, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10749 | }, |
| 10750 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10751 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10752 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10753 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10754 | .dac_nids = alc883_dac_nids, |
| 10755 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10756 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10757 | .channel_mode = alc883_3ST_2ch_modes, |
| 10758 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10759 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10760 | .setup = alc883_haier_w66_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10761 | .init_hook = alc_hp_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10762 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10763 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10764 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10765 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10766 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10767 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10768 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10769 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10770 | .need_dac_fix = 1, |
| 10771 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10772 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10773 | .setup = alc888_3st_hp_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10774 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10775 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10776 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10777 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10778 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10779 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10780 | .dac_nids = alc883_dac_nids, |
| 10781 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10782 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10783 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10784 | .channel_mode = alc883_sixstack_modes, |
| 10785 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10786 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10787 | .setup = alc888_6st_dell_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10788 | .init_hook = alc_hp_automute, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10789 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10790 | [ALC883_MITAC] = { |
| 10791 | .mixers = { alc883_mitac_mixer }, |
| 10792 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10793 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10794 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10795 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10796 | .channel_mode = alc883_3ST_2ch_modes, |
| 10797 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10798 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10799 | .setup = alc883_mitac_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10800 | .init_hook = alc_hp_automute, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10801 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10802 | [ALC883_FUJITSU_PI2515] = { |
| 10803 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10804 | .init_verbs = { alc883_init_verbs, |
| 10805 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10806 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10807 | .dac_nids = alc883_dac_nids, |
| 10808 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10809 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10810 | .channel_mode = alc883_3ST_2ch_modes, |
| 10811 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10812 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10813 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10814 | .init_hook = alc_hp_automute, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10815 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10816 | [ALC888_FUJITSU_XA3530] = { |
| 10817 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10818 | .init_verbs = { alc883_init_verbs, |
| 10819 | alc888_fujitsu_xa3530_verbs }, |
| 10820 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10821 | .dac_nids = alc883_dac_nids, |
| 10822 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10823 | .adc_nids = alc883_adc_nids_rev, |
| 10824 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10825 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10826 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10827 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10828 | .num_mux_defs = |
| 10829 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10830 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10831 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10832 | .setup = alc888_fujitsu_xa3530_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10833 | .init_hook = alc_hp_automute, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10834 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10835 | [ALC888_LENOVO_SKY] = { |
| 10836 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10837 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10838 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10839 | .dac_nids = alc883_dac_nids, |
| 10840 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10841 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10842 | .channel_mode = alc883_sixstack_modes, |
| 10843 | .need_dac_fix = 1, |
| 10844 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10845 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10846 | .setup = alc888_lenovo_sky_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10847 | .init_hook = alc_hp_automute, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10848 | }, |
| 10849 | [ALC888_ASUS_M90V] = { |
| 10850 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10851 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10852 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10853 | .dac_nids = alc883_dac_nids, |
| 10854 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10855 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10856 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10857 | .channel_mode = alc883_3ST_6ch_modes, |
| 10858 | .need_dac_fix = 1, |
| 10859 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10860 | .unsol_event = alc_sku_unsol_event, |
| 10861 | .setup = alc883_mode2_setup, |
| 10862 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10863 | }, |
| 10864 | [ALC888_ASUS_EEE1601] = { |
| 10865 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10866 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10867 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10868 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10869 | .dac_nids = alc883_dac_nids, |
| 10870 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10871 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10872 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10873 | .channel_mode = alc883_3ST_2ch_modes, |
| 10874 | .need_dac_fix = 1, |
| 10875 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10876 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10877 | .init_hook = alc883_eee1601_inithook, |
| 10878 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10879 | [ALC1200_ASUS_P5Q] = { |
| 10880 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10881 | .init_verbs = { alc883_init_verbs }, |
| 10882 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10883 | .dac_nids = alc883_dac_nids, |
| 10884 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10885 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10886 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10887 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10888 | .channel_mode = alc883_sixstack_modes, |
| 10889 | .input_mux = &alc883_capture_source, |
| 10890 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10891 | [ALC889A_MB31] = { |
| 10892 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10893 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10894 | alc880_gpio1_init_verbs }, |
| 10895 | .adc_nids = alc883_adc_nids, |
| 10896 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10897 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10898 | .dac_nids = alc883_dac_nids, |
| 10899 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10900 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10901 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10902 | .input_mux = &alc889A_mb31_capture_source, |
| 10903 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10904 | .unsol_event = alc889A_mb31_unsol_event, |
| 10905 | .init_hook = alc889A_mb31_automute, |
| 10906 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10907 | [ALC883_SONY_VAIO_TT] = { |
| 10908 | .mixers = { alc883_vaiott_mixer }, |
| 10909 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10910 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10911 | .dac_nids = alc883_dac_nids, |
| 10912 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10913 | .channel_mode = alc883_3ST_2ch_modes, |
| 10914 | .input_mux = &alc883_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10915 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10916 | .setup = alc883_vaiott_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 10917 | .init_hook = alc_hp_automute, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10918 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10919 | }; |
| 10920 | |
| 10921 | |
| 10922 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10923 | * Pin config fixes |
| 10924 | */ |
| 10925 | enum { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10926 | PINFIX_ABIT_AW9D_MAX, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10927 | PINFIX_LENOVO_Y530, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10928 | PINFIX_PB_M5210, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10929 | PINFIX_ACER_ASPIRE_7736, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10930 | }; |
| 10931 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10932 | static const struct alc_fixup alc882_fixups[] = { |
| 10933 | [PINFIX_ABIT_AW9D_MAX] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10934 | .type = ALC_FIXUP_PINS, |
| 10935 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10936 | { 0x15, 0x01080104 }, /* side */ |
| 10937 | { 0x16, 0x01011012 }, /* rear */ |
| 10938 | { 0x17, 0x01016011 }, /* clfe */ |
| 10939 | { } |
| 10940 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10941 | }, |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10942 | [PINFIX_LENOVO_Y530] = { |
| 10943 | .type = ALC_FIXUP_PINS, |
| 10944 | .v.pins = (const struct alc_pincfg[]) { |
| 10945 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 10946 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 10947 | { } |
| 10948 | } |
| 10949 | }, |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10950 | [PINFIX_PB_M5210] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10951 | .type = ALC_FIXUP_VERBS, |
| 10952 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 10953 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, |
| 10954 | {} |
| 10955 | } |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10956 | }, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10957 | [PINFIX_ACER_ASPIRE_7736] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 10958 | .type = ALC_FIXUP_SKU, |
| 10959 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10960 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10961 | }; |
| 10962 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 10963 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 954a29c | 2010-07-30 10:55:44 +0200 | [diff] [blame] | 10964 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
David Henningsson | 32eea38 | 2011-03-04 13:37:50 +0100 | [diff] [blame] | 10965 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10966 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
David Henningsson | c3d226a | 2010-10-14 15:42:08 +0200 | [diff] [blame] | 10967 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10968 | {} |
| 10969 | }; |
| 10970 | |
| 10971 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10972 | * BIOS auto configuration |
| 10973 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10974 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10975 | const struct auto_pin_cfg *cfg) |
| 10976 | { |
| 10977 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10978 | } |
| 10979 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10980 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10981 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10982 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10983 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10984 | int idx; |
| 10985 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10986 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10987 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10988 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 10989 | if (snd_hda_get_conn_list(codec, nid, NULL) < 2) |
| 10990 | return; |
| 10991 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10992 | if (dac == 0x25) |
| 10993 | idx = 4; |
| 10994 | else if (dac >= 0x02 && dac <= 0x05) |
| 10995 | idx = dac - 2; |
| 10996 | else |
| 10997 | return; |
| 10998 | 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] | 10999 | } |
| 11000 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11001 | #define alc882_auto_init_dac alc880_auto_init_dac |
| 11002 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11003 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11004 | { |
| 11005 | struct alc_spec *spec = codec->spec; |
| 11006 | int i; |
| 11007 | |
| 11008 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11009 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11010 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11011 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11012 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11013 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11014 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11015 | /* mute DACs */ |
| 11016 | for (i = 0; i < spec->multiout.num_dacs; i++) |
| 11017 | alc882_auto_init_dac(codec, spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11018 | } |
| 11019 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11020 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11021 | { |
| 11022 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11023 | hda_nid_t pin, dac; |
Takashi Iwai | 5855fb8 | 2010-09-16 18:24:02 +0200 | [diff] [blame] | 11024 | int i; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11025 | |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 11026 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
| 11027 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 11028 | pin = spec->autocfg.hp_pins[i]; |
| 11029 | if (!pin) |
| 11030 | break; |
| 11031 | dac = spec->multiout.hp_nid; |
| 11032 | if (!dac) |
| 11033 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 11034 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 11035 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11036 | } |
David Henningsson | 0a3fabe | 2011-03-04 16:54:52 +0100 | [diff] [blame] | 11037 | |
| 11038 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 11039 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 11040 | pin = spec->autocfg.speaker_pins[i]; |
| 11041 | if (!pin) |
| 11042 | break; |
| 11043 | dac = spec->multiout.extra_out_nid[0]; |
| 11044 | if (!dac) |
| 11045 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 11046 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 11047 | } |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11048 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11049 | |
| 11050 | /* mute DACs */ |
| 11051 | alc882_auto_init_dac(codec, spec->multiout.hp_nid); |
| 11052 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) |
| 11053 | alc882_auto_init_dac(codec, spec->multiout.extra_out_nid[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11054 | } |
| 11055 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11056 | #define alc882_auto_init_analog_input alc880_auto_init_analog_input |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11057 | |
| 11058 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 11059 | { |
| 11060 | struct alc_spec *spec = codec->spec; |
| 11061 | int c; |
| 11062 | |
| 11063 | for (c = 0; c < spec->num_adc_nids; c++) { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11064 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 11065 | unsigned int mux_idx; |
| 11066 | const struct hda_input_mux *imux; |
| 11067 | int conns, mute, idx, item; |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 11068 | unsigned int wid_type; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11069 | |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 11070 | /* mute ADC */ |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 11071 | if (query_amp_caps(codec, spec->adc_nids[c], HDA_INPUT) & |
| 11072 | AC_AMPCAP_MUTE) |
| 11073 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 11074 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11075 | AMP_IN_MUTE(0)); |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 11076 | else if (query_amp_caps(codec, nid, HDA_OUTPUT) & |
| 11077 | AC_AMPCAP_MUTE) |
| 11078 | snd_hda_codec_write(codec, nid, 0, |
| 11079 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 11080 | AMP_OUT_MUTE); |
Takashi Iwai | 10696aa | 2011-04-07 12:46:45 +0200 | [diff] [blame] | 11081 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11082 | conns = snd_hda_get_conn_list(codec, nid, NULL); |
| 11083 | if (conns <= 0) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11084 | continue; |
| 11085 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 11086 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 11087 | if (!imux->num_items && mux_idx > 0) |
| 11088 | imux = &spec->input_mux[0]; |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 11089 | wid_type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11090 | for (idx = 0; idx < conns; idx++) { |
| 11091 | /* if the current connection is the selected one, |
| 11092 | * unmute it as default - otherwise mute it |
| 11093 | */ |
| 11094 | mute = AMP_IN_MUTE(idx); |
| 11095 | for (item = 0; item < imux->num_items; item++) { |
| 11096 | if (imux->items[item].index == idx) { |
| 11097 | if (spec->cur_mux[c] == item) |
| 11098 | mute = AMP_IN_UNMUTE(idx); |
| 11099 | break; |
| 11100 | } |
| 11101 | } |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 11102 | /* initialize the mute status if mute-amp is present */ |
| 11103 | if (query_amp_caps(codec, nid, HDA_INPUT) & AC_AMPCAP_MUTE) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11104 | snd_hda_codec_write(codec, nid, 0, |
| 11105 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11106 | mute); |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 11107 | if (wid_type == AC_WID_AUD_SEL && |
| 11108 | mute != AMP_IN_MUTE(idx)) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11109 | snd_hda_codec_write(codec, nid, 0, |
| 11110 | AC_VERB_SET_CONNECT_SEL, |
| 11111 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11112 | } |
| 11113 | } |
| 11114 | } |
| 11115 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11116 | /* add mic boosts if needed */ |
| 11117 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11118 | { |
| 11119 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11120 | struct auto_pin_cfg *cfg = &spec->autocfg; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11121 | int i, err; |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11122 | int type_idx = 0; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11123 | hda_nid_t nid; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11124 | const char *prev_label = NULL; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11125 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11126 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 11127 | if (cfg->inputs[i].type > AUTO_PIN_MIC) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11128 | break; |
| 11129 | nid = cfg->inputs[i].pin; |
| 11130 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11131 | const char *label; |
| 11132 | char boost_label[32]; |
| 11133 | |
| 11134 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 11135 | if (prev_label && !strcmp(label, prev_label)) |
Takashi Iwai | 53e8c32 | 2010-12-17 15:23:41 +0100 | [diff] [blame] | 11136 | type_idx++; |
| 11137 | else |
| 11138 | type_idx = 0; |
David Henningsson | 5322bf2 | 2011-01-05 11:03:56 +0100 | [diff] [blame] | 11139 | prev_label = label; |
| 11140 | |
| 11141 | snprintf(boost_label, sizeof(boost_label), |
| 11142 | "%s Boost Volume", label); |
| 11143 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11144 | boost_label, type_idx, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11145 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 11146 | if (err < 0) |
| 11147 | return err; |
| 11148 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11149 | } |
| 11150 | return 0; |
| 11151 | } |
| 11152 | |
| 11153 | /* almost identical with ALC880 parser... */ |
| 11154 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 11155 | { |
| 11156 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11157 | static const hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11158 | int err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11159 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11160 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11161 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11162 | if (err < 0) |
| 11163 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11164 | if (!spec->autocfg.line_outs) |
| 11165 | return 0; /* can't find valid BIOS pin config */ |
| 11166 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 11167 | err = alc880_auto_fill_dac_nids(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11168 | if (err < 0) |
| 11169 | return err; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 11170 | err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 11171 | if (err < 0) |
| 11172 | return err; |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 11173 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11174 | if (err < 0) |
| 11175 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 11176 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 11177 | "Headphone"); |
| 11178 | if (err < 0) |
| 11179 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11180 | err = alc880_auto_create_extra_out(spec, |
| 11181 | spec->autocfg.speaker_pins[0], |
| 11182 | "Speaker"); |
| 11183 | if (err < 0) |
| 11184 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11185 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 11186 | if (err < 0) |
| 11187 | return err; |
| 11188 | |
| 11189 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11190 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11191 | alc_auto_parse_digital(codec); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11192 | |
| 11193 | if (spec->kctls.list) |
| 11194 | add_mixer(spec, spec->kctls.list); |
| 11195 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11196 | /* if ADC 0x07 is available, initialize it, too */ |
| 11197 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 11198 | add_verb(spec, alc882_adc1_init_verbs); |
| 11199 | |
| 11200 | spec->num_mux_defs = 1; |
| 11201 | spec->input_mux = &spec->private_imux[0]; |
| 11202 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11203 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11204 | |
| 11205 | err = alc_auto_add_mic_boost(codec); |
| 11206 | if (err < 0) |
| 11207 | return err; |
| 11208 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11209 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11210 | } |
| 11211 | |
| 11212 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11213 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11214 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11215 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11216 | alc882_auto_init_multi_out(codec); |
| 11217 | alc882_auto_init_hp_out(codec); |
| 11218 | alc882_auto_init_analog_input(codec); |
| 11219 | alc882_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 11220 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11221 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11222 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11223 | } |
| 11224 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11225 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11226 | { |
| 11227 | struct alc_spec *spec; |
| 11228 | int err, board_config; |
| 11229 | |
| 11230 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11231 | if (spec == NULL) |
| 11232 | return -ENOMEM; |
| 11233 | |
| 11234 | codec->spec = spec; |
| 11235 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11236 | spec->mixer_nid = 0x0b; |
| 11237 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11238 | switch (codec->vendor_id) { |
| 11239 | case 0x10ec0882: |
| 11240 | case 0x10ec0885: |
| 11241 | break; |
| 11242 | default: |
| 11243 | /* ALC883 and variants */ |
| 11244 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11245 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11246 | } |
| 11247 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11248 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 11249 | alc882_models, |
| 11250 | alc882_cfg_tbl); |
| 11251 | |
| 11252 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 11253 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 11254 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 11255 | |
| 11256 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11257 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11258 | codec->chip_name); |
| 11259 | board_config = ALC882_AUTO; |
| 11260 | } |
| 11261 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11262 | if (board_config == ALC882_AUTO) { |
| 11263 | alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups); |
| 11264 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 11265 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11266 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 11267 | alc_auto_parse_customize_define(codec); |
| 11268 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11269 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11270 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11271 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11272 | if (err < 0) { |
| 11273 | alc_free(codec); |
| 11274 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11275 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11276 | printk(KERN_INFO |
| 11277 | "hda_codec: Cannot set up configuration " |
| 11278 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11279 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11280 | } |
| 11281 | } |
| 11282 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11283 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 11284 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11285 | if (err < 0) { |
| 11286 | alc_free(codec); |
| 11287 | return err; |
| 11288 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11289 | } |
| 11290 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11291 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11292 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11293 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11294 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 11295 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 11296 | /* FIXME: setup DAC5 */ |
| 11297 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 11298 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 11299 | |
| 11300 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 11301 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 11302 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11303 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11304 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11305 | spec->num_adc_nids = 0; |
| 11306 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11307 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11308 | hda_nid_t cap; |
| 11309 | hda_nid_t nid = alc882_adc_nids[i]; |
| 11310 | unsigned int wcap = get_wcaps(codec, nid); |
| 11311 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11312 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11313 | if (wcap != AC_WID_AUD_IN) |
| 11314 | continue; |
| 11315 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 11316 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 11317 | if (err < 0) |
| 11318 | continue; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 11319 | err = snd_hda_get_conn_list(codec, cap, NULL); |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 11320 | if (err < 0) |
| 11321 | continue; |
| 11322 | for (j = 0; j < imux->num_items; j++) |
| 11323 | if (imux->items[j].index >= err) |
| 11324 | break; |
| 11325 | if (j < imux->num_items) |
| 11326 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11327 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 11328 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11329 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11330 | spec->adc_nids = spec->private_adc_nids; |
| 11331 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 11332 | } |
| 11333 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11334 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11335 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 11336 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 11337 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11338 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 11339 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 11340 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11341 | spec->vmaster_nid = 0x0c; |
| 11342 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11343 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11344 | if (board_config == ALC882_AUTO) |
| 11345 | spec->init_hook = alc882_auto_init; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 11346 | |
| 11347 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11348 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11349 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11350 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11351 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11352 | |
| 11353 | return 0; |
| 11354 | } |
| 11355 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 11356 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11357 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11358 | * ALC262 support |
| 11359 | */ |
| 11360 | |
| 11361 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 11362 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 11363 | |
| 11364 | #define alc262_dac_nids alc260_dac_nids |
| 11365 | #define alc262_adc_nids alc882_adc_nids |
| 11366 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 11367 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 11368 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11369 | |
| 11370 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 11371 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11372 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11373 | static const hda_nid_t alc262_dmic_adc_nids[1] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11374 | /* ADC0 */ |
| 11375 | 0x09 |
| 11376 | }; |
| 11377 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11378 | static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11379 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11380 | static const struct snd_kcontrol_new alc262_base_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11381 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11382 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11383 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11384 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11385 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11386 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11387 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11389 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11390 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11391 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11392 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11393 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 11394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11395 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 11396 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11397 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11398 | }; |
| 11399 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11400 | /* update HP, line and mono-out pins according to the master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11401 | #define alc262_hp_master_update alc260_hp_master_update |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11402 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11403 | static void alc262_hp_bpc_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11404 | { |
| 11405 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11406 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11407 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11408 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11409 | spec->automute = 1; |
| 11410 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11411 | } |
| 11412 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11413 | static void alc262_hp_wildwest_setup(struct hda_codec *codec) |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11414 | { |
| 11415 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11416 | |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11417 | spec->autocfg.hp_pins[0] = 0x15; |
| 11418 | spec->autocfg.speaker_pins[0] = 0x16; |
| 11419 | spec->automute = 1; |
| 11420 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11421 | } |
| 11422 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11423 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11424 | #define alc262_hp_master_sw_put alc260_hp_master_sw_put |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11425 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11426 | #define ALC262_HP_MASTER_SWITCH \ |
| 11427 | { \ |
| 11428 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11429 | .name = "Master Playback Switch", \ |
| 11430 | .info = snd_ctl_boolean_mono_info, \ |
| 11431 | .get = alc262_hp_master_sw_get, \ |
| 11432 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11433 | }, \ |
| 11434 | { \ |
| 11435 | .iface = NID_MAPPING, \ |
| 11436 | .name = "Master Playback Switch", \ |
| 11437 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11438 | } |
| 11439 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11440 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11441 | static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11442 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11443 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11444 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11445 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11446 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11447 | HDA_OUTPUT), |
| 11448 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11449 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11450 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11451 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11452 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11453 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11455 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11456 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11457 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11458 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11459 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11460 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11461 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11462 | { } /* end */ |
| 11463 | }; |
| 11464 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11465 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 11466 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11467 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11468 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11469 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11470 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11471 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 11472 | HDA_OUTPUT), |
| 11473 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 11474 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11475 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11476 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11477 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11478 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11479 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11480 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11481 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11482 | { } /* end */ |
| 11483 | }; |
| 11484 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11485 | static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11486 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11487 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11488 | HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11489 | { } /* end */ |
| 11490 | }; |
| 11491 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11492 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11493 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11494 | { |
| 11495 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11496 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11497 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11498 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11499 | spec->automute = 1; |
| 11500 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11501 | } |
| 11502 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11503 | static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11504 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11505 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11506 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11507 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11508 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11509 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11510 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11511 | { } /* end */ |
| 11512 | }; |
| 11513 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11514 | static const struct hda_verb alc262_hp_t5735_verbs[] = { |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11515 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11516 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11517 | |
| 11518 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11519 | { } |
| 11520 | }; |
| 11521 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11522 | static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 11523 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11524 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 11525 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 11526 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11527 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11528 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11529 | { } /* end */ |
| 11530 | }; |
| 11531 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11532 | static const struct hda_verb alc262_hp_rp5700_verbs[] = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11533 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11534 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11535 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11536 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11537 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11538 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11539 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11540 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11541 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11542 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 11543 | {} |
| 11544 | }; |
| 11545 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11546 | static const struct hda_input_mux alc262_hp_rp5700_capture_source = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11547 | .num_items = 1, |
| 11548 | .items = { |
| 11549 | { "Line", 0x1 }, |
| 11550 | }, |
| 11551 | }; |
| 11552 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11553 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11554 | #define alc262_hippo_master_update alc262_hp_master_update |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11555 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11556 | #define alc262_hippo_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11557 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11558 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11559 | { \ |
| 11560 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11561 | .name = "Master Playback Switch", \ |
| 11562 | .info = snd_ctl_boolean_mono_info, \ |
| 11563 | .get = alc262_hippo_master_sw_get, \ |
| 11564 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11565 | }, \ |
| 11566 | { \ |
| 11567 | .iface = NID_MAPPING, \ |
| 11568 | .name = "Master Playback Switch", \ |
| 11569 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11570 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11571 | } |
| 11572 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11573 | static const struct snd_kcontrol_new alc262_hippo_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11574 | ALC262_HIPPO_MASTER_SWITCH, |
| 11575 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11576 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11577 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11578 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11579 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11580 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11581 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11582 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11583 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11584 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11585 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11586 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11587 | { } /* end */ |
| 11588 | }; |
| 11589 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11590 | static const struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11591 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11592 | ALC262_HIPPO_MASTER_SWITCH, |
| 11593 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11594 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11595 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11596 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11597 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11598 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11599 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11600 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11601 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11602 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11603 | { } /* end */ |
| 11604 | }; |
| 11605 | |
| 11606 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11607 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11608 | { |
| 11609 | struct alc_spec *spec = codec->spec; |
| 11610 | |
| 11611 | spec->autocfg.hp_pins[0] = 0x15; |
| 11612 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11613 | spec->automute = 1; |
| 11614 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11615 | } |
| 11616 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11617 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11618 | { |
| 11619 | struct alc_spec *spec = codec->spec; |
| 11620 | |
| 11621 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11622 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 11623 | spec->automute = 1; |
| 11624 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11625 | } |
| 11626 | |
| 11627 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11628 | static const struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11629 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11630 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11633 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11634 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11635 | { } /* end */ |
| 11636 | }; |
| 11637 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11638 | static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11639 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11640 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11641 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11644 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11645 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11646 | { } /* end */ |
| 11647 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11648 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11649 | static const struct snd_kcontrol_new alc262_tyan_mixer[] = { |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11650 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11651 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11652 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11653 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11654 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11655 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11656 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11657 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11658 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11659 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11660 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11661 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11662 | { } /* end */ |
| 11663 | }; |
| 11664 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11665 | static const struct hda_verb alc262_tyan_verbs[] = { |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11666 | /* Headphone automute */ |
| 11667 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11668 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11669 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11670 | |
| 11671 | /* P11 AUX_IN, white 4-pin connector */ |
| 11672 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11673 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11674 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11675 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11676 | |
| 11677 | {} |
| 11678 | }; |
| 11679 | |
| 11680 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11681 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11682 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11683 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11684 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11685 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11686 | spec->autocfg.speaker_pins[0] = 0x15; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11687 | spec->automute = 1; |
| 11688 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11689 | } |
| 11690 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11691 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11692 | #define alc262_capture_mixer alc882_capture_mixer |
| 11693 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11694 | |
| 11695 | /* |
| 11696 | * generic initialization of ADC, input mixers and output mixers |
| 11697 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11698 | static const struct hda_verb alc262_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11699 | /* |
| 11700 | * Unmute ADC0-2 and set the default input to mic-in |
| 11701 | */ |
| 11702 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11704 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11705 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11706 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11707 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11708 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11709 | /* 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] | 11710 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11711 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11712 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11713 | */ |
| 11714 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11715 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11716 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11717 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11718 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11719 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11720 | |
| 11721 | /* |
| 11722 | * Set up output mixers (0x0c - 0x0e) |
| 11723 | */ |
| 11724 | /* set vol=0 to output mixers */ |
| 11725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11726 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11727 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11728 | /* set up input amps for analog loopback */ |
| 11729 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11730 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11731 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11732 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11733 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11734 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11735 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11736 | |
| 11737 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11738 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11739 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11740 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11741 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11742 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11743 | |
| 11744 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11746 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11747 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11748 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11749 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11750 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11751 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11752 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11753 | /* FIXME: use matrix-type input source selection */ |
| 11754 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11755 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11756 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11757 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11758 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11759 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11760 | /* Input mixer2 */ |
| 11761 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11762 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11763 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11764 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11765 | /* Input mixer3 */ |
| 11766 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11767 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11768 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11770 | |
| 11771 | { } |
| 11772 | }; |
| 11773 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11774 | static const struct hda_verb alc262_eapd_verbs[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11775 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11776 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11777 | { } |
| 11778 | }; |
| 11779 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11780 | static const struct hda_verb alc262_hippo1_unsol_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11781 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11782 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11783 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11784 | |
| 11785 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11786 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11787 | {} |
| 11788 | }; |
| 11789 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11790 | static const struct hda_verb alc262_sony_unsol_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11791 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11792 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11793 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11794 | |
| 11795 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11796 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11797 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11798 | }; |
| 11799 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11800 | static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11801 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11802 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11803 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11804 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11805 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11806 | { } /* end */ |
| 11807 | }; |
| 11808 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11809 | static const struct hda_verb alc262_toshiba_s06_verbs[] = { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11810 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11811 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11813 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11814 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11816 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11817 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11818 | {} |
| 11819 | }; |
| 11820 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11821 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11822 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11823 | struct alc_spec *spec = codec->spec; |
| 11824 | |
| 11825 | spec->autocfg.hp_pins[0] = 0x15; |
| 11826 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11827 | spec->ext_mic.pin = 0x18; |
| 11828 | spec->ext_mic.mux_idx = 0; |
| 11829 | spec->int_mic.pin = 0x12; |
| 11830 | spec->int_mic.mux_idx = 9; |
| 11831 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 11832 | spec->automute = 1; |
| 11833 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11834 | } |
| 11835 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11836 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11837 | * nec model |
| 11838 | * 0x15 = headphone |
| 11839 | * 0x16 = internal speaker |
| 11840 | * 0x18 = external mic |
| 11841 | */ |
| 11842 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11843 | static const struct snd_kcontrol_new alc262_nec_mixer[] = { |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11844 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11845 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11846 | |
| 11847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11849 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11850 | |
| 11851 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11852 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11853 | { } /* end */ |
| 11854 | }; |
| 11855 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11856 | static const struct hda_verb alc262_nec_verbs[] = { |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11857 | /* Unmute Speaker */ |
| 11858 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11859 | |
| 11860 | /* Headphone */ |
| 11861 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11862 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11863 | |
| 11864 | /* External mic to headphone */ |
| 11865 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11866 | /* External mic to speaker */ |
| 11867 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11868 | {} |
| 11869 | }; |
| 11870 | |
| 11871 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11872 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11873 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11874 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11875 | */ |
| 11876 | |
Takashi Iwai | 20f5e0b | 2011-06-10 09:31:54 +0200 | [diff] [blame] | 11877 | #define ALC_HP_EVENT ALC880_HP_EVENT |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11878 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11879 | static const struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11880 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11882 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11883 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11884 | {} |
| 11885 | }; |
| 11886 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11887 | static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11888 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11889 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11890 | {} |
| 11891 | }; |
| 11892 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11893 | static const struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11894 | /* Front Mic pin: input vref at 50% */ |
| 11895 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11896 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11897 | {} |
| 11898 | }; |
| 11899 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11900 | static const struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11901 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11902 | .items = { |
| 11903 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11904 | { "Internal Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11905 | { "CD", 0x4 }, |
| 11906 | }, |
| 11907 | }; |
| 11908 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11909 | static const struct hda_input_mux alc262_HP_capture_source = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11910 | .num_items = 5, |
| 11911 | .items = { |
| 11912 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11913 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11914 | { "Line", 0x2 }, |
| 11915 | { "CD", 0x4 }, |
| 11916 | { "AUX IN", 0x6 }, |
| 11917 | }, |
| 11918 | }; |
| 11919 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11920 | static const struct hda_input_mux alc262_HP_D7000_capture_source = { |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11921 | .num_items = 4, |
| 11922 | .items = { |
| 11923 | { "Mic", 0x0 }, |
| 11924 | { "Front Mic", 0x2 }, |
| 11925 | { "Line", 0x1 }, |
| 11926 | { "CD", 0x4 }, |
| 11927 | }, |
| 11928 | }; |
| 11929 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11930 | static void alc262_fujitsu_setup(struct hda_codec *codec) |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11931 | { |
| 11932 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11933 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11934 | spec->autocfg.hp_pins[0] = 0x14; |
| 11935 | spec->autocfg.hp_pins[1] = 0x1b; |
| 11936 | spec->autocfg.speaker_pins[0] = 0x15; |
| 11937 | spec->automute = 1; |
| 11938 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11939 | } |
| 11940 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11941 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11942 | static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11943 | .ops = &snd_hda_bind_vol, |
| 11944 | .values = { |
| 11945 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11946 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11947 | 0 |
| 11948 | }, |
| 11949 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11950 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11951 | static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11952 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11953 | { |
| 11954 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11955 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11956 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 11957 | .info = snd_ctl_boolean_mono_info, |
| 11958 | .get = alc262_hp_master_sw_get, |
| 11959 | .put = alc262_hp_master_sw_put, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11960 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11961 | { |
| 11962 | .iface = NID_MAPPING, |
| 11963 | .name = "Master Playback Switch", |
| 11964 | .private_value = 0x1b, |
| 11965 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11966 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11967 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11968 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 11971 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 11972 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11973 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11974 | { } /* end */ |
| 11975 | }; |
| 11976 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11977 | static void alc262_lenovo_3000_setup(struct hda_codec *codec) |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11978 | { |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11979 | struct alc_spec *spec = codec->spec; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11980 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11981 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11982 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11983 | spec->autocfg.speaker_pins[1] = 0x16; |
| 11984 | spec->automute = 1; |
| 11985 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11986 | } |
| 11987 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 11988 | static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11989 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11990 | { |
| 11991 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11992 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 11993 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b, |
| 11994 | .info = snd_ctl_boolean_mono_info, |
| 11995 | .get = alc262_hp_master_sw_get, |
| 11996 | .put = alc262_hp_master_sw_put, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11997 | }, |
| 11998 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11999 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12000 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12001 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12003 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 12004 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12005 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12006 | { } /* end */ |
| 12007 | }; |
| 12008 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12009 | static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12010 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12011 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12014 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12015 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12016 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12017 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12018 | { } /* end */ |
| 12019 | }; |
| 12020 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12021 | /* additional init verbs for Benq laptops */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12022 | static const struct hda_verb alc262_EAPD_verbs[] = { |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12023 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12024 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 12025 | {} |
| 12026 | }; |
| 12027 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12028 | static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12029 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12030 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12031 | |
| 12032 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 12033 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 12034 | {} |
| 12035 | }; |
| 12036 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12037 | /* Samsung Q1 Ultra Vista model setup */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12038 | static const struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12039 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 12040 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12041 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12042 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 12043 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 12044 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12045 | { } /* end */ |
| 12046 | }; |
| 12047 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12048 | static const struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12049 | /* output mixer */ |
| 12050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12052 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12053 | /* speaker */ |
| 12054 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12055 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12056 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12057 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12058 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12059 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12060 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12061 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12062 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12063 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12064 | /* internal mic */ |
| 12065 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12066 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12067 | /* ADC, choose mic */ |
| 12068 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12070 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12074 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12075 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12076 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 12077 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12078 | {} |
| 12079 | }; |
| 12080 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12081 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12082 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 12083 | { |
| 12084 | struct alc_spec *spec = codec->spec; |
| 12085 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12086 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12087 | mute = 0; |
| 12088 | /* auto-mute only when HP is used as HP */ |
| 12089 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12090 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12091 | if (spec->jack_present) |
| 12092 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12093 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12094 | /* mute/unmute internal speaker */ |
| 12095 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12096 | HDA_AMP_MUTE, mute); |
| 12097 | /* mute/unmute HP */ |
| 12098 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12099 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12100 | } |
| 12101 | |
| 12102 | /* unsolicited event for HP jack sensing */ |
| 12103 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 12104 | unsigned int res) |
| 12105 | { |
| 12106 | if ((res >> 26) != ALC880_HP_EVENT) |
| 12107 | return; |
| 12108 | alc262_ultra_automute(codec); |
| 12109 | } |
| 12110 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12111 | static const struct hda_input_mux alc262_ultra_capture_source = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12112 | .num_items = 2, |
| 12113 | .items = { |
| 12114 | { "Mic", 0x1 }, |
| 12115 | { "Headphone", 0x7 }, |
| 12116 | }, |
| 12117 | }; |
| 12118 | |
| 12119 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12120 | struct snd_ctl_elem_value *ucontrol) |
| 12121 | { |
| 12122 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12123 | struct alc_spec *spec = codec->spec; |
| 12124 | int ret; |
| 12125 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12126 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12127 | if (!ret) |
| 12128 | return 0; |
| 12129 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 12130 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 12131 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12132 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 12133 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 12134 | return ret; |
| 12135 | } |
| 12136 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12137 | static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12138 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 12139 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 12140 | { |
| 12141 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12142 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 12143 | .info = alc_mux_enum_info, |
| 12144 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12145 | .put = alc262_ultra_mux_enum_put, |
| 12146 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 12147 | { |
| 12148 | .iface = NID_MAPPING, |
| 12149 | .name = "Capture Source", |
| 12150 | .private_value = 0x15, |
| 12151 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12152 | { } /* end */ |
| 12153 | }; |
| 12154 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12155 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 12156 | * and thus it's bound with a different mixer. |
| 12157 | * This function returns which mixer amp should be used. |
| 12158 | */ |
| 12159 | static int alc262_check_volbit(hda_nid_t nid) |
| 12160 | { |
| 12161 | if (!nid) |
| 12162 | return 0; |
| 12163 | else if (nid == 0x16) |
| 12164 | return 2; |
| 12165 | else |
| 12166 | return 1; |
| 12167 | } |
| 12168 | |
| 12169 | 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] | 12170 | const char *pfx, int *vbits, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12171 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12172 | unsigned long val; |
| 12173 | int vbit; |
| 12174 | |
| 12175 | vbit = alc262_check_volbit(nid); |
| 12176 | if (!vbit) |
| 12177 | return 0; |
| 12178 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 12179 | return 0; |
| 12180 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12181 | if (vbit == 2) |
| 12182 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 12183 | else |
| 12184 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12185 | 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] | 12186 | } |
| 12187 | |
| 12188 | 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] | 12189 | const char *pfx, int idx) |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12190 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12191 | unsigned long val; |
| 12192 | |
| 12193 | if (!nid) |
| 12194 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12195 | if (nid == 0x16) |
| 12196 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 12197 | else |
| 12198 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12199 | 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] | 12200 | } |
| 12201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12202 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12203 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12204 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12205 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12206 | const char *pfx; |
| 12207 | int vbits; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 12208 | int i, index, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12209 | |
| 12210 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12211 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 12212 | spec->private_dac_nids[0] = 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12213 | |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12214 | for (i = 0; i < 2; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 12215 | pfx = alc_get_line_out_pfx(spec, i, true, &index); |
| 12216 | if (!pfx) |
| 12217 | pfx = "PCM"; |
| 12218 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12219 | index); |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12220 | if (err < 0) |
| 12221 | return err; |
| 12222 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12223 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
| 12224 | "Speaker", i); |
| 12225 | if (err < 0) |
| 12226 | return err; |
| 12227 | } |
| 12228 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12229 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], |
| 12230 | "Headphone", i); |
| 12231 | if (err < 0) |
| 12232 | return err; |
| 12233 | } |
| 12234 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12235 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12236 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 12237 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 12238 | alc262_check_volbit(cfg->hp_pins[0]); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 12239 | vbits = 0; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12240 | for (i = 0; i < 2; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 12241 | pfx = alc_get_line_out_pfx(spec, i, true, &index); |
| 12242 | if (!pfx) |
| 12243 | pfx = "PCM"; |
Takashi Iwai | 033688a | 2010-09-08 15:47:09 +0200 | [diff] [blame] | 12244 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
| 12245 | &vbits, i); |
| 12246 | if (err < 0) |
| 12247 | return err; |
| 12248 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 12249 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
| 12250 | "Speaker", &vbits, i); |
| 12251 | if (err < 0) |
| 12252 | return err; |
| 12253 | } |
| 12254 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { |
| 12255 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], |
| 12256 | "Headphone", &vbits, i); |
| 12257 | if (err < 0) |
| 12258 | return err; |
| 12259 | } |
| 12260 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12261 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12262 | } |
| 12263 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12264 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 12265 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12266 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12267 | static const struct hda_verb alc262_HP_BPC_init_verbs[] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12268 | /* |
| 12269 | * Unmute ADC0-2 and set the default input to mic-in |
| 12270 | */ |
| 12271 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12272 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12273 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12274 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12275 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12276 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12277 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12278 | /* 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] | 12279 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12280 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12281 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12282 | */ |
| 12283 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12284 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12291 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12292 | /* |
| 12293 | * Set up output mixers (0x0c - 0x0e) |
| 12294 | */ |
| 12295 | /* set vol=0 to output mixers */ |
| 12296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12297 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12298 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12299 | |
| 12300 | /* set up input amps for analog loopback */ |
| 12301 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12302 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12303 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12304 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12305 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12306 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12307 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12308 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12309 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12310 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12311 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12312 | |
| 12313 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12314 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12315 | |
| 12316 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12317 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12318 | |
| 12319 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12320 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12321 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12322 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12323 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12324 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12325 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12326 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12327 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12328 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12329 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12330 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12331 | |
| 12332 | |
| 12333 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12334 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 12335 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12336 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12337 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12338 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12339 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12340 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12341 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12342 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12343 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12344 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12345 | /* Input mixer2 */ |
| 12346 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12347 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12348 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12350 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12351 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12352 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12353 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12354 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12355 | /* Input mixer3 */ |
| 12356 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 12357 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 12358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 12359 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 12360 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 12361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 12362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 12363 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 12364 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12365 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12366 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12367 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12368 | { } |
| 12369 | }; |
| 12370 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12371 | static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12372 | /* |
| 12373 | * Unmute ADC0-2 and set the default input to mic-in |
| 12374 | */ |
| 12375 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12376 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12377 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12379 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12380 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12381 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12382 | /* 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] | 12383 | * mixer widget |
| 12384 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12385 | * panel mic (mic 2) |
| 12386 | */ |
| 12387 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12391 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12392 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12393 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12394 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12395 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12396 | /* |
| 12397 | * Set up output mixers (0x0c - 0x0e) |
| 12398 | */ |
| 12399 | /* set vol=0 to output mixers */ |
| 12400 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12401 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12402 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12403 | |
| 12404 | /* set up input amps for analog loopback */ |
| 12405 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12406 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12407 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12408 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12409 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12410 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12411 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12412 | |
| 12413 | |
| 12414 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12415 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12416 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12417 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12418 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12419 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12420 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12421 | |
| 12422 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12424 | |
| 12425 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12426 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12427 | |
| 12428 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12429 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12430 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12431 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12432 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12433 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12434 | |
| 12435 | /* FIXME: use matrix-type input source selection */ |
| 12436 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12437 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12438 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12439 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12440 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12441 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12442 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12443 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12444 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12445 | /* Input mixer2 */ |
| 12446 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12447 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12448 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12449 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12450 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12451 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12452 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12453 | /* Input mixer3 */ |
| 12454 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12455 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12456 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12457 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12459 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12460 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12461 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12462 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12463 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12464 | { } |
| 12465 | }; |
| 12466 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12467 | static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12468 | |
| 12469 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12470 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12471 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12472 | |
| 12473 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12474 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12475 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12476 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12477 | |
| 12478 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12479 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12480 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12481 | {} |
| 12482 | }; |
| 12483 | |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12484 | /* |
| 12485 | * Pin config fixes |
| 12486 | */ |
| 12487 | enum { |
| 12488 | PINFIX_FSC_H270, |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12489 | PINFIX_HP_Z200, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12490 | }; |
| 12491 | |
| 12492 | static const struct alc_fixup alc262_fixups[] = { |
| 12493 | [PINFIX_FSC_H270] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12494 | .type = ALC_FIXUP_PINS, |
| 12495 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12496 | { 0x14, 0x99130110 }, /* speaker */ |
| 12497 | { 0x15, 0x0221142f }, /* front HP */ |
| 12498 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 12499 | { } |
| 12500 | } |
| 12501 | }, |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12502 | [PINFIX_HP_Z200] = { |
| 12503 | .type = ALC_FIXUP_PINS, |
| 12504 | .v.pins = (const struct alc_pincfg[]) { |
| 12505 | { 0x16, 0x99130120 }, /* internal speaker */ |
| 12506 | { } |
| 12507 | } |
| 12508 | }, |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12509 | }; |
| 12510 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12511 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12512 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200), |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12513 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), |
| 12514 | {} |
| 12515 | }; |
| 12516 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12517 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12518 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12519 | #define alc262_loopbacks alc880_loopbacks |
| 12520 | #endif |
| 12521 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12522 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12523 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12524 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12525 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12526 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12527 | |
| 12528 | /* |
| 12529 | * BIOS auto configuration |
| 12530 | */ |
| 12531 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12532 | { |
| 12533 | struct alc_spec *spec = codec->spec; |
| 12534 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12535 | static const hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12536 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12537 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12538 | alc262_ignore); |
| 12539 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12540 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12541 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12542 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12543 | spec->multiout.max_channels = 2; |
| 12544 | spec->no_analog = 1; |
| 12545 | goto dig_only; |
| 12546 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12547 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12548 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12549 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12550 | if (err < 0) |
| 12551 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12552 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12553 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12554 | return err; |
| 12555 | |
| 12556 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12557 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12558 | dig_only: |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12559 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12560 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12561 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12562 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12563 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12564 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12565 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12566 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12567 | err = alc_auto_add_mic_boost(codec); |
| 12568 | if (err < 0) |
| 12569 | return err; |
| 12570 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12571 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12572 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12573 | return 1; |
| 12574 | } |
| 12575 | |
| 12576 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12577 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12578 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12579 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12580 | |
| 12581 | |
| 12582 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12583 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12584 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12585 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12586 | alc262_auto_init_multi_out(codec); |
| 12587 | alc262_auto_init_hp_out(codec); |
| 12588 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12589 | alc262_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 12590 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12591 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12592 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12593 | } |
| 12594 | |
| 12595 | /* |
| 12596 | * configuration and preset |
| 12597 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 12598 | static const char * const alc262_models[ALC262_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12599 | [ALC262_BASIC] = "basic", |
| 12600 | [ALC262_HIPPO] = "hippo", |
| 12601 | [ALC262_HIPPO_1] = "hippo_1", |
| 12602 | [ALC262_FUJITSU] = "fujitsu", |
| 12603 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12604 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12605 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12606 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12607 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12608 | [ALC262_BENQ_T31] = "benq-t31", |
| 12609 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12610 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12611 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12612 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12613 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12614 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12615 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12616 | [ALC262_AUTO] = "auto", |
| 12617 | }; |
| 12618 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12619 | static const struct snd_pci_quirk alc262_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12620 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12621 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12622 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12623 | ALC262_HP_BPC), |
| 12624 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12625 | ALC262_HP_BPC), |
Takashi Iwai | 5734a07 | 2011-01-19 17:07:12 +0100 | [diff] [blame] | 12626 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series", |
| 12627 | ALC262_HP_BPC), |
David Henningsson | d2a19da | 2011-06-22 09:58:37 +0200 | [diff] [blame] | 12628 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", |
| 12629 | ALC262_AUTO), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12630 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12631 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12632 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12633 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12634 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12635 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12636 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12637 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12638 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12639 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12640 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12641 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12642 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12643 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12644 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12645 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12646 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12647 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12648 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12649 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12650 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12651 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12652 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12653 | #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] | 12654 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12655 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12656 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12657 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12658 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12659 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12660 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12661 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12662 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12663 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12664 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12665 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12666 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12667 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12668 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12669 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12670 | {} |
| 12671 | }; |
| 12672 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 12673 | static const struct alc_config_preset alc262_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12674 | [ALC262_BASIC] = { |
| 12675 | .mixers = { alc262_base_mixer }, |
| 12676 | .init_verbs = { alc262_init_verbs }, |
| 12677 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12678 | .dac_nids = alc262_dac_nids, |
| 12679 | .hp_nid = 0x03, |
| 12680 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12681 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12682 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12683 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12684 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12685 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12686 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12687 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12688 | .dac_nids = alc262_dac_nids, |
| 12689 | .hp_nid = 0x03, |
| 12690 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12691 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12692 | .channel_mode = alc262_modes, |
| 12693 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12694 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12695 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12696 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12697 | }, |
| 12698 | [ALC262_HIPPO_1] = { |
| 12699 | .mixers = { alc262_hippo1_mixer }, |
| 12700 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12701 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12702 | .dac_nids = alc262_dac_nids, |
| 12703 | .hp_nid = 0x02, |
| 12704 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12705 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12706 | .channel_mode = alc262_modes, |
| 12707 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12708 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12709 | .setup = alc262_hippo1_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12710 | .init_hook = alc_inithook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12711 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12712 | [ALC262_FUJITSU] = { |
| 12713 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12714 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12715 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12716 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12717 | .dac_nids = alc262_dac_nids, |
| 12718 | .hp_nid = 0x03, |
| 12719 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12720 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12721 | .channel_mode = alc262_modes, |
| 12722 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12723 | .unsol_event = alc_sku_unsol_event, |
| 12724 | .setup = alc262_fujitsu_setup, |
| 12725 | .init_hook = alc_inithook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12726 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12727 | [ALC262_HP_BPC] = { |
| 12728 | .mixers = { alc262_HP_BPC_mixer }, |
| 12729 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12730 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12731 | .dac_nids = alc262_dac_nids, |
| 12732 | .hp_nid = 0x03, |
| 12733 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12734 | .channel_mode = alc262_modes, |
| 12735 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12736 | .unsol_event = alc_sku_unsol_event, |
| 12737 | .setup = alc262_hp_bpc_setup, |
| 12738 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12739 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12740 | [ALC262_HP_BPC_D7000_WF] = { |
| 12741 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12742 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12743 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12744 | .dac_nids = alc262_dac_nids, |
| 12745 | .hp_nid = 0x03, |
| 12746 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12747 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12748 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12749 | .unsol_event = alc_sku_unsol_event, |
| 12750 | .setup = alc262_hp_wildwest_setup, |
| 12751 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12752 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12753 | [ALC262_HP_BPC_D7000_WL] = { |
| 12754 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12755 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12756 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12757 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12758 | .dac_nids = alc262_dac_nids, |
| 12759 | .hp_nid = 0x03, |
| 12760 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12761 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12762 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12763 | .unsol_event = alc_sku_unsol_event, |
| 12764 | .setup = alc262_hp_wildwest_setup, |
| 12765 | .init_hook = alc_inithook, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12766 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12767 | [ALC262_HP_TC_T5735] = { |
| 12768 | .mixers = { alc262_hp_t5735_mixer }, |
| 12769 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12770 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12771 | .dac_nids = alc262_dac_nids, |
| 12772 | .hp_nid = 0x03, |
| 12773 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12774 | .channel_mode = alc262_modes, |
| 12775 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12776 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12777 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12778 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12779 | }, |
| 12780 | [ALC262_HP_RP5700] = { |
| 12781 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12782 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12783 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12784 | .dac_nids = alc262_dac_nids, |
| 12785 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12786 | .channel_mode = alc262_modes, |
| 12787 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12788 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12789 | [ALC262_BENQ_ED8] = { |
| 12790 | .mixers = { alc262_base_mixer }, |
| 12791 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12792 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12793 | .dac_nids = alc262_dac_nids, |
| 12794 | .hp_nid = 0x03, |
| 12795 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12796 | .channel_mode = alc262_modes, |
| 12797 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12798 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12799 | [ALC262_SONY_ASSAMD] = { |
| 12800 | .mixers = { alc262_sony_mixer }, |
| 12801 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12802 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12803 | .dac_nids = alc262_dac_nids, |
| 12804 | .hp_nid = 0x02, |
| 12805 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12806 | .channel_mode = alc262_modes, |
| 12807 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12808 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12809 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12810 | .init_hook = alc_inithook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12811 | }, |
| 12812 | [ALC262_BENQ_T31] = { |
| 12813 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12814 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12815 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12816 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12817 | .dac_nids = alc262_dac_nids, |
| 12818 | .hp_nid = 0x03, |
| 12819 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12820 | .channel_mode = alc262_modes, |
| 12821 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12822 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12823 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12824 | .init_hook = alc_inithook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12825 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12826 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12827 | .mixers = { alc262_ultra_mixer }, |
| 12828 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12829 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12830 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12831 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12832 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12833 | .channel_mode = alc262_modes, |
| 12834 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12835 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12836 | .capsrc_nids = alc262_capsrc_nids, |
| 12837 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12838 | .unsol_event = alc262_ultra_unsol_event, |
| 12839 | .init_hook = alc262_ultra_automute, |
| 12840 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12841 | [ALC262_LENOVO_3000] = { |
| 12842 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12843 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12844 | alc262_lenovo_3000_unsol_verbs, |
| 12845 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12846 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12847 | .dac_nids = alc262_dac_nids, |
| 12848 | .hp_nid = 0x03, |
| 12849 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12850 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12851 | .channel_mode = alc262_modes, |
| 12852 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 12853 | .unsol_event = alc_sku_unsol_event, |
| 12854 | .setup = alc262_lenovo_3000_setup, |
| 12855 | .init_hook = alc_inithook, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12856 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12857 | [ALC262_NEC] = { |
| 12858 | .mixers = { alc262_nec_mixer }, |
| 12859 | .init_verbs = { alc262_nec_verbs }, |
| 12860 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12861 | .dac_nids = alc262_dac_nids, |
| 12862 | .hp_nid = 0x03, |
| 12863 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12864 | .channel_mode = alc262_modes, |
| 12865 | .input_mux = &alc262_capture_source, |
| 12866 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12867 | [ALC262_TOSHIBA_S06] = { |
| 12868 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12869 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12870 | alc262_eapd_verbs }, |
| 12871 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12872 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12873 | .dac_nids = alc262_dac_nids, |
| 12874 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12875 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12876 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12877 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12878 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12879 | .unsol_event = alc_sku_unsol_event, |
| 12880 | .setup = alc262_toshiba_s06_setup, |
| 12881 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12882 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12883 | [ALC262_TOSHIBA_RX1] = { |
| 12884 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12885 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12886 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12887 | .dac_nids = alc262_dac_nids, |
| 12888 | .hp_nid = 0x03, |
| 12889 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12890 | .channel_mode = alc262_modes, |
| 12891 | .input_mux = &alc262_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12892 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12893 | .setup = alc262_hippo_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 12894 | .init_hook = alc_inithook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12895 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12896 | [ALC262_TYAN] = { |
| 12897 | .mixers = { alc262_tyan_mixer }, |
| 12898 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12899 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12900 | .dac_nids = alc262_dac_nids, |
| 12901 | .hp_nid = 0x02, |
| 12902 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12903 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12904 | .channel_mode = alc262_modes, |
| 12905 | .input_mux = &alc262_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12906 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12907 | .setup = alc262_tyan_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 12908 | .init_hook = alc_hp_automute, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12909 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12910 | }; |
| 12911 | |
| 12912 | static int patch_alc262(struct hda_codec *codec) |
| 12913 | { |
| 12914 | struct alc_spec *spec; |
| 12915 | int board_config; |
| 12916 | int err; |
| 12917 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12918 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12919 | if (spec == NULL) |
| 12920 | return -ENOMEM; |
| 12921 | |
| 12922 | codec->spec = spec; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 12923 | |
| 12924 | spec->mixer_nid = 0x0b; |
| 12925 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12926 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12927 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12928 | * under-run |
| 12929 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12930 | { |
| 12931 | int tmp; |
| 12932 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12933 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12934 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12935 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12936 | } |
| 12937 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12938 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12939 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12940 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12941 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12942 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12943 | alc262_models, |
| 12944 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12945 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12946 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12947 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12948 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12949 | board_config = ALC262_AUTO; |
| 12950 | } |
| 12951 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 12952 | if (board_config == ALC262_AUTO) { |
| 12953 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 12954 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 12955 | } |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 12956 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12957 | if (board_config == ALC262_AUTO) { |
| 12958 | /* automatic parse from the BIOS config */ |
| 12959 | err = alc262_parse_auto_config(codec); |
| 12960 | if (err < 0) { |
| 12961 | alc_free(codec); |
| 12962 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12963 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12964 | printk(KERN_INFO |
| 12965 | "hda_codec: Cannot set up configuration " |
| 12966 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12967 | board_config = ALC262_BASIC; |
| 12968 | } |
| 12969 | } |
| 12970 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12971 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12972 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12973 | if (err < 0) { |
| 12974 | alc_free(codec); |
| 12975 | return err; |
| 12976 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12977 | } |
| 12978 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12979 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12980 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12981 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12982 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12983 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12984 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12985 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12986 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12987 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12988 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12989 | int i; |
| 12990 | /* check whether the digital-mic has to be supported */ |
| 12991 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12992 | if (spec->input_mux->items[i].index >= 9) |
| 12993 | break; |
| 12994 | } |
| 12995 | if (i < spec->input_mux->num_items) { |
| 12996 | /* use only ADC0 */ |
| 12997 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12998 | spec->num_adc_nids = 1; |
| 12999 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13000 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13001 | /* all analog inputs */ |
| 13002 | /* check whether NID 0x07 is valid */ |
| 13003 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 13004 | |
| 13005 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13006 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13007 | if (wcap != AC_WID_AUD_IN) { |
| 13008 | spec->adc_nids = alc262_adc_nids_alt; |
| 13009 | spec->num_adc_nids = |
| 13010 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 13011 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 13012 | } else { |
| 13013 | spec->adc_nids = alc262_adc_nids; |
| 13014 | spec->num_adc_nids = |
| 13015 | ARRAY_SIZE(alc262_adc_nids); |
| 13016 | spec->capsrc_nids = alc262_capsrc_nids; |
| 13017 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13018 | } |
| 13019 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 13020 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13021 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 13022 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 13023 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13024 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 13025 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 18675e4 | 2010-09-08 15:55:44 +0200 | [diff] [blame] | 13026 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13027 | spec->vmaster_nid = 0x0c; |
| 13028 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13029 | codec->patch_ops = alc_patch_ops; |
| 13030 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 13031 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 13032 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 13033 | |
| 13034 | alc_init_jacks(codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13035 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13036 | if (!spec->loopback.amplist) |
| 13037 | spec->loopback.amplist = alc262_loopbacks; |
| 13038 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13039 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13040 | return 0; |
| 13041 | } |
| 13042 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13043 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13044 | * ALC268 channel source setting (2 channel) |
| 13045 | */ |
| 13046 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 13047 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13048 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13049 | static const hda_nid_t alc268_dac_nids[2] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13050 | /* front, hp */ |
| 13051 | 0x02, 0x03 |
| 13052 | }; |
| 13053 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13054 | static const hda_nid_t alc268_adc_nids[2] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13055 | /* ADC0-1 */ |
| 13056 | 0x08, 0x07 |
| 13057 | }; |
| 13058 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13059 | static const hda_nid_t alc268_adc_nids_alt[1] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13060 | /* ADC0 */ |
| 13061 | 0x08 |
| 13062 | }; |
| 13063 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13064 | static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13065 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13066 | static const struct snd_kcontrol_new alc268_base_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13067 | /* output mixer control */ |
| 13068 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13069 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13070 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13071 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13072 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13073 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13074 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13075 | { } |
| 13076 | }; |
| 13077 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13078 | static const struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13079 | /* output mixer control */ |
| 13080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13081 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13082 | ALC262_HIPPO_MASTER_SWITCH, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13083 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13084 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13085 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13086 | { } |
| 13087 | }; |
| 13088 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13089 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13090 | static const struct hda_bind_ctls alc268_bind_beep_sw = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13091 | .ops = &snd_hda_bind_sw, |
| 13092 | .values = { |
| 13093 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 13094 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 13095 | 0 |
| 13096 | }, |
| 13097 | }; |
| 13098 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13099 | static const struct snd_kcontrol_new alc268_beep_mixer[] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13100 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 13101 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 13102 | { } |
| 13103 | }; |
| 13104 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13105 | static const struct hda_verb alc268_eapd_verbs[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13106 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13107 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13108 | { } |
| 13109 | }; |
| 13110 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13111 | /* Toshiba specific */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13112 | static const struct hda_verb alc268_toshiba_verbs[] = { |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13113 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13114 | { } /* end */ |
| 13115 | }; |
| 13116 | |
| 13117 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13118 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13119 | static const struct hda_bind_ctls alc268_acer_bind_master_vol = { |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 13120 | .ops = &snd_hda_bind_vol, |
| 13121 | .values = { |
| 13122 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 13123 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 13124 | 0 |
| 13125 | }, |
| 13126 | }; |
| 13127 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13128 | static void alc268_acer_setup(struct hda_codec *codec) |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13129 | { |
| 13130 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13131 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13132 | spec->autocfg.hp_pins[0] = 0x14; |
| 13133 | spec->autocfg.speaker_pins[0] = 0x15; |
| 13134 | spec->automute = 1; |
| 13135 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13136 | } |
| 13137 | |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13138 | #define alc268_acer_master_sw_get alc262_hp_master_sw_get |
| 13139 | #define alc268_acer_master_sw_put alc262_hp_master_sw_put |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13140 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13141 | static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13142 | /* output mixer control */ |
| 13143 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13144 | { |
| 13145 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13146 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13147 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x15, |
| 13148 | .info = snd_ctl_boolean_mono_info, |
| 13149 | .get = alc268_acer_master_sw_get, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13150 | .put = alc268_acer_master_sw_put, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13151 | }, |
| 13152 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 13153 | { } |
| 13154 | }; |
| 13155 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13156 | static const struct snd_kcontrol_new alc268_acer_mixer[] = { |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13157 | /* output mixer control */ |
| 13158 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13159 | { |
| 13160 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13161 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13162 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13163 | .info = snd_ctl_boolean_mono_info, |
| 13164 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13165 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13166 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13167 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13168 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
| 13169 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13170 | { } |
| 13171 | }; |
| 13172 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13173 | static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13174 | /* output mixer control */ |
| 13175 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13176 | { |
| 13177 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13178 | .name = "Master Playback Switch", |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13179 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, |
| 13180 | .info = snd_ctl_boolean_mono_info, |
| 13181 | .get = alc268_acer_master_sw_get, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13182 | .put = alc268_acer_master_sw_put, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13183 | }, |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13184 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13185 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13186 | { } |
| 13187 | }; |
| 13188 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13189 | static const struct hda_verb alc268_acer_aspire_one_verbs[] = { |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13190 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13191 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13192 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13193 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13194 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13195 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 13196 | { } |
| 13197 | }; |
| 13198 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13199 | static const struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13200 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 13201 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13202 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13203 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13204 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13205 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13206 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13207 | { } |
| 13208 | }; |
| 13209 | |
| 13210 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13211 | #define alc268_toshiba_setup alc262_hippo_setup |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13212 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13213 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 13214 | { |
| 13215 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13216 | spec->autocfg.hp_pins[0] = 0x15; |
| 13217 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13218 | spec->automute = 1; |
Takashi Iwai | 54463a6 | 2011-06-13 08:32:06 +0200 | [diff] [blame] | 13219 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13220 | spec->ext_mic.pin = 0x18; |
| 13221 | spec->ext_mic.mux_idx = 0; |
| 13222 | spec->int_mic.pin = 0x12; |
| 13223 | spec->int_mic.mux_idx = 6; |
| 13224 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13225 | } |
| 13226 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13227 | static const struct snd_kcontrol_new alc268_dell_mixer[] = { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13228 | /* output mixer control */ |
| 13229 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13230 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13231 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13233 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13234 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13235 | { } |
| 13236 | }; |
| 13237 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13238 | static const struct hda_verb alc268_dell_verbs[] = { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13240 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13241 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13242 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13243 | { } |
| 13244 | }; |
| 13245 | |
| 13246 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13247 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13248 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13249 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13250 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13251 | spec->autocfg.hp_pins[0] = 0x15; |
| 13252 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13253 | spec->ext_mic.pin = 0x18; |
| 13254 | spec->ext_mic.mux_idx = 0; |
| 13255 | spec->int_mic.pin = 0x19; |
| 13256 | spec->int_mic.mux_idx = 1; |
| 13257 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13258 | spec->automute = 1; |
| 13259 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13260 | } |
| 13261 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13262 | static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13263 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13264 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13265 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13267 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13268 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 13269 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 13270 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13271 | { } |
| 13272 | }; |
| 13273 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13274 | static const struct hda_verb alc267_quanta_il1_verbs[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13275 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13276 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 13277 | { } |
| 13278 | }; |
| 13279 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13280 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13281 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13282 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13283 | spec->autocfg.hp_pins[0] = 0x15; |
| 13284 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13285 | spec->ext_mic.pin = 0x18; |
| 13286 | spec->ext_mic.mux_idx = 0; |
| 13287 | spec->int_mic.pin = 0x19; |
| 13288 | spec->int_mic.mux_idx = 1; |
| 13289 | spec->auto_mic = 1; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 13290 | spec->automute = 1; |
| 13291 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13292 | } |
| 13293 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13294 | /* |
| 13295 | * generic initialization of ADC, input mixers and output mixers |
| 13296 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13297 | static const struct hda_verb alc268_base_init_verbs[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13298 | /* Unmute DAC0-1 and set vol = 0 */ |
| 13299 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13300 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13301 | |
| 13302 | /* |
| 13303 | * Set up output mixers (0x0c - 0x0e) |
| 13304 | */ |
| 13305 | /* set vol=0 to output mixers */ |
| 13306 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13307 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13308 | |
| 13309 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13310 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13311 | |
| 13312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13313 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 13314 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 13315 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13316 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13317 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13318 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13319 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13320 | |
| 13321 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13322 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13323 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13324 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13325 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13326 | |
| 13327 | /* set PCBEEP vol = 0, mute connections */ |
| 13328 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13329 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13330 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13331 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13332 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13333 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 13334 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13335 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13336 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13337 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13338 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13339 | { } |
| 13340 | }; |
| 13341 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13342 | /* only for model=test */ |
| 13343 | #ifdef CONFIG_SND_DEBUG |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13344 | /* |
| 13345 | * generic initialization of ADC, input mixers and output mixers |
| 13346 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13347 | static const struct hda_verb alc268_volume_init_verbs[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13348 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 13349 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13350 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13351 | |
| 13352 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13353 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 13354 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13355 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13356 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 13357 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13358 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13359 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13360 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13361 | |
| 13362 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13363 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13364 | { } |
| 13365 | }; |
| 13366 | #endif /* CONFIG_SND_DEBUG */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13367 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13368 | /* set PCBEEP vol = 0, mute connections */ |
| 13369 | static const struct hda_verb alc268_beep_init_verbs[] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13370 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13371 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13372 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13373 | { } |
| 13374 | }; |
| 13375 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13376 | static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13377 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13378 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13379 | { } /* end */ |
| 13380 | }; |
| 13381 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13382 | static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13383 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13384 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13385 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13386 | { } /* end */ |
| 13387 | }; |
| 13388 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13389 | static const struct snd_kcontrol_new alc268_capture_mixer[] = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13390 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13391 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13392 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13393 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13394 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13395 | { } /* end */ |
| 13396 | }; |
| 13397 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13398 | static const struct hda_input_mux alc268_capture_source = { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13399 | .num_items = 4, |
| 13400 | .items = { |
| 13401 | { "Mic", 0x0 }, |
| 13402 | { "Front Mic", 0x1 }, |
| 13403 | { "Line", 0x2 }, |
| 13404 | { "CD", 0x3 }, |
| 13405 | }, |
| 13406 | }; |
| 13407 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13408 | static const struct hda_input_mux alc268_acer_capture_source = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13409 | .num_items = 3, |
| 13410 | .items = { |
| 13411 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13412 | { "Internal Mic", 0x1 }, |
| 13413 | { "Line", 0x2 }, |
| 13414 | }, |
| 13415 | }; |
| 13416 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13417 | static const struct hda_input_mux alc268_acer_dmic_capture_source = { |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13418 | .num_items = 3, |
| 13419 | .items = { |
| 13420 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13421 | { "Internal Mic", 0x6 }, |
| 13422 | { "Line", 0x2 }, |
| 13423 | }, |
| 13424 | }; |
| 13425 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13426 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13427 | static const struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13428 | /* Volume widgets */ |
| 13429 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13430 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13431 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13432 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13433 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13434 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13435 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13436 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13437 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13438 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13439 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13440 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13441 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13442 | /* The below appears problematic on some hardwares */ |
| 13443 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13444 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13445 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13446 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13447 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13448 | |
| 13449 | /* Modes for retasking pin widgets */ |
| 13450 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13451 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13452 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13453 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13454 | |
| 13455 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13456 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13457 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13458 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13459 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13460 | |
| 13461 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13462 | * The ALC268 does not have an SPDIF input. |
| 13463 | */ |
| 13464 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13465 | |
| 13466 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13467 | * this output to turn on an external amplifier. |
| 13468 | */ |
| 13469 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13470 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13471 | |
| 13472 | { } /* end */ |
| 13473 | }; |
| 13474 | #endif |
| 13475 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13476 | /* create input playback/capture controls for the given pin */ |
| 13477 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13478 | const char *ctlname, int idx) |
| 13479 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13480 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13481 | int err; |
| 13482 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13483 | switch (nid) { |
| 13484 | case 0x14: |
| 13485 | case 0x16: |
| 13486 | dac = 0x02; |
| 13487 | break; |
| 13488 | case 0x15: |
Takashi Iwai | b08b163 | 2010-07-30 14:08:25 +0200 | [diff] [blame] | 13489 | case 0x1a: /* ALC259/269 only */ |
| 13490 | case 0x1b: /* ALC259/269 only */ |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13491 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13492 | dac = 0x03; |
| 13493 | break; |
| 13494 | default: |
Takashi Iwai | c7a9434 | 2010-07-30 14:10:43 +0200 | [diff] [blame] | 13495 | snd_printd(KERN_WARNING "hda_codec: " |
| 13496 | "ignoring pin 0x%x as unknown\n", nid); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13497 | return 0; |
| 13498 | } |
| 13499 | if (spec->multiout.dac_nids[0] != dac && |
| 13500 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13501 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13502 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13503 | HDA_OUTPUT)); |
| 13504 | if (err < 0) |
| 13505 | return err; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 13506 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13507 | } |
| 13508 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13509 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13510 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13511 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13512 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13513 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13514 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13515 | if (err < 0) |
| 13516 | return err; |
| 13517 | return 0; |
| 13518 | } |
| 13519 | |
| 13520 | /* add playback controls from the parsed DAC table */ |
| 13521 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13522 | const struct auto_pin_cfg *cfg) |
| 13523 | { |
| 13524 | hda_nid_t nid; |
| 13525 | int err; |
| 13526 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13527 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13528 | |
| 13529 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13530 | if (nid) { |
| 13531 | const char *name; |
Takashi Iwai | 2e925dd | 2011-06-24 11:27:22 +0200 | [diff] [blame] | 13532 | int index; |
| 13533 | name = alc_get_line_out_pfx(spec, 0, true, &index); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13534 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13535 | if (err < 0) |
| 13536 | return err; |
| 13537 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13538 | |
| 13539 | nid = cfg->speaker_pins[0]; |
| 13540 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13541 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13542 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13543 | if (err < 0) |
| 13544 | return err; |
David Henningsson | 7bfb9c0 | 2010-08-02 13:13:25 +0200 | [diff] [blame] | 13545 | } else if (nid) { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13546 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13547 | if (err < 0) |
| 13548 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13549 | } |
| 13550 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13551 | if (nid) { |
| 13552 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13553 | if (err < 0) |
| 13554 | return err; |
| 13555 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13556 | |
| 13557 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13558 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13559 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13560 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13561 | if (err < 0) |
| 13562 | return err; |
| 13563 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13564 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13565 | } |
| 13566 | |
| 13567 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13568 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13569 | const struct auto_pin_cfg *cfg) |
| 13570 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13571 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13572 | } |
| 13573 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13574 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13575 | hda_nid_t nid, int pin_type) |
| 13576 | { |
| 13577 | int idx; |
| 13578 | |
| 13579 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 13580 | if (snd_hda_get_conn_list(codec, nid, NULL) <= 1) |
| 13581 | return; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13582 | if (nid == 0x14 || nid == 0x16) |
| 13583 | idx = 0; |
| 13584 | else |
| 13585 | idx = 1; |
| 13586 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13587 | } |
| 13588 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13589 | static void alc268_auto_init_dac(struct hda_codec *codec, hda_nid_t nid) |
| 13590 | { |
| 13591 | if (!nid) |
| 13592 | return; |
| 13593 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 7ec9c6c | 2011-06-27 15:53:38 +0200 | [diff] [blame] | 13594 | AMP_OUT_ZERO); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13595 | } |
| 13596 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13597 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13598 | { |
| 13599 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13600 | int i; |
| 13601 | |
| 13602 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 13603 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13604 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13605 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13606 | } |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13607 | /* mute DACs */ |
| 13608 | for (i = 0; i < spec->multiout.num_dacs; i++) |
| 13609 | alc268_auto_init_dac(codec, spec->multiout.dac_nids[i]); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13610 | } |
| 13611 | |
| 13612 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13613 | { |
| 13614 | struct alc_spec *spec = codec->spec; |
| 13615 | hda_nid_t pin; |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13616 | int i; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13617 | |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13618 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 13619 | pin = spec->autocfg.hp_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13620 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13621 | } |
| 13622 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 13623 | pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13624 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
Takashi Iwai | e1ca7b4 | 2010-09-20 14:58:57 +0200 | [diff] [blame] | 13625 | } |
| 13626 | if (spec->autocfg.mono_out_pin) |
| 13627 | snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0, |
| 13628 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13629 | /* mute DACs */ |
| 13630 | alc268_auto_init_dac(codec, spec->multiout.hp_nid); |
| 13631 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) |
| 13632 | alc268_auto_init_dac(codec, spec->multiout.extra_out_nid[i]); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13633 | } |
| 13634 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13635 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13636 | { |
| 13637 | struct alc_spec *spec = codec->spec; |
| 13638 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13639 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13640 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13641 | unsigned int dac_vol1, dac_vol2; |
| 13642 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13643 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13644 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13645 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13646 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13647 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13648 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13649 | AMP_IN_UNMUTE(1)); |
| 13650 | snd_hda_codec_write(codec, 0x10, 0, |
| 13651 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13652 | AMP_IN_UNMUTE(1)); |
| 13653 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13654 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13655 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13656 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13657 | snd_hda_codec_write(codec, 0x10, 0, |
| 13658 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13659 | } |
| 13660 | |
| 13661 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13662 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13663 | dac_vol2 = AMP_OUT_ZERO; |
| 13664 | else if (line_nid == 0x15) |
| 13665 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13666 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13667 | dac_vol2 = AMP_OUT_ZERO; |
| 13668 | else if (hp_nid == 0x15) |
| 13669 | dac_vol1 = AMP_OUT_ZERO; |
| 13670 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13671 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13672 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13673 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13674 | |
| 13675 | snd_hda_codec_write(codec, 0x02, 0, |
| 13676 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13677 | snd_hda_codec_write(codec, 0x03, 0, |
| 13678 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13679 | } |
| 13680 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13681 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13682 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13683 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13684 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13685 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13686 | |
| 13687 | /* |
| 13688 | * BIOS auto configuration |
| 13689 | */ |
| 13690 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13691 | { |
| 13692 | struct alc_spec *spec = codec->spec; |
| 13693 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13694 | static const hda_nid_t alc268_ignore[] = { 0 }; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13695 | |
| 13696 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13697 | alc268_ignore); |
| 13698 | if (err < 0) |
| 13699 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13700 | if (!spec->autocfg.line_outs) { |
| 13701 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13702 | spec->multiout.max_channels = 2; |
| 13703 | spec->no_analog = 1; |
| 13704 | goto dig_only; |
| 13705 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13706 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13707 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13708 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13709 | if (err < 0) |
| 13710 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13711 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13712 | if (err < 0) |
| 13713 | return err; |
| 13714 | |
| 13715 | spec->multiout.max_channels = 2; |
| 13716 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13717 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13718 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13719 | alc_auto_parse_digital(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13720 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13721 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13722 | |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 13723 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) { |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13724 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | 4f574b7 | 2011-06-27 16:17:07 +0200 | [diff] [blame] | 13725 | add_verb(spec, alc268_beep_init_verbs); |
| 13726 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13727 | |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13728 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13729 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13730 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13731 | err = alc_auto_add_mic_boost(codec); |
| 13732 | if (err < 0) |
| 13733 | return err; |
| 13734 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13735 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13736 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13737 | return 1; |
| 13738 | } |
| 13739 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13740 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13741 | #define alc268_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13742 | |
| 13743 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13744 | static void alc268_auto_init(struct hda_codec *codec) |
| 13745 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13746 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13747 | alc268_auto_init_multi_out(codec); |
| 13748 | alc268_auto_init_hp_out(codec); |
| 13749 | alc268_auto_init_mono_speaker_out(codec); |
| 13750 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 13751 | alc268_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 13752 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13753 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13754 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13755 | } |
| 13756 | |
| 13757 | /* |
| 13758 | * configuration and preset |
| 13759 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 13760 | static const char * const alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13761 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13762 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13763 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13764 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13765 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13766 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13767 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13768 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13769 | #ifdef CONFIG_SND_DEBUG |
| 13770 | [ALC268_TEST] = "test", |
| 13771 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13772 | [ALC268_AUTO] = "auto", |
| 13773 | }; |
| 13774 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13775 | static const struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13776 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13777 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13778 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13779 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13780 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13781 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13782 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13783 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | 0a1896b | 2011-06-06 18:55:34 -0400 | [diff] [blame] | 13784 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron 910", ALC268_AUTO), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13785 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13786 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13787 | /* almost compatible with toshiba but with optional digital outs; |
| 13788 | * auto-probing seems working fine |
| 13789 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13790 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13791 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13792 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13793 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13794 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13795 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13796 | {} |
| 13797 | }; |
| 13798 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13799 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13800 | static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13801 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13802 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13803 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13804 | ALC268_TOSHIBA), |
| 13805 | {} |
| 13806 | }; |
| 13807 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 13808 | static const struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13809 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13810 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13811 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13812 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13813 | alc267_quanta_il1_verbs }, |
| 13814 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13815 | .dac_nids = alc268_dac_nids, |
| 13816 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13817 | .adc_nids = alc268_adc_nids_alt, |
| 13818 | .hp_nid = 0x03, |
| 13819 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13820 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13821 | .unsol_event = alc_sku_unsol_event, |
| 13822 | .setup = alc267_quanta_il1_setup, |
| 13823 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13824 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13825 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13826 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13827 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13828 | .init_verbs = { alc268_base_init_verbs }, |
| 13829 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13830 | .dac_nids = alc268_dac_nids, |
| 13831 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13832 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13833 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13834 | .hp_nid = 0x03, |
| 13835 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13836 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13837 | .channel_mode = alc268_modes, |
| 13838 | .input_mux = &alc268_capture_source, |
| 13839 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13840 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13841 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13842 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13843 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13844 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13845 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13846 | .dac_nids = alc268_dac_nids, |
| 13847 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13848 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13849 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13850 | .hp_nid = 0x03, |
| 13851 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13852 | .channel_mode = alc268_modes, |
| 13853 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13854 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13855 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13856 | .init_hook = alc_inithook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13857 | }, |
| 13858 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13859 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13860 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13861 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13862 | alc268_acer_verbs }, |
| 13863 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13864 | .dac_nids = alc268_dac_nids, |
| 13865 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13866 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13867 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13868 | .hp_nid = 0x02, |
| 13869 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13870 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13871 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13872 | .unsol_event = alc_sku_unsol_event, |
| 13873 | .setup = alc268_acer_setup, |
| 13874 | .init_hook = alc_inithook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13875 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13876 | [ALC268_ACER_DMIC] = { |
| 13877 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13878 | alc268_beep_mixer }, |
| 13879 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13880 | alc268_acer_verbs }, |
| 13881 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13882 | .dac_nids = alc268_dac_nids, |
| 13883 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13884 | .adc_nids = alc268_adc_nids_alt, |
| 13885 | .capsrc_nids = alc268_capsrc_nids, |
| 13886 | .hp_nid = 0x02, |
| 13887 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13888 | .channel_mode = alc268_modes, |
| 13889 | .input_mux = &alc268_acer_dmic_capture_source, |
Takashi Iwai | 0f0f391 | 2011-04-28 16:26:24 +0200 | [diff] [blame] | 13890 | .unsol_event = alc_sku_unsol_event, |
| 13891 | .setup = alc268_acer_setup, |
| 13892 | .init_hook = alc_inithook, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13893 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13894 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13895 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13896 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13897 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13898 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13899 | alc268_acer_aspire_one_verbs }, |
| 13900 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13901 | .dac_nids = alc268_dac_nids, |
| 13902 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13903 | .adc_nids = alc268_adc_nids_alt, |
| 13904 | .capsrc_nids = alc268_capsrc_nids, |
| 13905 | .hp_nid = 0x03, |
| 13906 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13907 | .channel_mode = alc268_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13908 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13909 | .setup = alc268_acer_lc_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 13910 | .init_hook = alc_inithook, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13911 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13912 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13913 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13914 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13915 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13916 | alc268_dell_verbs }, |
| 13917 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13918 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13919 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13920 | .adc_nids = alc268_adc_nids_alt, |
| 13921 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13922 | .hp_nid = 0x02, |
| 13923 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13924 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13925 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13926 | .setup = alc268_dell_setup, |
| 13927 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13928 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13929 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13930 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13931 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13932 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13933 | alc268_toshiba_verbs }, |
| 13934 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13935 | .dac_nids = alc268_dac_nids, |
| 13936 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13937 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13938 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13939 | .hp_nid = 0x03, |
| 13940 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13941 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13942 | .channel_mode = alc268_modes, |
| 13943 | .input_mux = &alc268_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13944 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13945 | .setup = alc268_toshiba_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 13946 | .init_hook = alc_inithook, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13947 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13948 | #ifdef CONFIG_SND_DEBUG |
| 13949 | [ALC268_TEST] = { |
| 13950 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13951 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13952 | alc268_volume_init_verbs, |
| 13953 | alc268_beep_init_verbs }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13954 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13955 | .dac_nids = alc268_dac_nids, |
| 13956 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13957 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13958 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13959 | .hp_nid = 0x03, |
| 13960 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13961 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13962 | .channel_mode = alc268_modes, |
| 13963 | .input_mux = &alc268_capture_source, |
| 13964 | }, |
| 13965 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13966 | }; |
| 13967 | |
| 13968 | static int patch_alc268(struct hda_codec *codec) |
| 13969 | { |
| 13970 | struct alc_spec *spec; |
| 13971 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13972 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13973 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13974 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13975 | if (spec == NULL) |
| 13976 | return -ENOMEM; |
| 13977 | |
| 13978 | codec->spec = spec; |
| 13979 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 13980 | /* ALC268 has no aa-loopback mixer */ |
| 13981 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13982 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13983 | alc268_models, |
| 13984 | alc268_cfg_tbl); |
| 13985 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13986 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13987 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13988 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13989 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13990 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13991 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13992 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13993 | board_config = ALC268_AUTO; |
| 13994 | } |
| 13995 | |
| 13996 | if (board_config == ALC268_AUTO) { |
| 13997 | /* automatic parse from the BIOS config */ |
| 13998 | err = alc268_parse_auto_config(codec); |
| 13999 | if (err < 0) { |
| 14000 | alc_free(codec); |
| 14001 | return err; |
| 14002 | } else if (!err) { |
| 14003 | printk(KERN_INFO |
| 14004 | "hda_codec: Cannot set up configuration " |
| 14005 | "from BIOS. Using base mode...\n"); |
| 14006 | board_config = ALC268_3ST; |
| 14007 | } |
| 14008 | } |
| 14009 | |
| 14010 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14011 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14012 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14013 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 14014 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 14015 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14016 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14017 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 14018 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14019 | has_beep = 0; |
| 14020 | for (i = 0; i < spec->num_mixers; i++) { |
| 14021 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 14022 | has_beep = 1; |
| 14023 | break; |
| 14024 | } |
| 14025 | } |
| 14026 | |
| 14027 | if (has_beep) { |
| 14028 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14029 | if (err < 0) { |
| 14030 | alc_free(codec); |
| 14031 | return err; |
| 14032 | } |
| 14033 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 14034 | /* override the amp caps for beep generator */ |
| 14035 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14036 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 14037 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 14038 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 14039 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 14040 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 14041 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14042 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14043 | /* check whether NID 0x07 is valid */ |
| 14044 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14045 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14046 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14047 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14048 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14049 | if (spec->auto_mic || |
| 14050 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14051 | spec->adc_nids = alc268_adc_nids_alt; |
| 14052 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 14053 | if (spec->auto_mic) |
| 14054 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 14055 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 14056 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 14057 | else |
| 14058 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 14059 | } else { |
| 14060 | spec->adc_nids = alc268_adc_nids; |
| 14061 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14062 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14063 | } |
| 14064 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14065 | |
| 14066 | spec->vmaster_nid = 0x02; |
| 14067 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14068 | codec->patch_ops = alc_patch_ops; |
| 14069 | if (board_config == ALC268_AUTO) |
| 14070 | spec->init_hook = alc268_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 14071 | spec->shutup = alc_eapd_shutup; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14072 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 14073 | alc_init_jacks(codec); |
| 14074 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14075 | return 0; |
| 14076 | } |
| 14077 | |
| 14078 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14079 | * ALC269 channel source setting (2 channel) |
| 14080 | */ |
| 14081 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 14082 | |
| 14083 | #define alc269_dac_nids alc260_dac_nids |
| 14084 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14085 | static const hda_nid_t alc269_adc_nids[1] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14086 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14087 | 0x08, |
| 14088 | }; |
| 14089 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14090 | static const hda_nid_t alc269_capsrc_nids[1] = { |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14091 | 0x23, |
| 14092 | }; |
| 14093 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14094 | static const hda_nid_t alc269vb_adc_nids[1] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14095 | /* ADC1 */ |
| 14096 | 0x09, |
| 14097 | }; |
| 14098 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14099 | static const hda_nid_t alc269vb_capsrc_nids[1] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14100 | 0x22, |
| 14101 | }; |
| 14102 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14103 | static const hda_nid_t alc269_adc_candidates[] = { |
David Henningsson | 262ac22 | 2011-04-07 11:43:00 +0200 | [diff] [blame] | 14104 | 0x08, 0x09, 0x07, 0x11, |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14105 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14106 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14107 | #define alc269_modes alc260_modes |
| 14108 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 14109 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14110 | static const struct snd_kcontrol_new alc269_base_mixer[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14111 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14112 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14113 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14114 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14117 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14118 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14119 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14120 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14121 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14122 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 14123 | { } /* end */ |
| 14124 | }; |
| 14125 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14126 | static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14127 | /* output mixer control */ |
| 14128 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14129 | { |
| 14130 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14131 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14132 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14133 | .info = snd_hda_mixer_amp_switch_info, |
| 14134 | .get = snd_hda_mixer_amp_switch_get, |
| 14135 | .put = alc268_acer_master_sw_put, |
| 14136 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14137 | }, |
| 14138 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14139 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14140 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14141 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14142 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14143 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14144 | { } |
| 14145 | }; |
| 14146 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14147 | static const struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14148 | /* output mixer control */ |
| 14149 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 14150 | { |
| 14151 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14152 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 14153 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14154 | .info = snd_hda_mixer_amp_switch_info, |
| 14155 | .get = snd_hda_mixer_amp_switch_get, |
| 14156 | .put = alc268_acer_master_sw_put, |
| 14157 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 14158 | }, |
| 14159 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14160 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14161 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14162 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 14163 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14164 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14165 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 14166 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14167 | HDA_CODEC_VOLUME("Dock Mic Boost Volume", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14168 | { } |
| 14169 | }; |
| 14170 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14171 | static const struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14172 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14173 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 14174 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 14175 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14176 | { } /* end */ |
| 14177 | }; |
| 14178 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14179 | static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14180 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14181 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14182 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 14183 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14184 | { } /* end */ |
| 14185 | }; |
| 14186 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14187 | static const struct snd_kcontrol_new alc269_asus_mixer[] = { |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14188 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14189 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), |
| 14190 | { } /* end */ |
| 14191 | }; |
| 14192 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14193 | /* capture mixer elements */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14194 | static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14195 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14196 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14197 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14198 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14199 | { } /* end */ |
| 14200 | }; |
| 14201 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14202 | static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14203 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 14204 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14205 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14206 | { } /* end */ |
| 14207 | }; |
| 14208 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14209 | static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14210 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14211 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14212 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 14213 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14214 | { } /* end */ |
| 14215 | }; |
| 14216 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14217 | static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14218 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 14219 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 14220 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14221 | { } /* end */ |
| 14222 | }; |
| 14223 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14224 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14225 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14226 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14227 | static const struct hda_verb alc269_quanta_fl1_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14228 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14229 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14230 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14232 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14233 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14234 | { } |
| 14235 | }; |
| 14236 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14237 | static const struct hda_verb alc269_lifebook_verbs[] = { |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14239 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14240 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14241 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14242 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14243 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14244 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14245 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 14246 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14247 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14248 | { } |
| 14249 | }; |
| 14250 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14251 | /* toggle speaker-output according to the hp-jack state */ |
| 14252 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 14253 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14254 | alc_hp_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14255 | |
| 14256 | snd_hda_codec_write(codec, 0x20, 0, |
| 14257 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14258 | snd_hda_codec_write(codec, 0x20, 0, |
| 14259 | AC_VERB_SET_PROC_COEF, 0x680); |
| 14260 | |
| 14261 | snd_hda_codec_write(codec, 0x20, 0, |
| 14262 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 14263 | snd_hda_codec_write(codec, 0x20, 0, |
| 14264 | AC_VERB_SET_PROC_COEF, 0x480); |
| 14265 | } |
| 14266 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14267 | #define alc269_lifebook_speaker_automute \ |
| 14268 | alc269_quanta_fl1_speaker_automute |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14269 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14270 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 14271 | { |
| 14272 | unsigned int present_laptop; |
| 14273 | unsigned int present_dock; |
| 14274 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14275 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 14276 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14277 | |
| 14278 | /* Laptop mic port overrides dock mic port, design decision */ |
| 14279 | if (present_dock) |
| 14280 | snd_hda_codec_write(codec, 0x23, 0, |
| 14281 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 14282 | if (present_laptop) |
| 14283 | snd_hda_codec_write(codec, 0x23, 0, |
| 14284 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 14285 | if (!present_dock && !present_laptop) |
| 14286 | snd_hda_codec_write(codec, 0x23, 0, |
| 14287 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 14288 | } |
| 14289 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14290 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 14291 | unsigned int res) |
| 14292 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14293 | switch (res >> 26) { |
| 14294 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14295 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14296 | break; |
| 14297 | case ALC880_MIC_EVENT: |
| 14298 | alc_mic_automute(codec); |
| 14299 | break; |
| 14300 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14301 | } |
| 14302 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14303 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 14304 | unsigned int res) |
| 14305 | { |
| 14306 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14307 | alc269_lifebook_speaker_automute(codec); |
| 14308 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 14309 | alc269_lifebook_mic_autoswitch(codec); |
| 14310 | } |
| 14311 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14312 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 14313 | { |
| 14314 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14315 | spec->autocfg.hp_pins[0] = 0x15; |
| 14316 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14317 | spec->automute_mixer_nid[0] = 0x0c; |
| 14318 | spec->automute = 1; |
| 14319 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14320 | spec->ext_mic.pin = 0x18; |
| 14321 | spec->ext_mic.mux_idx = 0; |
| 14322 | spec->int_mic.pin = 0x19; |
| 14323 | spec->int_mic.mux_idx = 1; |
| 14324 | spec->auto_mic = 1; |
| 14325 | } |
| 14326 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14327 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 14328 | { |
| 14329 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14330 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14331 | } |
| 14332 | |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14333 | static void alc269_lifebook_setup(struct hda_codec *codec) |
| 14334 | { |
| 14335 | struct alc_spec *spec = codec->spec; |
| 14336 | spec->autocfg.hp_pins[0] = 0x15; |
| 14337 | spec->autocfg.hp_pins[1] = 0x1a; |
| 14338 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14339 | spec->automute_mixer_nid[0] = 0x0c; |
| 14340 | spec->automute = 1; |
| 14341 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 14342 | } |
| 14343 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14344 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 14345 | { |
| 14346 | alc269_lifebook_speaker_automute(codec); |
| 14347 | alc269_lifebook_mic_autoswitch(codec); |
| 14348 | } |
| 14349 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14350 | static const struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14352 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 14353 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14354 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14355 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14356 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14357 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14358 | {} |
| 14359 | }; |
| 14360 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14361 | static const struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14362 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14363 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14364 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14365 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 14366 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14367 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14368 | {} |
| 14369 | }; |
| 14370 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14371 | static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14372 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14373 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 14374 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14376 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14377 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14378 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14379 | {} |
| 14380 | }; |
| 14381 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14382 | static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14383 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14384 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14385 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14386 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14387 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14388 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14389 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14390 | {} |
| 14391 | }; |
| 14392 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14393 | static const struct hda_verb alc271_acer_dmic_verbs[] = { |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14394 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14395 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14396 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14397 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14398 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14399 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14400 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14401 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14402 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14403 | {0x22, AC_VERB_SET_CONNECT_SEL, 6}, |
| 14404 | { } |
| 14405 | }; |
| 14406 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14407 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14408 | { |
| 14409 | struct alc_spec *spec = codec->spec; |
| 14410 | spec->autocfg.hp_pins[0] = 0x15; |
| 14411 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14412 | spec->automute_mixer_nid[0] = 0x0c; |
| 14413 | spec->automute = 1; |
| 14414 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14415 | spec->ext_mic.pin = 0x18; |
| 14416 | spec->ext_mic.mux_idx = 0; |
| 14417 | spec->int_mic.pin = 0x19; |
| 14418 | spec->int_mic.mux_idx = 1; |
| 14419 | spec->auto_mic = 1; |
| 14420 | } |
| 14421 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14422 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14423 | { |
| 14424 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14425 | spec->autocfg.hp_pins[0] = 0x15; |
| 14426 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14427 | spec->automute_mixer_nid[0] = 0x0c; |
| 14428 | spec->automute = 1; |
| 14429 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14430 | spec->ext_mic.pin = 0x18; |
| 14431 | spec->ext_mic.mux_idx = 0; |
| 14432 | spec->int_mic.pin = 0x12; |
| 14433 | spec->int_mic.mux_idx = 5; |
| 14434 | spec->auto_mic = 1; |
| 14435 | } |
| 14436 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14437 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14438 | { |
| 14439 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14440 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14441 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14442 | spec->automute_mixer_nid[0] = 0x0c; |
| 14443 | spec->automute = 1; |
| 14444 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14445 | spec->ext_mic.pin = 0x18; |
| 14446 | spec->ext_mic.mux_idx = 0; |
| 14447 | spec->int_mic.pin = 0x19; |
| 14448 | spec->int_mic.mux_idx = 1; |
| 14449 | spec->auto_mic = 1; |
| 14450 | } |
| 14451 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14452 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14453 | { |
| 14454 | struct alc_spec *spec = codec->spec; |
| 14455 | spec->autocfg.hp_pins[0] = 0x21; |
| 14456 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 14457 | spec->automute_mixer_nid[0] = 0x0c; |
| 14458 | spec->automute = 1; |
| 14459 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14460 | spec->ext_mic.pin = 0x18; |
| 14461 | spec->ext_mic.mux_idx = 0; |
| 14462 | spec->int_mic.pin = 0x12; |
| 14463 | spec->int_mic.mux_idx = 6; |
| 14464 | spec->auto_mic = 1; |
| 14465 | } |
| 14466 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14467 | /* |
| 14468 | * generic initialization of ADC, input mixers and output mixers |
| 14469 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14470 | static const struct hda_verb alc269_init_verbs[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14471 | /* |
| 14472 | * Unmute ADC0 and set the default input to mic-in |
| 14473 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14474 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14475 | |
| 14476 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14477 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14478 | */ |
| 14479 | /* set vol=0 to output mixers */ |
| 14480 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14481 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14482 | |
| 14483 | /* set up input amps for analog loopback */ |
| 14484 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14485 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14486 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14487 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14488 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14489 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14490 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14491 | |
| 14492 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14493 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14494 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14495 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14496 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14497 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14498 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14499 | |
| 14500 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14501 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14502 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14503 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14504 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14505 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14506 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14507 | |
| 14508 | /* set EAPD */ |
| 14509 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14510 | { } |
| 14511 | }; |
| 14512 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14513 | static const struct hda_verb alc269vb_init_verbs[] = { |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14514 | /* |
| 14515 | * Unmute ADC0 and set the default input to mic-in |
| 14516 | */ |
| 14517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14518 | |
| 14519 | /* |
| 14520 | * Set up output mixers (0x02 - 0x03) |
| 14521 | */ |
| 14522 | /* set vol=0 to output mixers */ |
| 14523 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14524 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14525 | |
| 14526 | /* set up input amps for analog loopback */ |
| 14527 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14529 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14530 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14531 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14532 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14533 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14534 | |
| 14535 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14536 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14537 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14538 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14539 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14540 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14541 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14542 | |
| 14543 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14544 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14545 | |
| 14546 | /* FIXME: use Mux-type input source selection */ |
| 14547 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14548 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14549 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14550 | |
| 14551 | /* set EAPD */ |
| 14552 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14553 | { } |
| 14554 | }; |
| 14555 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14556 | #define alc269_auto_create_multi_out_ctls \ |
| 14557 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14558 | #define alc269_auto_create_input_ctls \ |
| 14559 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14560 | |
| 14561 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14562 | #define alc269_loopbacks alc880_loopbacks |
| 14563 | #endif |
| 14564 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14565 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14566 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14567 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14568 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14569 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14570 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14571 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14572 | .substreams = 1, |
| 14573 | .channels_min = 2, |
| 14574 | .channels_max = 8, |
| 14575 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14576 | /* NID is set in alc_build_pcms */ |
| 14577 | .ops = { |
| 14578 | .open = alc880_playback_pcm_open, |
| 14579 | .prepare = alc880_playback_pcm_prepare, |
| 14580 | .cleanup = alc880_playback_pcm_cleanup |
| 14581 | }, |
| 14582 | }; |
| 14583 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14584 | static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14585 | .substreams = 1, |
| 14586 | .channels_min = 2, |
| 14587 | .channels_max = 2, |
| 14588 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14589 | /* NID is set in alc_build_pcms */ |
| 14590 | }; |
| 14591 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14592 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14593 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14594 | { |
| 14595 | switch (codec->subsystem_id) { |
| 14596 | case 0x103c1586: |
| 14597 | return 1; |
| 14598 | } |
| 14599 | return 0; |
| 14600 | } |
| 14601 | |
| 14602 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14603 | { |
| 14604 | /* update mute-LED according to the speaker mute state */ |
| 14605 | if (nid == 0x01 || nid == 0x14) { |
| 14606 | int pinval; |
| 14607 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14608 | HDA_AMP_MUTE) |
| 14609 | pinval = 0x24; |
| 14610 | else |
| 14611 | pinval = 0x20; |
| 14612 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14613 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14614 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14615 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14616 | } |
| 14617 | return alc_check_power_status(codec, nid); |
| 14618 | } |
| 14619 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14620 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14621 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14622 | { |
| 14623 | struct alc_spec *spec = codec->spec; |
| 14624 | |
| 14625 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14626 | return 0; |
| 14627 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14628 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14629 | if (spec->ext_mic.pin <= 0x12) { |
| 14630 | spec->private_adc_nids[0] = 0x08; |
| 14631 | spec->private_adc_nids[1] = 0x11; |
| 14632 | spec->private_capsrc_nids[0] = 0x23; |
| 14633 | spec->private_capsrc_nids[1] = 0x22; |
| 14634 | } else { |
| 14635 | spec->private_adc_nids[0] = 0x11; |
| 14636 | spec->private_adc_nids[1] = 0x08; |
| 14637 | spec->private_capsrc_nids[0] = 0x22; |
| 14638 | spec->private_capsrc_nids[1] = 0x23; |
| 14639 | } |
| 14640 | spec->adc_nids = spec->private_adc_nids; |
| 14641 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14642 | spec->num_adc_nids = 2; |
| 14643 | spec->dual_adc_switch = 1; |
| 14644 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14645 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14646 | return 1; |
| 14647 | } |
| 14648 | return 0; |
| 14649 | } |
| 14650 | |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14651 | /* different alc269-variants */ |
| 14652 | enum { |
| 14653 | ALC269_TYPE_NORMAL, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14654 | ALC269_TYPE_ALC258, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14655 | ALC269_TYPE_ALC259, |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 14656 | ALC269_TYPE_ALC269VB, |
| 14657 | ALC269_TYPE_ALC270, |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 14658 | ALC269_TYPE_ALC271X, |
| 14659 | }; |
| 14660 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14661 | /* |
| 14662 | * BIOS auto configuration |
| 14663 | */ |
| 14664 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14665 | { |
| 14666 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14667 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14668 | static const hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14669 | |
| 14670 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14671 | alc269_ignore); |
| 14672 | if (err < 0) |
| 14673 | return err; |
| 14674 | |
| 14675 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14676 | if (err < 0) |
| 14677 | return err; |
Takashi Iwai | f3550d1 | 2010-09-20 15:09:03 +0200 | [diff] [blame] | 14678 | if (spec->codec_variant == ALC269_TYPE_NORMAL) |
| 14679 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
| 14680 | else |
| 14681 | err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0, |
| 14682 | 0x22, 0); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14683 | if (err < 0) |
| 14684 | return err; |
| 14685 | |
| 14686 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14687 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14688 | alc_auto_parse_digital(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14689 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14690 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14691 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14692 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 14693 | if (spec->codec_variant != ALC269_TYPE_NORMAL) |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14694 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 14695 | else |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14696 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14697 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14698 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14699 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14700 | |
| 14701 | if (!alc275_setup_dual_adc(codec)) |
| 14702 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14703 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14704 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14705 | err = alc_auto_add_mic_boost(codec); |
| 14706 | if (err < 0) |
| 14707 | return err; |
| 14708 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14709 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14710 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14711 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14712 | return 1; |
| 14713 | } |
| 14714 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14715 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14716 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14717 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14718 | #define alc269_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14719 | |
| 14720 | |
| 14721 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14722 | static void alc269_auto_init(struct hda_codec *codec) |
| 14723 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14724 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14725 | alc269_auto_init_multi_out(codec); |
| 14726 | alc269_auto_init_hp_out(codec); |
| 14727 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | ae0ebbf | 2011-03-10 14:11:59 +0100 | [diff] [blame] | 14728 | if (!spec->dual_adc_switch) |
| 14729 | alc269_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 14730 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14731 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14732 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14733 | } |
| 14734 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14735 | static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) |
| 14736 | { |
| 14737 | int val = alc_read_coef_idx(codec, 0x04); |
| 14738 | if (power_up) |
| 14739 | val |= 1 << 11; |
| 14740 | else |
| 14741 | val &= ~(1 << 11); |
| 14742 | alc_write_coef_idx(codec, 0x04, val); |
| 14743 | } |
| 14744 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14745 | static void alc269_shutup(struct hda_codec *codec) |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14746 | { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14747 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) |
| 14748 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14749 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14750 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14751 | msleep(150); |
| 14752 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14753 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14754 | |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 14755 | #ifdef SND_HDA_NEEDS_RESUME |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14756 | static int alc269_resume(struct hda_codec *codec) |
| 14757 | { |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14758 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14759 | alc269_toggle_power_output(codec, 0); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14760 | msleep(150); |
| 14761 | } |
| 14762 | |
| 14763 | codec->patch_ops.init(codec); |
| 14764 | |
| 14765 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14766 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14767 | msleep(200); |
| 14768 | } |
| 14769 | |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14770 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) |
| 14771 | alc269_toggle_power_output(codec, 1); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14772 | |
| 14773 | snd_hda_codec_resume_amp(codec); |
| 14774 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 14775 | hda_call_check_power_status(codec, 0x01); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14776 | return 0; |
| 14777 | } |
Takashi Iwai | 0ec33d1 | 2010-09-20 15:20:52 +0200 | [diff] [blame] | 14778 | #endif /* SND_HDA_NEEDS_RESUME */ |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 14779 | |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14780 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14781 | const struct alc_fixup *fix, int action) |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14782 | { |
| 14783 | int coef; |
| 14784 | |
Takashi Iwai | 5870112 | 2011-01-13 15:41:45 +0100 | [diff] [blame] | 14785 | if (action != ALC_FIXUP_ACT_INIT) |
Takashi Iwai | 9fb1ef2 | 2011-01-13 14:40:43 +0100 | [diff] [blame] | 14786 | return; |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14787 | coef = alc_read_coef_idx(codec, 0x1e); |
| 14788 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14789 | } |
| 14790 | |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14791 | static void alc271_fixup_dmic(struct hda_codec *codec, |
| 14792 | const struct alc_fixup *fix, int action) |
| 14793 | { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14794 | static const struct hda_verb verbs[] = { |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14795 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 14796 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 14797 | {} |
| 14798 | }; |
| 14799 | unsigned int cfg; |
| 14800 | |
| 14801 | if (strcmp(codec->chip_name, "ALC271X")) |
| 14802 | return; |
| 14803 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 14804 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 14805 | snd_hda_sequence_write(codec, verbs); |
| 14806 | } |
| 14807 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14808 | enum { |
| 14809 | ALC269_FIXUP_SONY_VAIO, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14810 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14811 | ALC269_FIXUP_DELL_M101Z, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14812 | ALC269_FIXUP_SKU_IGNORE, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14813 | ALC269_FIXUP_ASUS_G73JW, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14814 | ALC269_FIXUP_LENOVO_EAPD, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14815 | ALC275_FIXUP_SONY_HWEQ, |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14816 | ALC271_FIXUP_DMIC, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14817 | }; |
| 14818 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14819 | static const struct alc_fixup alc269_fixups[] = { |
| 14820 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14821 | .type = ALC_FIXUP_VERBS, |
| 14822 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 14823 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14824 | {} |
| 14825 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14826 | }, |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14827 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14828 | .type = ALC_FIXUP_VERBS, |
| 14829 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14830 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 14831 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 14832 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 14833 | { } |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14834 | }, |
| 14835 | .chained = true, |
| 14836 | .chain_id = ALC269_FIXUP_SONY_VAIO |
Kailang Yang | 2785591 | 2010-12-21 09:09:53 +0100 | [diff] [blame] | 14837 | }, |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14838 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14839 | .type = ALC_FIXUP_VERBS, |
| 14840 | .v.verbs = (const struct hda_verb[]) { |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14841 | /* Enables internal speaker */ |
| 14842 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 14843 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 14844 | {} |
| 14845 | } |
| 14846 | }, |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14847 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14848 | .type = ALC_FIXUP_SKU, |
| 14849 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
David Henningsson | fe67b24 | 2010-12-15 08:01:46 +0100 | [diff] [blame] | 14850 | }, |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14851 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14852 | .type = ALC_FIXUP_PINS, |
| 14853 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14854 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 14855 | { } |
| 14856 | } |
| 14857 | }, |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14858 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14859 | .type = ALC_FIXUP_VERBS, |
| 14860 | .v.verbs = (const struct hda_verb[]) { |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14861 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 14862 | {} |
| 14863 | } |
| 14864 | }, |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14865 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 14866 | .type = ALC_FIXUP_FUNC, |
| 14867 | .v.func = alc269_fixup_hweq, |
| 14868 | .chained = true, |
| 14869 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14870 | }, |
| 14871 | [ALC271_FIXUP_DMIC] = { |
| 14872 | .type = ALC_FIXUP_FUNC, |
| 14873 | .v.func = alc271_fixup_dmic, |
| 14874 | }, |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14875 | }; |
| 14876 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14877 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
Takashi Iwai | 74dc890 | 2011-01-13 14:14:41 +0100 | [diff] [blame] | 14878 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
Kailang Yang | 1a99d4a | 2011-01-12 09:01:23 +0100 | [diff] [blame] | 14879 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14880 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
Takashi Iwai | 7039c74 | 2010-12-23 16:35:34 +0100 | [diff] [blame] | 14881 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
David Henningsson | 145a902 | 2010-09-16 10:07:53 +0200 | [diff] [blame] | 14882 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | 6981d18 | 2011-04-15 10:11:12 +0200 | [diff] [blame] | 14883 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
David Henningsson | 022c92b | 2010-12-17 20:43:04 +0100 | [diff] [blame] | 14884 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ded9f52 | 2011-01-26 11:46:12 +0100 | [diff] [blame] | 14885 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14886 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 14887 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 14888 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
David Henningsson | ac61240 | 2010-12-15 09:18:18 +0100 | [diff] [blame] | 14889 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
Kailang Yang | 357f915 | 2011-01-12 08:12:52 +0100 | [diff] [blame] | 14890 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14891 | {} |
| 14892 | }; |
| 14893 | |
| 14894 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14895 | /* |
| 14896 | * configuration and preset |
| 14897 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 14898 | static const char * const alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14899 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14900 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14901 | [ALC269_AMIC] = "laptop-amic", |
| 14902 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14903 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14904 | [ALC269_LIFEBOOK] = "lifebook", |
| 14905 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14906 | }; |
| 14907 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14908 | static const struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14909 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 14910 | SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14911 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14912 | ALC269_AMIC), |
| 14913 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14914 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14915 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14916 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14917 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14918 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14919 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14920 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14921 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
Chih-Wei Huang | c790ad3 | 2011-02-25 11:14:31 +0800 | [diff] [blame] | 14922 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14923 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14924 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14925 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14926 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14927 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14928 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14929 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14930 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14931 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14932 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14933 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14934 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14935 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14936 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14937 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14938 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14939 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14940 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14941 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14942 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14943 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14944 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14945 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14946 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14947 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14948 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14949 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14950 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14951 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14952 | ALC269_DMIC), |
| 14953 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14954 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14955 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14956 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14957 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14958 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14959 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14960 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14961 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14962 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14963 | {} |
| 14964 | }; |
| 14965 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 14966 | static const struct alc_config_preset alc269_presets[] = { |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14967 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14968 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14969 | .init_verbs = { alc269_init_verbs }, |
| 14970 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14971 | .dac_nids = alc269_dac_nids, |
| 14972 | .hp_nid = 0x03, |
| 14973 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14974 | .channel_mode = alc269_modes, |
| 14975 | .input_mux = &alc269_capture_source, |
| 14976 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14977 | [ALC269_QUANTA_FL1] = { |
| 14978 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14979 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14980 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14981 | .dac_nids = alc269_dac_nids, |
| 14982 | .hp_nid = 0x03, |
| 14983 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14984 | .channel_mode = alc269_modes, |
| 14985 | .input_mux = &alc269_capture_source, |
| 14986 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14987 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14988 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14989 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14990 | [ALC269_AMIC] = { |
| 14991 | .mixers = { alc269_laptop_mixer }, |
| 14992 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14993 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14994 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14995 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14996 | .dac_nids = alc269_dac_nids, |
| 14997 | .hp_nid = 0x03, |
| 14998 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14999 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15000 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15001 | .setup = alc269_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15002 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15003 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15004 | [ALC269_DMIC] = { |
| 15005 | .mixers = { alc269_laptop_mixer }, |
| 15006 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15007 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15008 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15009 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15010 | .dac_nids = alc269_dac_nids, |
| 15011 | .hp_nid = 0x03, |
| 15012 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15013 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15014 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15015 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15016 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15017 | }, |
| 15018 | [ALC269VB_AMIC] = { |
| 15019 | .mixers = { alc269vb_laptop_mixer }, |
| 15020 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 15021 | .init_verbs = { alc269vb_init_verbs, |
| 15022 | alc269vb_laptop_amic_init_verbs }, |
| 15023 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15024 | .dac_nids = alc269_dac_nids, |
| 15025 | .hp_nid = 0x03, |
| 15026 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15027 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15028 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 15029 | .setup = alc269vb_laptop_amic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15030 | .init_hook = alc_inithook, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15031 | }, |
| 15032 | [ALC269VB_DMIC] = { |
| 15033 | .mixers = { alc269vb_laptop_mixer }, |
| 15034 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15035 | .init_verbs = { alc269vb_init_verbs, |
| 15036 | alc269vb_laptop_dmic_init_verbs }, |
| 15037 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15038 | .dac_nids = alc269_dac_nids, |
| 15039 | .hp_nid = 0x03, |
| 15040 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15041 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15042 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15043 | .setup = alc269vb_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15044 | .init_hook = alc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 15045 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15046 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15047 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15048 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15049 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15050 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15051 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15052 | .dac_nids = alc269_dac_nids, |
| 15053 | .hp_nid = 0x03, |
| 15054 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15055 | .channel_mode = alc269_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15056 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15057 | .setup = alc269_laptop_dmic_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15058 | .init_hook = alc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 15059 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15060 | [ALC269_LIFEBOOK] = { |
| 15061 | .mixers = { alc269_lifebook_mixer }, |
| 15062 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 15063 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15064 | .dac_nids = alc269_dac_nids, |
| 15065 | .hp_nid = 0x03, |
| 15066 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15067 | .channel_mode = alc269_modes, |
| 15068 | .input_mux = &alc269_capture_source, |
| 15069 | .unsol_event = alc269_lifebook_unsol_event, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 15070 | .setup = alc269_lifebook_setup, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 15071 | .init_hook = alc269_lifebook_init_hook, |
| 15072 | }, |
Kailang Yang | fe3eb0a | 2010-08-06 10:02:57 +0200 | [diff] [blame] | 15073 | [ALC271_ACER] = { |
| 15074 | .mixers = { alc269_asus_mixer }, |
| 15075 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 15076 | .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs }, |
| 15077 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 15078 | .dac_nids = alc269_dac_nids, |
| 15079 | .adc_nids = alc262_dmic_adc_nids, |
| 15080 | .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids), |
| 15081 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 15082 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 15083 | .channel_mode = alc269_modes, |
| 15084 | .input_mux = &alc269_capture_source, |
| 15085 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 15086 | .unsol_event = alc_sku_unsol_event, |
| 15087 | .setup = alc269vb_laptop_dmic_setup, |
| 15088 | .init_hook = alc_inithook, |
| 15089 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15090 | }; |
| 15091 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15092 | static int alc269_fill_coef(struct hda_codec *codec) |
| 15093 | { |
| 15094 | int val; |
| 15095 | |
| 15096 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) { |
| 15097 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15098 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 15099 | } |
| 15100 | |
| 15101 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) { |
| 15102 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 15103 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 15104 | } |
| 15105 | |
| 15106 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) { |
| 15107 | val = alc_read_coef_idx(codec, 0x04); |
| 15108 | /* Power up output pin */ |
| 15109 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 15110 | } |
| 15111 | |
| 15112 | if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { |
| 15113 | val = alc_read_coef_idx(codec, 0xd); |
| 15114 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 15115 | /* Capless ramp up clock control */ |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 15116 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15117 | } |
| 15118 | val = alc_read_coef_idx(codec, 0x17); |
| 15119 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 15120 | /* Class D power on reset */ |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 15121 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15122 | } |
| 15123 | } |
Kailang Yang | b896b4e | 2011-05-18 11:53:16 +0200 | [diff] [blame] | 15124 | |
| 15125 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ |
| 15126 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); |
| 15127 | |
| 15128 | val = alc_read_coef_idx(codec, 0x4); /* HP */ |
| 15129 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); |
| 15130 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15131 | return 0; |
| 15132 | } |
| 15133 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15134 | static int patch_alc269(struct hda_codec *codec) |
| 15135 | { |
| 15136 | struct alc_spec *spec; |
Kailang Yang | 48c88e8 | 2010-11-23 08:56:16 +0100 | [diff] [blame] | 15137 | int board_config, coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15138 | int err; |
| 15139 | |
| 15140 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15141 | if (spec == NULL) |
| 15142 | return -ENOMEM; |
| 15143 | |
| 15144 | codec->spec = spec; |
| 15145 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 15146 | spec->mixer_nid = 0x0b; |
| 15147 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15148 | alc_auto_parse_customize_define(codec); |
| 15149 | |
Kailang Yang | c793bec | 2010-12-21 09:14:13 +0100 | [diff] [blame] | 15150 | if (codec->vendor_id == 0x10ec0269) { |
| 15151 | coef = alc_read_coef_idx(codec, 0); |
| 15152 | if ((coef & 0x00f0) == 0x0010) { |
| 15153 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15154 | spec->cdefine.platform_type == 1) { |
| 15155 | alc_codec_rename(codec, "ALC271X"); |
| 15156 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15157 | } else if ((coef & 0xf000) == 0x1000) { |
| 15158 | spec->codec_variant = ALC269_TYPE_ALC270; |
| 15159 | } else if ((coef & 0xf000) == 0x2000) { |
| 15160 | alc_codec_rename(codec, "ALC259"); |
| 15161 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15162 | } else if ((coef & 0xf000) == 0x3000) { |
| 15163 | alc_codec_rename(codec, "ALC258"); |
| 15164 | spec->codec_variant = ALC269_TYPE_ALC258; |
| 15165 | } else { |
| 15166 | alc_codec_rename(codec, "ALC269VB"); |
| 15167 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
| 15168 | } |
| 15169 | } else |
| 15170 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 15171 | alc269_fill_coef(codec); |
| 15172 | } |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15173 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15174 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 15175 | alc269_models, |
| 15176 | alc269_cfg_tbl); |
| 15177 | |
| 15178 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15179 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15180 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15181 | board_config = ALC269_AUTO; |
| 15182 | } |
| 15183 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15184 | if (board_config == ALC269_AUTO) { |
| 15185 | alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups); |
| 15186 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 15187 | } |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15188 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15189 | if (board_config == ALC269_AUTO) { |
| 15190 | /* automatic parse from the BIOS config */ |
| 15191 | err = alc269_parse_auto_config(codec); |
| 15192 | if (err < 0) { |
| 15193 | alc_free(codec); |
| 15194 | return err; |
| 15195 | } else if (!err) { |
| 15196 | printk(KERN_INFO |
| 15197 | "hda_codec: Cannot set up configuration " |
| 15198 | "from BIOS. Using base mode...\n"); |
| 15199 | board_config = ALC269_BASIC; |
| 15200 | } |
| 15201 | } |
| 15202 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15203 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 15204 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 15205 | if (err < 0) { |
| 15206 | alc_free(codec); |
| 15207 | return err; |
| 15208 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15209 | } |
| 15210 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15211 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15212 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15213 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15214 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15215 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 15216 | * fix the sample rate of analog I/O to 44.1kHz |
| 15217 | */ |
| 15218 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 15219 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 15220 | } else if (spec->dual_adc_switch) { |
| 15221 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15222 | /* switch ADC dynamically */ |
| 15223 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 15224 | } else { |
| 15225 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 15226 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 15227 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15228 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 15229 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15230 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15231 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
Kailang Yang | 1657cbd | 2010-11-23 08:53:32 +0100 | [diff] [blame] | 15232 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 15233 | spec->adc_nids = alc269_adc_nids; |
| 15234 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15235 | spec->capsrc_nids = alc269_capsrc_nids; |
| 15236 | } else { |
| 15237 | spec->adc_nids = alc269vb_adc_nids; |
| 15238 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 15239 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 15240 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 15241 | } |
| 15242 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15243 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15244 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 15245 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 15246 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15247 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 15248 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 15249 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 15250 | spec->vmaster_nid = 0x02; |
| 15251 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15252 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 15253 | #ifdef SND_HDA_NEEDS_RESUME |
| 15254 | codec->patch_ops.resume = alc269_resume; |
| 15255 | #endif |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15256 | if (board_config == ALC269_AUTO) |
| 15257 | spec->init_hook = alc269_auto_init; |
Takashi Iwai | 5402e4c | 2011-04-07 10:39:25 +0200 | [diff] [blame] | 15258 | spec->shutup = alc269_shutup; |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 15259 | |
| 15260 | alc_init_jacks(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15261 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15262 | if (!spec->loopback.amplist) |
| 15263 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 15264 | if (alc269_mic2_for_mute_led(codec)) |
| 15265 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 15266 | #endif |
| 15267 | |
| 15268 | return 0; |
| 15269 | } |
| 15270 | |
| 15271 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15272 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 15273 | */ |
| 15274 | |
| 15275 | /* |
| 15276 | * set the path ways for 2 channel output |
| 15277 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 15278 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15279 | static const struct hda_verb alc861_threestack_ch2_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15280 | /* set pin widget 1Ah (line in) for input */ |
| 15281 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15282 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15283 | * the vref |
| 15284 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15285 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15286 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15287 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15288 | #if 0 |
| 15289 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15290 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15291 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15292 | { } /* end */ |
| 15293 | }; |
| 15294 | /* |
| 15295 | * 6ch mode |
| 15296 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 15297 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15298 | static const struct hda_verb alc861_threestack_ch6_init[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15299 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15300 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15301 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15302 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15303 | |
| 15304 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15305 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15306 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15307 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15308 | #if 0 |
| 15309 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15310 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15311 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15312 | { } /* end */ |
| 15313 | }; |
| 15314 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15315 | static const struct hda_channel_mode alc861_threestack_modes[2] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15316 | { 2, alc861_threestack_ch2_init }, |
| 15317 | { 6, alc861_threestack_ch6_init }, |
| 15318 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15319 | /* Set mic1 as input and unmute the mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15320 | static const struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15321 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15322 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15323 | { } /* end */ |
| 15324 | }; |
| 15325 | /* Set mic1 as output and mute mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15326 | static const struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15327 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15328 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15329 | { } /* end */ |
| 15330 | }; |
| 15331 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15332 | static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15333 | { 2, alc861_uniwill_m31_ch2_init }, |
| 15334 | { 4, alc861_uniwill_m31_ch4_init }, |
| 15335 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15336 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15337 | /* Set mic1 and line-in as input and unmute the mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15338 | static const struct hda_verb alc861_asus_ch2_init[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15339 | /* set pin widget 1Ah (line in) for input */ |
| 15340 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15341 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 15342 | * the vref |
| 15343 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15344 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15345 | |
| 15346 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 15347 | #if 0 |
| 15348 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 15349 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 15350 | #endif |
| 15351 | { } /* end */ |
| 15352 | }; |
| 15353 | /* Set mic1 nad line-in as output and mute mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15354 | static const struct hda_verb alc861_asus_ch6_init[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15355 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 15356 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15357 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15358 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 15359 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15360 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 15361 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15362 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15363 | |
| 15364 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 15365 | #if 0 |
| 15366 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 15367 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 15368 | #endif |
| 15369 | { } /* end */ |
| 15370 | }; |
| 15371 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15372 | static const struct hda_channel_mode alc861_asus_modes[2] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15373 | { 2, alc861_asus_ch2_init }, |
| 15374 | { 6, alc861_asus_ch6_init }, |
| 15375 | }; |
| 15376 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15377 | /* patch-ALC861 */ |
| 15378 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15379 | static const struct snd_kcontrol_new alc861_base_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15380 | /* output mixer control */ |
| 15381 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15382 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15383 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15384 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15385 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15386 | |
| 15387 | /*Input mixer control */ |
| 15388 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15389 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15390 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15391 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15392 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15393 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15394 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15395 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15396 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15397 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15398 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15399 | { } /* end */ |
| 15400 | }; |
| 15401 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15402 | static const struct snd_kcontrol_new alc861_3ST_mixer[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15403 | /* output mixer control */ |
| 15404 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15405 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15406 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15407 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15408 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15409 | |
| 15410 | /* Input mixer control */ |
| 15411 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15412 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15413 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15414 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15415 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15416 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15417 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15418 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15419 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15420 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15421 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15422 | { |
| 15423 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15424 | .name = "Channel Mode", |
| 15425 | .info = alc_ch_mode_info, |
| 15426 | .get = alc_ch_mode_get, |
| 15427 | .put = alc_ch_mode_put, |
| 15428 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 15429 | }, |
| 15430 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15431 | }; |
| 15432 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15433 | static const struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15434 | /* output mixer control */ |
| 15435 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15436 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15438 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15439 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15440 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15441 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15442 | static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15443 | /* output mixer control */ |
| 15444 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15445 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15446 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15447 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15448 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 15449 | |
| 15450 | /* Input mixer control */ |
| 15451 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15452 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 15453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15454 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15455 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15456 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15459 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 15460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15461 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15462 | { |
| 15463 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15464 | .name = "Channel Mode", |
| 15465 | .info = alc_ch_mode_info, |
| 15466 | .get = alc_ch_mode_get, |
| 15467 | .put = alc_ch_mode_put, |
| 15468 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15469 | }, |
| 15470 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15471 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15472 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15473 | static const struct snd_kcontrol_new alc861_asus_mixer[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15474 | /* output mixer control */ |
| 15475 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 15476 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 15477 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 15478 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 15479 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 15480 | |
| 15481 | /* Input mixer control */ |
| 15482 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 15483 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15484 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15485 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 15486 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 15487 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 15488 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 15489 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 15490 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15491 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 15492 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15493 | { |
| 15494 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15495 | .name = "Channel Mode", |
| 15496 | .info = alc_ch_mode_info, |
| 15497 | .get = alc_ch_mode_get, |
| 15498 | .put = alc_ch_mode_put, |
| 15499 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 15500 | }, |
| 15501 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15502 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15503 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15504 | /* additional mixer */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15505 | static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15506 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 15507 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15508 | { } |
| 15509 | }; |
| 15510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15511 | /* |
| 15512 | * generic initialization of ADC, input mixers and output mixers |
| 15513 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15514 | static const struct hda_verb alc861_base_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15515 | /* |
| 15516 | * Unmute ADC0 and set the default input to mic-in |
| 15517 | */ |
| 15518 | /* port-A for surround (rear panel) */ |
| 15519 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15520 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15521 | /* port-B for mic-in (rear panel) with vref */ |
| 15522 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15523 | /* port-C for line-in (rear panel) */ |
| 15524 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15525 | /* port-D for Front */ |
| 15526 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15527 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15528 | /* port-E for HP out (front panel) */ |
| 15529 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15530 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15531 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15532 | /* port-F for mic-in (front panel) with vref */ |
| 15533 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15534 | /* port-G for CLFE (rear panel) */ |
| 15535 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15536 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15537 | /* port-H for side (rear panel) */ |
| 15538 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15539 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15540 | /* CD-in */ |
| 15541 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15542 | /* route front mic to ADC1*/ |
| 15543 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15544 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15545 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15546 | /* Unmute DAC0~3 & spdif out*/ |
| 15547 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15548 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15549 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15550 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15552 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15553 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15554 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15555 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15556 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15557 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15558 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15559 | /* Unmute Stereo Mixer 15 */ |
| 15560 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15561 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15562 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15564 | |
| 15565 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15566 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15567 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15568 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15570 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15571 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15572 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15573 | /* hp used DAC 3 (Front) */ |
| 15574 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15575 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15576 | |
| 15577 | { } |
| 15578 | }; |
| 15579 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15580 | static const struct hda_verb alc861_threestack_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15581 | /* |
| 15582 | * Unmute ADC0 and set the default input to mic-in |
| 15583 | */ |
| 15584 | /* port-A for surround (rear panel) */ |
| 15585 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15586 | /* port-B for mic-in (rear panel) with vref */ |
| 15587 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15588 | /* port-C for line-in (rear panel) */ |
| 15589 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15590 | /* port-D for Front */ |
| 15591 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15592 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15593 | /* port-E for HP out (front panel) */ |
| 15594 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 15595 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15596 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15597 | /* port-F for mic-in (front panel) with vref */ |
| 15598 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15599 | /* port-G for CLFE (rear panel) */ |
| 15600 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15601 | /* port-H for side (rear panel) */ |
| 15602 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15603 | /* CD-in */ |
| 15604 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15605 | /* route front mic to ADC1*/ |
| 15606 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15607 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15608 | /* Unmute DAC0~3 & spdif out*/ |
| 15609 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15610 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15611 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15612 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15614 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15615 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15616 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15617 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15618 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15619 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15621 | /* Unmute Stereo Mixer 15 */ |
| 15622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15626 | |
| 15627 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15628 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15629 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15630 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15631 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15632 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15634 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15635 | /* hp used DAC 3 (Front) */ |
| 15636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15637 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15638 | { } |
| 15639 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15640 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15641 | static const struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15642 | /* |
| 15643 | * Unmute ADC0 and set the default input to mic-in |
| 15644 | */ |
| 15645 | /* port-A for surround (rear panel) */ |
| 15646 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15647 | /* port-B for mic-in (rear panel) with vref */ |
| 15648 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15649 | /* port-C for line-in (rear panel) */ |
| 15650 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15651 | /* port-D for Front */ |
| 15652 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15653 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15654 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15655 | /* this has to be set to VREF80 */ |
| 15656 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15657 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15658 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15659 | /* port-F for mic-in (front panel) with vref */ |
| 15660 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15661 | /* port-G for CLFE (rear panel) */ |
| 15662 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15663 | /* port-H for side (rear panel) */ |
| 15664 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15665 | /* CD-in */ |
| 15666 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15667 | /* route front mic to ADC1*/ |
| 15668 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15669 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15670 | /* Unmute DAC0~3 & spdif out*/ |
| 15671 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15672 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15673 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15674 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15675 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15676 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15677 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15678 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15679 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15680 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15681 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15682 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15683 | /* Unmute Stereo Mixer 15 */ |
| 15684 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15685 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15687 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15688 | |
| 15689 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15690 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15691 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15692 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15693 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15694 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15695 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15696 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15697 | /* hp used DAC 3 (Front) */ |
| 15698 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15699 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15700 | { } |
| 15701 | }; |
| 15702 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15703 | static const struct hda_verb alc861_asus_init_verbs[] = { |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15704 | /* |
| 15705 | * Unmute ADC0 and set the default input to mic-in |
| 15706 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15707 | /* port-A for surround (rear panel) |
| 15708 | * according to codec#0 this is the HP jack |
| 15709 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15710 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15711 | /* route front PCM to HP */ |
| 15712 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15713 | /* port-B for mic-in (rear panel) with vref */ |
| 15714 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15715 | /* port-C for line-in (rear panel) */ |
| 15716 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15717 | /* port-D for Front */ |
| 15718 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15719 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15720 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15721 | /* this has to be set to VREF80 */ |
| 15722 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15723 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15724 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15725 | /* port-F for mic-in (front panel) with vref */ |
| 15726 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15727 | /* port-G for CLFE (rear panel) */ |
| 15728 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15729 | /* port-H for side (rear panel) */ |
| 15730 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15731 | /* CD-in */ |
| 15732 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15733 | /* route front mic to ADC1*/ |
| 15734 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15735 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15736 | /* Unmute DAC0~3 & spdif out*/ |
| 15737 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15738 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15739 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15740 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15741 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15742 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15743 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15744 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15745 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15746 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15747 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15748 | /* Unmute Stereo Mixer 15 */ |
| 15749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15753 | |
| 15754 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15755 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15756 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15757 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15758 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15759 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15760 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15761 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15762 | /* hp used DAC 3 (Front) */ |
| 15763 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15764 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15765 | { } |
| 15766 | }; |
| 15767 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15768 | /* additional init verbs for ASUS laptops */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15769 | static const struct hda_verb alc861_asus_laptop_init_verbs[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15770 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15771 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15772 | { } |
| 15773 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15774 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15775 | static const struct hda_verb alc861_toshiba_init_verbs[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15776 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15777 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15778 | { } |
| 15779 | }; |
| 15780 | |
| 15781 | /* toggle speaker-output according to the hp-jack state */ |
| 15782 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15783 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15784 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15785 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15786 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15787 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15788 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15789 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15790 | } |
| 15791 | |
| 15792 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15793 | unsigned int res) |
| 15794 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15795 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15796 | alc861_toshiba_automute(codec); |
| 15797 | } |
| 15798 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15799 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15800 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15801 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15802 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15803 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15804 | |
| 15805 | |
| 15806 | #define ALC861_DIGOUT_NID 0x07 |
| 15807 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15808 | static const struct hda_channel_mode alc861_8ch_modes[1] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15809 | { 8, NULL } |
| 15810 | }; |
| 15811 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15812 | static const hda_nid_t alc861_dac_nids[4] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15813 | /* front, surround, clfe, side */ |
| 15814 | 0x03, 0x06, 0x05, 0x04 |
| 15815 | }; |
| 15816 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15817 | static const hda_nid_t alc660_dac_nids[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15818 | /* front, clfe, surround */ |
| 15819 | 0x03, 0x05, 0x06 |
| 15820 | }; |
| 15821 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15822 | static const hda_nid_t alc861_adc_nids[1] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15823 | /* ADC0-2 */ |
| 15824 | 0x08, |
| 15825 | }; |
| 15826 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 15827 | static const struct hda_input_mux alc861_capture_source = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15828 | .num_items = 5, |
| 15829 | .items = { |
| 15830 | { "Mic", 0x0 }, |
| 15831 | { "Front Mic", 0x3 }, |
| 15832 | { "Line", 0x1 }, |
| 15833 | { "CD", 0x4 }, |
| 15834 | { "Mixer", 0x5 }, |
| 15835 | }, |
| 15836 | }; |
| 15837 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15838 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15839 | { |
| 15840 | struct alc_spec *spec = codec->spec; |
| 15841 | hda_nid_t mix, srcs[5]; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 15842 | int i, num; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15843 | |
| 15844 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15845 | return 0; |
| 15846 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15847 | if (num < 0) |
| 15848 | return 0; |
| 15849 | for (i = 0; i < num; i++) { |
| 15850 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15851 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15852 | if (type != AC_WID_AUD_OUT) |
| 15853 | continue; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 15854 | if (!found_in_nid_list(srcs[i], spec->multiout.dac_nids, |
| 15855 | spec->multiout.num_dacs)) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15856 | return srcs[i]; |
| 15857 | } |
| 15858 | return 0; |
| 15859 | } |
| 15860 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15861 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 15862 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15863 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15864 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 15865 | const struct auto_pin_cfg *cfg = &spec->autocfg; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15866 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15867 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15868 | |
| 15869 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15870 | for (i = 0; i < cfg->line_outs; i++) { |
| 15871 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15872 | dac = alc861_look_for_dac(codec, nid); |
| 15873 | if (!dac) |
| 15874 | continue; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 15875 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15876 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15877 | return 0; |
| 15878 | } |
| 15879 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15880 | static int __alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15881 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15882 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15883 | 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] | 15884 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15885 | } |
| 15886 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 15887 | #define alc861_create_out_sw(codec, pfx, nid, chs) \ |
| 15888 | __alc861_create_out_sw(codec, pfx, nid, 0, chs) |
| 15889 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15890 | /* add playback controls from the parsed DAC table */ |
| 15891 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15892 | const struct auto_pin_cfg *cfg) |
| 15893 | { |
| 15894 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15895 | hda_nid_t nid; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15896 | int i, err, noutputs; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15897 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 15898 | noutputs = cfg->line_outs; |
| 15899 | if (spec->multi_ios > 0) |
| 15900 | noutputs += spec->multi_ios; |
| 15901 | |
| 15902 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 15903 | const char *name; |
| 15904 | int index; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15905 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15906 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15907 | continue; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 15908 | name = alc_get_line_out_pfx(spec, i, true, &index); |
| 15909 | if (!name) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15910 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15911 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15912 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15913 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15914 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15915 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15916 | return err; |
| 15917 | } else { |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 15918 | err = __alc861_create_out_sw(codec, name, nid, index, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15919 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15920 | return err; |
| 15921 | } |
| 15922 | } |
| 15923 | return 0; |
| 15924 | } |
| 15925 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15926 | 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] | 15927 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15928 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15929 | int err; |
| 15930 | hda_nid_t nid; |
| 15931 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15932 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15933 | return 0; |
| 15934 | |
| 15935 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15936 | nid = alc861_look_for_dac(codec, pin); |
| 15937 | if (nid) { |
| 15938 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15939 | if (err < 0) |
| 15940 | return err; |
| 15941 | spec->multiout.hp_nid = nid; |
| 15942 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15943 | } |
| 15944 | return 0; |
| 15945 | } |
| 15946 | |
| 15947 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15948 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15949 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15950 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15951 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15952 | } |
| 15953 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15954 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15955 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15956 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15957 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15958 | hda_nid_t mix, srcs[5]; |
| 15959 | int i, num; |
| 15960 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15961 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15962 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15963 | 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] | 15964 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15965 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15966 | return; |
| 15967 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15968 | if (num < 0) |
| 15969 | return; |
| 15970 | for (i = 0; i < num; i++) { |
| 15971 | unsigned int mute; |
| 15972 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15973 | mute = AMP_IN_UNMUTE(i); |
| 15974 | else |
| 15975 | mute = AMP_IN_MUTE(i); |
| 15976 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15977 | mute); |
| 15978 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15979 | } |
| 15980 | |
| 15981 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15982 | { |
| 15983 | struct alc_spec *spec = codec->spec; |
| 15984 | int i; |
| 15985 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 15986 | for (i = 0; i < spec->autocfg.line_outs + spec->multi_ios; i++) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15987 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15988 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15989 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15990 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15991 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15992 | } |
| 15993 | } |
| 15994 | |
| 15995 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15996 | { |
| 15997 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15998 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15999 | if (spec->autocfg.hp_outs) |
| 16000 | alc861_auto_set_output_and_unmute(codec, |
| 16001 | spec->autocfg.hp_pins[0], |
| 16002 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16003 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 16004 | if (spec->autocfg.speaker_outs) |
| 16005 | alc861_auto_set_output_and_unmute(codec, |
| 16006 | spec->autocfg.speaker_pins[0], |
| 16007 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16008 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16009 | } |
| 16010 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 16011 | #define alc861_auto_init_analog_input alc880_auto_init_analog_input |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16012 | |
| 16013 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16014 | /* return 1 if successful, 0 if the proper config is not found, |
| 16015 | * or a negative error code |
| 16016 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16017 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 16018 | { |
| 16019 | struct alc_spec *spec = codec->spec; |
| 16020 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16021 | static const hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16022 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16023 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16024 | alc861_ignore); |
| 16025 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16026 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16027 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16028 | return 0; /* can't find valid BIOS pin config */ |
| 16029 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 16030 | err = alc861_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16031 | if (err < 0) |
| 16032 | return err; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 16033 | err = alc_auto_add_multi_channel_mode(codec, alc861_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16034 | if (err < 0) |
| 16035 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16036 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16037 | if (err < 0) |
| 16038 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 16039 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16040 | if (err < 0) |
| 16041 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16042 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16043 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16044 | return err; |
| 16045 | |
| 16046 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16047 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16048 | alc_auto_parse_digital(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16049 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16050 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16051 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16052 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 16053 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16054 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16055 | |
| 16056 | spec->adc_nids = alc861_adc_nids; |
| 16057 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16058 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16059 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16060 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16061 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16062 | return 1; |
| 16063 | } |
| 16064 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16065 | /* additional initialization for auto-configuration model */ |
| 16066 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16067 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16068 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16069 | alc861_auto_init_multi_out(codec); |
| 16070 | alc861_auto_init_hp_out(codec); |
| 16071 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 16072 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16073 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16074 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16075 | } |
| 16076 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16077 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16078 | static const struct hda_amp_list alc861_loopbacks[] = { |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16079 | { 0x15, HDA_INPUT, 0 }, |
| 16080 | { 0x15, HDA_INPUT, 1 }, |
| 16081 | { 0x15, HDA_INPUT, 2 }, |
| 16082 | { 0x15, HDA_INPUT, 3 }, |
| 16083 | { } /* end */ |
| 16084 | }; |
| 16085 | #endif |
| 16086 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16087 | |
| 16088 | /* |
| 16089 | * configuration and preset |
| 16090 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16091 | static const char * const alc861_models[ALC861_MODEL_LAST] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16092 | [ALC861_3ST] = "3stack", |
| 16093 | [ALC660_3ST] = "3stack-660", |
| 16094 | [ALC861_3ST_DIG] = "3stack-dig", |
| 16095 | [ALC861_6ST_DIG] = "6stack-dig", |
| 16096 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 16097 | [ALC861_TOSHIBA] = "toshiba", |
| 16098 | [ALC861_ASUS] = "asus", |
| 16099 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 16100 | [ALC861_AUTO] = "auto", |
| 16101 | }; |
| 16102 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16103 | static const struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 16104 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16105 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16106 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 16107 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16108 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 16109 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 16110 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 16111 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 16112 | * Any other models that need this preset? |
| 16113 | */ |
| 16114 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 16115 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 16116 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16117 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 16118 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 16119 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 16120 | /* FIXME: the below seems conflict */ |
| 16121 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 16122 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 16123 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16124 | {} |
| 16125 | }; |
| 16126 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16127 | static const struct alc_config_preset alc861_presets[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16128 | [ALC861_3ST] = { |
| 16129 | .mixers = { alc861_3ST_mixer }, |
| 16130 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16131 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16132 | .dac_nids = alc861_dac_nids, |
| 16133 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16134 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16135 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16136 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16137 | .adc_nids = alc861_adc_nids, |
| 16138 | .input_mux = &alc861_capture_source, |
| 16139 | }, |
| 16140 | [ALC861_3ST_DIG] = { |
| 16141 | .mixers = { alc861_base_mixer }, |
| 16142 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16143 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16144 | .dac_nids = alc861_dac_nids, |
| 16145 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16146 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16147 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16148 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16149 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16150 | .adc_nids = alc861_adc_nids, |
| 16151 | .input_mux = &alc861_capture_source, |
| 16152 | }, |
| 16153 | [ALC861_6ST_DIG] = { |
| 16154 | .mixers = { alc861_base_mixer }, |
| 16155 | .init_verbs = { alc861_base_init_verbs }, |
| 16156 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16157 | .dac_nids = alc861_dac_nids, |
| 16158 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16159 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 16160 | .channel_mode = alc861_8ch_modes, |
| 16161 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16162 | .adc_nids = alc861_adc_nids, |
| 16163 | .input_mux = &alc861_capture_source, |
| 16164 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16165 | [ALC660_3ST] = { |
| 16166 | .mixers = { alc861_3ST_mixer }, |
| 16167 | .init_verbs = { alc861_threestack_init_verbs }, |
| 16168 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 16169 | .dac_nids = alc660_dac_nids, |
| 16170 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 16171 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 16172 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16173 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16174 | .adc_nids = alc861_adc_nids, |
| 16175 | .input_mux = &alc861_capture_source, |
| 16176 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 16177 | [ALC861_UNIWILL_M31] = { |
| 16178 | .mixers = { alc861_uniwill_m31_mixer }, |
| 16179 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 16180 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16181 | .dac_nids = alc861_dac_nids, |
| 16182 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16183 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 16184 | .channel_mode = alc861_uniwill_m31_modes, |
| 16185 | .need_dac_fix = 1, |
| 16186 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16187 | .adc_nids = alc861_adc_nids, |
| 16188 | .input_mux = &alc861_capture_source, |
| 16189 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16190 | [ALC861_TOSHIBA] = { |
| 16191 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16192 | .init_verbs = { alc861_base_init_verbs, |
| 16193 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 16194 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16195 | .dac_nids = alc861_dac_nids, |
| 16196 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16197 | .channel_mode = alc883_3ST_2ch_modes, |
| 16198 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16199 | .adc_nids = alc861_adc_nids, |
| 16200 | .input_mux = &alc861_capture_source, |
| 16201 | .unsol_event = alc861_toshiba_unsol_event, |
| 16202 | .init_hook = alc861_toshiba_automute, |
| 16203 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 16204 | [ALC861_ASUS] = { |
| 16205 | .mixers = { alc861_asus_mixer }, |
| 16206 | .init_verbs = { alc861_asus_init_verbs }, |
| 16207 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16208 | .dac_nids = alc861_dac_nids, |
| 16209 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16210 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 16211 | .channel_mode = alc861_asus_modes, |
| 16212 | .need_dac_fix = 1, |
| 16213 | .hp_nid = 0x06, |
| 16214 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16215 | .adc_nids = alc861_adc_nids, |
| 16216 | .input_mux = &alc861_capture_source, |
| 16217 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 16218 | [ALC861_ASUS_LAPTOP] = { |
| 16219 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 16220 | .init_verbs = { alc861_asus_init_verbs, |
| 16221 | alc861_asus_laptop_init_verbs }, |
| 16222 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 16223 | .dac_nids = alc861_dac_nids, |
| 16224 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 16225 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 16226 | .channel_mode = alc883_3ST_2ch_modes, |
| 16227 | .need_dac_fix = 1, |
| 16228 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 16229 | .adc_nids = alc861_adc_nids, |
| 16230 | .input_mux = &alc861_capture_source, |
| 16231 | }, |
| 16232 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16233 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16234 | /* Pin config fixes */ |
| 16235 | enum { |
| 16236 | PINFIX_FSC_AMILO_PI1505, |
| 16237 | }; |
| 16238 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16239 | static const struct alc_fixup alc861_fixups[] = { |
| 16240 | [PINFIX_FSC_AMILO_PI1505] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16241 | .type = ALC_FIXUP_PINS, |
| 16242 | .v.pins = (const struct alc_pincfg[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 16243 | { 0x0b, 0x0221101f }, /* HP */ |
| 16244 | { 0x0f, 0x90170310 }, /* speaker */ |
| 16245 | { } |
| 16246 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16247 | }, |
| 16248 | }; |
| 16249 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16250 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16251 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 16252 | {} |
| 16253 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16254 | |
| 16255 | static int patch_alc861(struct hda_codec *codec) |
| 16256 | { |
| 16257 | struct alc_spec *spec; |
| 16258 | int board_config; |
| 16259 | int err; |
| 16260 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 16261 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16262 | if (spec == NULL) |
| 16263 | return -ENOMEM; |
| 16264 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16265 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16266 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 16267 | spec->mixer_nid = 0x15; |
| 16268 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16269 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 16270 | alc861_models, |
| 16271 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16272 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 16273 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16274 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16275 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16276 | board_config = ALC861_AUTO; |
| 16277 | } |
| 16278 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16279 | if (board_config == ALC861_AUTO) { |
| 16280 | alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 16281 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 16282 | } |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 16283 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16284 | if (board_config == ALC861_AUTO) { |
| 16285 | /* automatic parse from the BIOS config */ |
| 16286 | err = alc861_parse_auto_config(codec); |
| 16287 | if (err < 0) { |
| 16288 | alc_free(codec); |
| 16289 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16290 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 16291 | printk(KERN_INFO |
| 16292 | "hda_codec: Cannot set up configuration " |
| 16293 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16294 | board_config = ALC861_3ST_DIG; |
| 16295 | } |
| 16296 | } |
| 16297 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16298 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16299 | if (err < 0) { |
| 16300 | alc_free(codec); |
| 16301 | return err; |
| 16302 | } |
| 16303 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16304 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16305 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16307 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 16308 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 16309 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16310 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 16311 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 16312 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 16313 | if (!spec->cap_mixer) |
| 16314 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16315 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 16316 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16317 | spec->vmaster_nid = 0x03; |
| 16318 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 16319 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16320 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16321 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16322 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 16323 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16324 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 16325 | spec->power_hook = alc_power_eapd; |
| 16326 | #endif |
| 16327 | } |
| 16328 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16329 | if (!spec->loopback.amplist) |
| 16330 | spec->loopback.amplist = alc861_loopbacks; |
| 16331 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16332 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 16333 | return 0; |
| 16334 | } |
| 16335 | |
| 16336 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16337 | * ALC861-VD support |
| 16338 | * |
| 16339 | * Based on ALC882 |
| 16340 | * |
| 16341 | * In addition, an independent DAC |
| 16342 | */ |
| 16343 | #define ALC861VD_DIGOUT_NID 0x06 |
| 16344 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16345 | static const hda_nid_t alc861vd_dac_nids[4] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16346 | /* front, surr, clfe, side surr */ |
| 16347 | 0x02, 0x03, 0x04, 0x05 |
| 16348 | }; |
| 16349 | |
| 16350 | /* dac_nids for ALC660vd are in a different order - according to |
| 16351 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16352 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16353 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 16354 | * - and it is the same as in 861vd. |
| 16355 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 16356 | */ |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16357 | static const hda_nid_t alc660vd_dac_nids[3] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16358 | /* front, rear, clfe, rear_surr */ |
| 16359 | 0x02, 0x04, 0x03 |
| 16360 | }; |
| 16361 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16362 | static const hda_nid_t alc861vd_adc_nids[1] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16363 | /* ADC0 */ |
| 16364 | 0x09, |
| 16365 | }; |
| 16366 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16367 | static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16368 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16369 | /* input MUX */ |
| 16370 | /* FIXME: should be a matrix-type input source selection */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16371 | static const struct hda_input_mux alc861vd_capture_source = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16372 | .num_items = 4, |
| 16373 | .items = { |
| 16374 | { "Mic", 0x0 }, |
| 16375 | { "Front Mic", 0x1 }, |
| 16376 | { "Line", 0x2 }, |
| 16377 | { "CD", 0x4 }, |
| 16378 | }, |
| 16379 | }; |
| 16380 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16381 | static const struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16382 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16383 | .items = { |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16384 | { "Mic", 0x0 }, |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16385 | { "Internal Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16386 | }, |
| 16387 | }; |
| 16388 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16389 | static const struct hda_input_mux alc861vd_hp_capture_source = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16390 | .num_items = 2, |
| 16391 | .items = { |
| 16392 | { "Front Mic", 0x0 }, |
| 16393 | { "ATAPI Mic", 0x1 }, |
| 16394 | }, |
| 16395 | }; |
| 16396 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16397 | /* |
| 16398 | * 2ch mode |
| 16399 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16400 | static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16401 | { 2, NULL } |
| 16402 | }; |
| 16403 | |
| 16404 | /* |
| 16405 | * 6ch mode |
| 16406 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16407 | static const struct hda_verb alc861vd_6stack_ch6_init[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16408 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16409 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16410 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16411 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16412 | { } /* end */ |
| 16413 | }; |
| 16414 | |
| 16415 | /* |
| 16416 | * 8ch mode |
| 16417 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16418 | static const struct hda_verb alc861vd_6stack_ch8_init[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16419 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16420 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16421 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16422 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16423 | { } /* end */ |
| 16424 | }; |
| 16425 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16426 | static const struct hda_channel_mode alc861vd_6stack_modes[2] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16427 | { 6, alc861vd_6stack_ch6_init }, |
| 16428 | { 8, alc861vd_6stack_ch8_init }, |
| 16429 | }; |
| 16430 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16431 | static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16432 | { |
| 16433 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16434 | .name = "Channel Mode", |
| 16435 | .info = alc_ch_mode_info, |
| 16436 | .get = alc_ch_mode_get, |
| 16437 | .put = alc_ch_mode_put, |
| 16438 | }, |
| 16439 | { } /* end */ |
| 16440 | }; |
| 16441 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16442 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16443 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16444 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16445 | static const struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16446 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16447 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16448 | |
| 16449 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16450 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16451 | |
| 16452 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 16453 | HDA_OUTPUT), |
| 16454 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 16455 | HDA_OUTPUT), |
| 16456 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 16457 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 16458 | |
| 16459 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 16460 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 16461 | |
| 16462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16463 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16464 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16467 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16468 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16469 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16470 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16471 | |
| 16472 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16473 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16474 | |
| 16475 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16476 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16477 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16478 | { } /* end */ |
| 16479 | }; |
| 16480 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16481 | static const struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16482 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16483 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16484 | |
| 16485 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16486 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16487 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16488 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16489 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16490 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16491 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16492 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16493 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16494 | |
| 16495 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16496 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16497 | |
| 16498 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16499 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16500 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16501 | { } /* end */ |
| 16502 | }; |
| 16503 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16504 | static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16505 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16506 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 16507 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16508 | |
| 16509 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16510 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16511 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16512 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16513 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16514 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16515 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16516 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16517 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16518 | |
| 16519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16520 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16521 | |
| 16522 | { } /* end */ |
| 16523 | }; |
| 16524 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16525 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16526 | * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16527 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16528 | static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16529 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16530 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16531 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16532 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16533 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 16534 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16535 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 16536 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 16537 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16538 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16539 | { } /* end */ |
| 16540 | }; |
| 16541 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16542 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16543 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16544 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16545 | static const struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16546 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16547 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16548 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16549 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16550 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16551 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16552 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16553 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16554 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16555 | { } /* end */ |
| 16556 | }; |
| 16557 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16558 | /* |
| 16559 | * generic initialization of ADC, input mixers and output mixers |
| 16560 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16561 | static const struct hda_verb alc861vd_volume_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16562 | /* |
| 16563 | * Unmute ADC0 and set the default input to mic-in |
| 16564 | */ |
| 16565 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16566 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16567 | |
| 16568 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16569 | * the analog-loopback mixer widget |
| 16570 | */ |
| 16571 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16574 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16575 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16576 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16577 | |
| 16578 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16583 | |
| 16584 | /* |
| 16585 | * Set up output mixers (0x02 - 0x05) |
| 16586 | */ |
| 16587 | /* set vol=0 to output mixers */ |
| 16588 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16589 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16590 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16591 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16592 | |
| 16593 | /* set up input amps for analog loopback */ |
| 16594 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16595 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16596 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16597 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16598 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16599 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16600 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16601 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16602 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16603 | |
| 16604 | { } |
| 16605 | }; |
| 16606 | |
| 16607 | /* |
| 16608 | * 3-stack pin configuration: |
| 16609 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16610 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16611 | static const struct hda_verb alc861vd_3stack_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16612 | /* |
| 16613 | * Set pin mode and muting |
| 16614 | */ |
| 16615 | /* set front pin widgets 0x14 for output */ |
| 16616 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16617 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16618 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16619 | |
| 16620 | /* Mic (rear) pin: input vref at 80% */ |
| 16621 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16622 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16623 | /* Front Mic pin: input vref at 80% */ |
| 16624 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16625 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16626 | /* Line In pin: input */ |
| 16627 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16628 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16629 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16630 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16631 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16632 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16633 | /* CD pin widget for input */ |
| 16634 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16635 | |
| 16636 | { } |
| 16637 | }; |
| 16638 | |
| 16639 | /* |
| 16640 | * 6-stack pin configuration: |
| 16641 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16642 | static const struct hda_verb alc861vd_6stack_init_verbs[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16643 | /* |
| 16644 | * Set pin mode and muting |
| 16645 | */ |
| 16646 | /* set front pin widgets 0x14 for output */ |
| 16647 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16648 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16649 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16650 | |
| 16651 | /* Rear Pin: output 1 (0x0d) */ |
| 16652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16653 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16654 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16655 | /* CLFE Pin: output 2 (0x0e) */ |
| 16656 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16657 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16658 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16659 | /* Side Pin: output 3 (0x0f) */ |
| 16660 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16661 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16662 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16663 | |
| 16664 | /* Mic (rear) pin: input vref at 80% */ |
| 16665 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16666 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16667 | /* Front Mic pin: input vref at 80% */ |
| 16668 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16669 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16670 | /* Line In pin: input */ |
| 16671 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16672 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16673 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16674 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16675 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16676 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16677 | /* CD pin widget for input */ |
| 16678 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16679 | |
| 16680 | { } |
| 16681 | }; |
| 16682 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16683 | static const struct hda_verb alc861vd_eapd_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16684 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16685 | { } |
| 16686 | }; |
| 16687 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16688 | static const struct hda_verb alc660vd_eapd_verbs[] = { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16689 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16690 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16691 | { } |
| 16692 | }; |
| 16693 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16694 | static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16695 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16697 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16698 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16699 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16700 | {} |
| 16701 | }; |
| 16702 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16703 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16704 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16705 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16706 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16707 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16708 | spec->automute = 1; |
| 16709 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16710 | } |
| 16711 | |
| 16712 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16713 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16714 | alc_hp_automute(codec); |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16715 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16716 | } |
| 16717 | |
| 16718 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16719 | unsigned int res) |
| 16720 | { |
| 16721 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16722 | case ALC880_MIC_EVENT: |
Anisse Astier | eeb4338 | 2010-12-16 12:19:47 +0100 | [diff] [blame] | 16723 | alc88x_simple_mic_automute(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16724 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16725 | default: |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16726 | alc_sku_unsol_event(codec, res); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16727 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16728 | } |
| 16729 | } |
| 16730 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16731 | static const struct hda_verb alc861vd_dallas_verbs[] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16732 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16733 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16734 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16735 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16736 | |
| 16737 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16738 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16739 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16740 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16741 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16742 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16743 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16744 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16745 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16746 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16747 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16750 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16751 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16752 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16753 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16754 | |
| 16755 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16756 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16757 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16758 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16759 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16761 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16762 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16763 | |
| 16764 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16765 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16766 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16767 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16768 | |
| 16769 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16770 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16771 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16772 | |
| 16773 | { } /* end */ |
| 16774 | }; |
| 16775 | |
| 16776 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16777 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16778 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16779 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16780 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16781 | spec->autocfg.hp_pins[0] = 0x15; |
| 16782 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16783 | spec->automute = 1; |
| 16784 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16785 | } |
| 16786 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16787 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16788 | #define alc861vd_loopbacks alc880_loopbacks |
| 16789 | #endif |
| 16790 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16791 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16792 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16793 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16794 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16795 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16796 | |
| 16797 | /* |
| 16798 | * configuration and preset |
| 16799 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 16800 | static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16801 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16802 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16803 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16804 | [ALC861VD_3ST] = "3stack", |
| 16805 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16806 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16807 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16808 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16809 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16810 | [ALC861VD_AUTO] = "auto", |
| 16811 | }; |
| 16812 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16813 | static const struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16814 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16815 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16816 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16817 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16818 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16819 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16820 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16822 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16823 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16824 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16825 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16826 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16827 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16828 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16829 | {} |
| 16830 | }; |
| 16831 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 16832 | static const struct alc_config_preset alc861vd_presets[] = { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16833 | [ALC660VD_3ST] = { |
| 16834 | .mixers = { alc861vd_3st_mixer }, |
| 16835 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16836 | alc861vd_3stack_init_verbs }, |
| 16837 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16838 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16839 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16840 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16841 | .input_mux = &alc861vd_capture_source, |
| 16842 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16843 | [ALC660VD_3ST_DIG] = { |
| 16844 | .mixers = { alc861vd_3st_mixer }, |
| 16845 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16846 | alc861vd_3stack_init_verbs }, |
| 16847 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16848 | .dac_nids = alc660vd_dac_nids, |
| 16849 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16850 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16851 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16852 | .input_mux = &alc861vd_capture_source, |
| 16853 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16854 | [ALC861VD_3ST] = { |
| 16855 | .mixers = { alc861vd_3st_mixer }, |
| 16856 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16857 | alc861vd_3stack_init_verbs }, |
| 16858 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16859 | .dac_nids = alc861vd_dac_nids, |
| 16860 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16861 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16862 | .input_mux = &alc861vd_capture_source, |
| 16863 | }, |
| 16864 | [ALC861VD_3ST_DIG] = { |
| 16865 | .mixers = { alc861vd_3st_mixer }, |
| 16866 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16867 | alc861vd_3stack_init_verbs }, |
| 16868 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16869 | .dac_nids = alc861vd_dac_nids, |
| 16870 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16871 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16872 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16873 | .input_mux = &alc861vd_capture_source, |
| 16874 | }, |
| 16875 | [ALC861VD_6ST_DIG] = { |
| 16876 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16877 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16878 | alc861vd_6stack_init_verbs }, |
| 16879 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16880 | .dac_nids = alc861vd_dac_nids, |
| 16881 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16882 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16883 | .channel_mode = alc861vd_6stack_modes, |
| 16884 | .input_mux = &alc861vd_capture_source, |
| 16885 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16886 | [ALC861VD_LENOVO] = { |
| 16887 | .mixers = { alc861vd_lenovo_mixer }, |
| 16888 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16889 | alc861vd_3stack_init_verbs, |
| 16890 | alc861vd_eapd_verbs, |
| 16891 | alc861vd_lenovo_unsol_verbs }, |
| 16892 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16893 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16894 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16895 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16896 | .input_mux = &alc861vd_capture_source, |
| 16897 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16898 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16899 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16900 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16901 | [ALC861VD_DALLAS] = { |
| 16902 | .mixers = { alc861vd_dallas_mixer }, |
| 16903 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16904 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16905 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16906 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16907 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16908 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16909 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16910 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16911 | .init_hook = alc_hp_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16912 | }, |
| 16913 | [ALC861VD_HP] = { |
| 16914 | .mixers = { alc861vd_hp_mixer }, |
| 16915 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16916 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16917 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16918 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16919 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16920 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16921 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16922 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16923 | .setup = alc861vd_dallas_setup, |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 16924 | .init_hook = alc_hp_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16925 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16926 | [ALC660VD_ASUS_V1S] = { |
| 16927 | .mixers = { alc861vd_lenovo_mixer }, |
| 16928 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16929 | alc861vd_3stack_init_verbs, |
| 16930 | alc861vd_eapd_verbs, |
| 16931 | alc861vd_lenovo_unsol_verbs }, |
| 16932 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16933 | .dac_nids = alc660vd_dac_nids, |
| 16934 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16935 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16936 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16937 | .input_mux = &alc861vd_capture_source, |
| 16938 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16939 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16940 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16941 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16942 | }; |
| 16943 | |
| 16944 | /* |
| 16945 | * BIOS auto configuration |
| 16946 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16947 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16948 | const struct auto_pin_cfg *cfg) |
| 16949 | { |
Herton Ronaldo Krzesinski | 7167594 | 2010-11-25 00:08:01 -0200 | [diff] [blame] | 16950 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16951 | } |
| 16952 | |
| 16953 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 16954 | #define alc861vd_auto_init_multi_out alc882_auto_init_multi_out |
| 16955 | #define alc861vd_auto_init_hp_out alc882_auto_init_hp_out |
| 16956 | #define alc861vd_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16957 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16958 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16959 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16960 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16961 | |
| 16962 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | 569ed34 | 2011-01-19 10:14:46 +0100 | [diff] [blame] | 16963 | /* Based on ALC880 version. But ALC861VD has separate, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16964 | * different NIDs for mute/unmute switch and volume control */ |
| 16965 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16966 | const struct auto_pin_cfg *cfg) |
| 16967 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16968 | hda_nid_t nid_v, nid_s; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16969 | int i, err, noutputs; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16970 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 16971 | noutputs = cfg->line_outs; |
| 16972 | if (spec->multi_ios > 0) |
| 16973 | noutputs += spec->multi_ios; |
| 16974 | |
| 16975 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 16976 | const char *name; |
| 16977 | int index; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16978 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16979 | continue; |
| 16980 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16981 | alc880_dac_to_idx( |
| 16982 | spec->multiout.dac_nids[i])); |
| 16983 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16984 | alc880_dac_to_idx( |
| 16985 | spec->multiout.dac_nids[i])); |
| 16986 | |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 16987 | name = alc_get_line_out_pfx(spec, i, true, &index); |
| 16988 | if (!name) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16989 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16990 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16991 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16992 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16993 | HDA_OUTPUT)); |
| 16994 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16995 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16996 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16997 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16998 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16999 | HDA_OUTPUT)); |
| 17000 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17001 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17002 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17003 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17004 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 17005 | HDA_INPUT)); |
| 17006 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17007 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17008 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 17009 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17010 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 17011 | HDA_INPUT)); |
| 17012 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17013 | return err; |
| 17014 | } else { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17015 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17016 | name, index, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17017 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 17018 | HDA_OUTPUT)); |
| 17019 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17020 | return err; |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 17021 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 17022 | name, index, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 17023 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17024 | HDA_INPUT)); |
| 17025 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17026 | return err; |
| 17027 | } |
| 17028 | } |
| 17029 | return 0; |
| 17030 | } |
| 17031 | |
| 17032 | /* add playback controls for speaker and HP outputs */ |
| 17033 | /* Based on ALC880 version. But ALC861VD has separate, |
| 17034 | * different NIDs for mute/unmute switch and volume control */ |
| 17035 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 17036 | hda_nid_t pin, const char *pfx) |
| 17037 | { |
| 17038 | hda_nid_t nid_v, nid_s; |
| 17039 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17040 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17041 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17042 | return 0; |
| 17043 | |
| 17044 | if (alc880_is_fixed_pin(pin)) { |
| 17045 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17046 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17047 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17048 | spec->multiout.hp_nid = nid_v; |
| 17049 | else |
| 17050 | spec->multiout.extra_out_nid[0] = nid_v; |
| 17051 | /* control HP volume/switch on the output mixer amp */ |
| 17052 | nid_v = alc861vd_idx_to_mixer_vol( |
| 17053 | alc880_fixed_pin_idx(pin)); |
| 17054 | nid_s = alc861vd_idx_to_mixer_switch( |
| 17055 | alc880_fixed_pin_idx(pin)); |
| 17056 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17057 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17058 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 17059 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17060 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17061 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17062 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 17063 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17064 | return err; |
| 17065 | } else if (alc880_is_multi_pin(pin)) { |
| 17066 | /* set manual connection */ |
| 17067 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17068 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17069 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17070 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17071 | return err; |
| 17072 | } |
| 17073 | return 0; |
| 17074 | } |
| 17075 | |
| 17076 | /* parse the BIOS configuration and set up the alc_spec |
| 17077 | * return 1 if successful, 0 if the proper config is not found, |
| 17078 | * or a negative error code |
| 17079 | * Based on ALC880 version - had to change it to override |
| 17080 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 17081 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 17082 | { |
| 17083 | struct alc_spec *spec = codec->spec; |
| 17084 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17085 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17086 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17087 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17088 | alc861vd_ignore); |
| 17089 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17090 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17091 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17092 | return 0; /* can't find valid BIOS pin config */ |
| 17093 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 17094 | err = alc880_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17095 | if (err < 0) |
| 17096 | return err; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 17097 | err = alc_auto_add_multi_channel_mode(codec, alc880_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 17098 | if (err < 0) |
| 17099 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17100 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17101 | if (err < 0) |
| 17102 | return err; |
| 17103 | err = alc861vd_auto_create_extra_out(spec, |
| 17104 | spec->autocfg.speaker_pins[0], |
| 17105 | "Speaker"); |
| 17106 | if (err < 0) |
| 17107 | return err; |
| 17108 | err = alc861vd_auto_create_extra_out(spec, |
| 17109 | spec->autocfg.hp_pins[0], |
| 17110 | "Headphone"); |
| 17111 | if (err < 0) |
| 17112 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17113 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17114 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17115 | return err; |
| 17116 | |
| 17117 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17118 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17119 | alc_auto_parse_digital(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17120 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17121 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17122 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17123 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17124 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17125 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17126 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 17127 | err = alc_auto_add_mic_boost(codec); |
| 17128 | if (err < 0) |
| 17129 | return err; |
| 17130 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17131 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17132 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17133 | return 1; |
| 17134 | } |
| 17135 | |
| 17136 | /* additional initialization for auto-configuration model */ |
| 17137 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 17138 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17139 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17140 | alc861vd_auto_init_multi_out(codec); |
| 17141 | alc861vd_auto_init_hp_out(codec); |
| 17142 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17143 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 17144 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17145 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17146 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17147 | } |
| 17148 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17149 | enum { |
| 17150 | ALC660VD_FIX_ASUS_GPIO1 |
| 17151 | }; |
| 17152 | |
| 17153 | /* reset GPIO1 */ |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17154 | static const struct alc_fixup alc861vd_fixups[] = { |
| 17155 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17156 | .type = ALC_FIXUP_VERBS, |
| 17157 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 73413b1 | 2010-08-30 09:39:57 +0200 | [diff] [blame] | 17158 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 17159 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 17160 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 17161 | { } |
| 17162 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17163 | }, |
| 17164 | }; |
| 17165 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17166 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17167 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 17168 | {} |
| 17169 | }; |
| 17170 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17171 | static int patch_alc861vd(struct hda_codec *codec) |
| 17172 | { |
| 17173 | struct alc_spec *spec; |
| 17174 | int err, board_config; |
| 17175 | |
| 17176 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17177 | if (spec == NULL) |
| 17178 | return -ENOMEM; |
| 17179 | |
| 17180 | codec->spec = spec; |
| 17181 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 17182 | spec->mixer_nid = 0x0b; |
| 17183 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17184 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 17185 | alc861vd_models, |
| 17186 | alc861vd_cfg_tbl); |
| 17187 | |
| 17188 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17189 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17190 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17191 | board_config = ALC861VD_AUTO; |
| 17192 | } |
| 17193 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17194 | if (board_config == ALC861VD_AUTO) { |
| 17195 | alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 17196 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 17197 | } |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 17198 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17199 | if (board_config == ALC861VD_AUTO) { |
| 17200 | /* automatic parse from the BIOS config */ |
| 17201 | err = alc861vd_parse_auto_config(codec); |
| 17202 | if (err < 0) { |
| 17203 | alc_free(codec); |
| 17204 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17205 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17206 | printk(KERN_INFO |
| 17207 | "hda_codec: Cannot set up configuration " |
| 17208 | "from BIOS. Using base mode...\n"); |
| 17209 | board_config = ALC861VD_3ST; |
| 17210 | } |
| 17211 | } |
| 17212 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17213 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 17214 | if (err < 0) { |
| 17215 | alc_free(codec); |
| 17216 | return err; |
| 17217 | } |
| 17218 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17219 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17220 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17221 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17222 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 17223 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17224 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 17225 | } |
| 17226 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17227 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 17228 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 17229 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17230 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 17231 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 17232 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17233 | if (!spec->adc_nids) { |
| 17234 | spec->adc_nids = alc861vd_adc_nids; |
| 17235 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 17236 | } |
| 17237 | if (!spec->capsrc_nids) |
| 17238 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17239 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17240 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 17241 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17242 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17243 | spec->vmaster_nid = 0x02; |
| 17244 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 17245 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 17246 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17247 | codec->patch_ops = alc_patch_ops; |
| 17248 | |
| 17249 | if (board_config == ALC861VD_AUTO) |
| 17250 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 17251 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17252 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17253 | if (!spec->loopback.amplist) |
| 17254 | spec->loopback.amplist = alc861vd_loopbacks; |
| 17255 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17256 | |
| 17257 | return 0; |
| 17258 | } |
| 17259 | |
| 17260 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17261 | * ALC662 support |
| 17262 | * |
| 17263 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 17264 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 17265 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 17266 | * 6-channel independent captures. |
| 17267 | * |
| 17268 | * In addition, an independent DAC for the multi-playback (not used in this |
| 17269 | * driver yet). |
| 17270 | */ |
| 17271 | #define ALC662_DIGOUT_NID 0x06 |
| 17272 | #define ALC662_DIGIN_NID 0x0a |
| 17273 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17274 | static const hda_nid_t alc662_dac_nids[3] = { |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 17275 | /* front, rear, clfe */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17276 | 0x02, 0x03, 0x04 |
| 17277 | }; |
| 17278 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17279 | static const hda_nid_t alc272_dac_nids[2] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17280 | 0x02, 0x03 |
| 17281 | }; |
| 17282 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17283 | static const hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17284 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17285 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17286 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17287 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17288 | static const hda_nid_t alc272_adc_nids[1] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17289 | /* ADC1-2 */ |
| 17290 | 0x08, |
| 17291 | }; |
| 17292 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17293 | static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
| 17294 | static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17295 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17296 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17297 | /* input MUX */ |
| 17298 | /* FIXME: should be a matrix-type input source selection */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17299 | static const struct hda_input_mux alc662_capture_source = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17300 | .num_items = 4, |
| 17301 | .items = { |
| 17302 | { "Mic", 0x0 }, |
| 17303 | { "Front Mic", 0x1 }, |
| 17304 | { "Line", 0x2 }, |
| 17305 | { "CD", 0x4 }, |
| 17306 | }, |
| 17307 | }; |
| 17308 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17309 | static const struct hda_input_mux alc662_lenovo_101e_capture_source = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17310 | .num_items = 2, |
| 17311 | .items = { |
| 17312 | { "Mic", 0x1 }, |
| 17313 | { "Line", 0x2 }, |
| 17314 | }, |
| 17315 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17316 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17317 | static const struct hda_input_mux alc663_capture_source = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17318 | .num_items = 3, |
| 17319 | .items = { |
| 17320 | { "Mic", 0x0 }, |
| 17321 | { "Front Mic", 0x1 }, |
| 17322 | { "Line", 0x2 }, |
| 17323 | }, |
| 17324 | }; |
| 17325 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17326 | #if 0 /* set to 1 for testing other input sources below */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17327 | static const struct hda_input_mux alc272_nc10_capture_source = { |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17328 | .num_items = 16, |
| 17329 | .items = { |
| 17330 | { "Autoselect Mic", 0x0 }, |
| 17331 | { "Internal Mic", 0x1 }, |
| 17332 | { "In-0x02", 0x2 }, |
| 17333 | { "In-0x03", 0x3 }, |
| 17334 | { "In-0x04", 0x4 }, |
| 17335 | { "In-0x05", 0x5 }, |
| 17336 | { "In-0x06", 0x6 }, |
| 17337 | { "In-0x07", 0x7 }, |
| 17338 | { "In-0x08", 0x8 }, |
| 17339 | { "In-0x09", 0x9 }, |
| 17340 | { "In-0x0a", 0x0a }, |
| 17341 | { "In-0x0b", 0x0b }, |
| 17342 | { "In-0x0c", 0x0c }, |
| 17343 | { "In-0x0d", 0x0d }, |
| 17344 | { "In-0x0e", 0x0e }, |
| 17345 | { "In-0x0f", 0x0f }, |
| 17346 | }, |
| 17347 | }; |
| 17348 | #endif |
| 17349 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17350 | /* |
| 17351 | * 2ch mode |
| 17352 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17353 | static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17354 | { 2, NULL } |
| 17355 | }; |
| 17356 | |
| 17357 | /* |
| 17358 | * 2ch mode |
| 17359 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17360 | static const struct hda_verb alc662_3ST_ch2_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17361 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 17362 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17363 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 17364 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 17365 | { } /* end */ |
| 17366 | }; |
| 17367 | |
| 17368 | /* |
| 17369 | * 6ch mode |
| 17370 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17371 | static const struct hda_verb alc662_3ST_ch6_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17372 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17373 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17374 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 17375 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17376 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 17377 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 17378 | { } /* end */ |
| 17379 | }; |
| 17380 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17381 | static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17382 | { 2, alc662_3ST_ch2_init }, |
| 17383 | { 6, alc662_3ST_ch6_init }, |
| 17384 | }; |
| 17385 | |
| 17386 | /* |
| 17387 | * 2ch mode |
| 17388 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17389 | static const struct hda_verb alc662_sixstack_ch6_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17390 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17391 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 17392 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17393 | { } /* end */ |
| 17394 | }; |
| 17395 | |
| 17396 | /* |
| 17397 | * 6ch mode |
| 17398 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17399 | static const struct hda_verb alc662_sixstack_ch8_init[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17400 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17401 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17402 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 17403 | { } /* end */ |
| 17404 | }; |
| 17405 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17406 | static const struct hda_channel_mode alc662_5stack_modes[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17407 | { 2, alc662_sixstack_ch6_init }, |
| 17408 | { 6, alc662_sixstack_ch8_init }, |
| 17409 | }; |
| 17410 | |
| 17411 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 17412 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 17413 | */ |
| 17414 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17415 | static const struct snd_kcontrol_new alc662_base_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17416 | /* output mixer control */ |
| 17417 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17418 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17419 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17420 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17421 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17422 | 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] | 17423 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17424 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17426 | |
| 17427 | /*Input mixer control */ |
| 17428 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 17429 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 17430 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 17431 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 17432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 17433 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 17434 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 17435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17436 | { } /* end */ |
| 17437 | }; |
| 17438 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17439 | static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17440 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17441 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17442 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17443 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17444 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17445 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17446 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17447 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17448 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17449 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17450 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17451 | { } /* end */ |
| 17452 | }; |
| 17453 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17454 | static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17455 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17456 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17457 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 17458 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17459 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17460 | 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] | 17461 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 17462 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17463 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17464 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 17465 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 17466 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17467 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17470 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17471 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17472 | { } /* end */ |
| 17473 | }; |
| 17474 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17475 | static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17476 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17477 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17478 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17479 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17480 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17481 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17482 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17484 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17485 | { } /* end */ |
| 17486 | }; |
| 17487 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17488 | static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17489 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17490 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17491 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17492 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17493 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17494 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17495 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 17496 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17497 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17498 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17499 | { } /* end */ |
| 17500 | }; |
| 17501 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17502 | static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17503 | ALC262_HIPPO_MASTER_SWITCH, |
| 17504 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17505 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17506 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17507 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17508 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17509 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17510 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17511 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17512 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17513 | { } /* end */ |
| 17514 | }; |
| 17515 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17516 | static const struct hda_bind_ctls alc663_asus_bind_master_vol = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17517 | .ops = &snd_hda_bind_vol, |
| 17518 | .values = { |
| 17519 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17520 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17521 | 0 |
| 17522 | }, |
| 17523 | }; |
| 17524 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17525 | static const struct hda_bind_ctls alc663_asus_one_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17526 | .ops = &snd_hda_bind_sw, |
| 17527 | .values = { |
| 17528 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17529 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17530 | 0 |
| 17531 | }, |
| 17532 | }; |
| 17533 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17534 | static const struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17535 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17536 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17537 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17538 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17539 | { } /* end */ |
| 17540 | }; |
| 17541 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17542 | static const struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17543 | .ops = &snd_hda_bind_sw, |
| 17544 | .values = { |
| 17545 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17546 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17547 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17548 | 0 |
| 17549 | }, |
| 17550 | }; |
| 17551 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17552 | static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17553 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17554 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17557 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17558 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17559 | |
| 17560 | { } /* end */ |
| 17561 | }; |
| 17562 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17563 | static const struct hda_bind_ctls alc663_asus_four_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17564 | .ops = &snd_hda_bind_sw, |
| 17565 | .values = { |
| 17566 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17567 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17568 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17569 | 0 |
| 17570 | }, |
| 17571 | }; |
| 17572 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17573 | static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17574 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17575 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17577 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17578 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17579 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17580 | { } /* end */ |
| 17581 | }; |
| 17582 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17583 | static const struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17584 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17585 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17586 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17587 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17588 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17589 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17590 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17591 | { } /* end */ |
| 17592 | }; |
| 17593 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17594 | static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17595 | .ops = &snd_hda_bind_vol, |
| 17596 | .values = { |
| 17597 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17598 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17599 | 0 |
| 17600 | }, |
| 17601 | }; |
| 17602 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17603 | static const struct hda_bind_ctls alc663_asus_two_bind_switch = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17604 | .ops = &snd_hda_bind_sw, |
| 17605 | .values = { |
| 17606 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17607 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17608 | 0 |
| 17609 | }, |
| 17610 | }; |
| 17611 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17612 | static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17613 | HDA_BIND_VOL("Master Playback Volume", |
| 17614 | &alc663_asus_two_bind_master_vol), |
| 17615 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17616 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17617 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17620 | { } /* end */ |
| 17621 | }; |
| 17622 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17623 | static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17624 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17625 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17626 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17627 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17628 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17629 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17630 | { } /* end */ |
| 17631 | }; |
| 17632 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17633 | static const struct snd_kcontrol_new alc663_g71v_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17634 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17635 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17636 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17637 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17638 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17639 | |
| 17640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17641 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17642 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17643 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17644 | { } /* end */ |
| 17645 | }; |
| 17646 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17647 | static const struct snd_kcontrol_new alc663_g50v_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17648 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17649 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17650 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17651 | |
| 17652 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17653 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 17654 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17655 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17656 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17657 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17658 | { } /* end */ |
| 17659 | }; |
| 17660 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17661 | 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] | 17662 | .ops = &snd_hda_bind_sw, |
| 17663 | .values = { |
| 17664 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17665 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17666 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17667 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17668 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17669 | 0 |
| 17670 | }, |
| 17671 | }; |
| 17672 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17673 | 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] | 17674 | .ops = &snd_hda_bind_sw, |
| 17675 | .values = { |
| 17676 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17677 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17678 | 0 |
| 17679 | }, |
| 17680 | }; |
| 17681 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17682 | static const struct snd_kcontrol_new alc663_mode7_mixer[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17683 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17684 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17685 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17686 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17687 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17688 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17689 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17692 | { } /* end */ |
| 17693 | }; |
| 17694 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17695 | static const struct snd_kcontrol_new alc663_mode8_mixer[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17696 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17697 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17698 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17699 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17700 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17701 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17702 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17703 | { } /* end */ |
| 17704 | }; |
| 17705 | |
| 17706 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17707 | static const struct snd_kcontrol_new alc662_chmode_mixer[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17708 | { |
| 17709 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17710 | .name = "Channel Mode", |
| 17711 | .info = alc_ch_mode_info, |
| 17712 | .get = alc_ch_mode_get, |
| 17713 | .put = alc_ch_mode_put, |
| 17714 | }, |
| 17715 | { } /* end */ |
| 17716 | }; |
| 17717 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17718 | static const struct hda_verb alc662_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17719 | /* ADC: mute amp left and right */ |
| 17720 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17721 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17722 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17723 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17725 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17726 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17727 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17728 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17729 | |
| 17730 | /* Front Pin: output 0 (0x0c) */ |
| 17731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17732 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17733 | |
| 17734 | /* Rear Pin: output 1 (0x0d) */ |
| 17735 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17736 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17737 | |
| 17738 | /* CLFE Pin: output 2 (0x0e) */ |
| 17739 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17740 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17741 | |
| 17742 | /* Mic (rear) pin: input vref at 80% */ |
| 17743 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17744 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17745 | /* Front Mic pin: input vref at 80% */ |
| 17746 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17747 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17748 | /* Line In pin: input */ |
| 17749 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17750 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17751 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17752 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17753 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17754 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17755 | /* CD pin widget for input */ |
| 17756 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17757 | |
| 17758 | /* FIXME: use matrix-type input source selection */ |
| 17759 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17760 | /* Input mixer */ |
| 17761 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17762 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17763 | |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 17764 | { } |
| 17765 | }; |
| 17766 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17767 | static const struct hda_verb alc662_eapd_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17768 | /* always trun on EAPD */ |
| 17769 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17770 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17771 | { } |
| 17772 | }; |
| 17773 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17774 | static const struct hda_verb alc662_sue_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17775 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17776 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17777 | {} |
| 17778 | }; |
| 17779 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17780 | static const struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17781 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17782 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17783 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17784 | }; |
| 17785 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17786 | /* Set Unsolicited Event*/ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17787 | static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17788 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17789 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17790 | {} |
| 17791 | }; |
| 17792 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17793 | static const struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17794 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17795 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17796 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17797 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17798 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17799 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17800 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17801 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17802 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17803 | {} |
| 17804 | }; |
| 17805 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17806 | static const struct hda_verb alc663_21jd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17807 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17808 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17809 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17810 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17811 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17812 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17813 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17814 | {} |
| 17815 | }; |
| 17816 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17817 | static const struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17818 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17819 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17820 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17821 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17822 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17823 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17824 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17825 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17826 | {} |
| 17827 | }; |
| 17828 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17829 | static const struct hda_verb alc663_15jd_amic_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17830 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17831 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17832 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17833 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17834 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17835 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17836 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17837 | {} |
| 17838 | }; |
| 17839 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17840 | static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17841 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17842 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17843 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17844 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17845 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17846 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17847 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17848 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17849 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17850 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17851 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17852 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17853 | {} |
| 17854 | }; |
| 17855 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17856 | static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17857 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17858 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17859 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17860 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17861 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17862 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17863 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17864 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17865 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17866 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17867 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17868 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17869 | {} |
| 17870 | }; |
| 17871 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17872 | static const struct hda_verb alc663_g71v_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17874 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17875 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17876 | |
| 17877 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17878 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17879 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17880 | |
| 17881 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17882 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17883 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17884 | {} |
| 17885 | }; |
| 17886 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17887 | static const struct hda_verb alc663_g50v_init_verbs[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17888 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17889 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17890 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17891 | |
| 17892 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17893 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17894 | {} |
| 17895 | }; |
| 17896 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17897 | static const struct hda_verb alc662_ecs_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17898 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17899 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17900 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17901 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17902 | {} |
| 17903 | }; |
| 17904 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17905 | static const struct hda_verb alc272_dell_zm1_init_verbs[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17906 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17907 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17908 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17909 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17910 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17911 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17912 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17913 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17915 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17916 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17917 | {} |
| 17918 | }; |
| 17919 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17920 | static const struct hda_verb alc272_dell_init_verbs[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17921 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17922 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17924 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17925 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17926 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17927 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17928 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17929 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17930 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17931 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17932 | {} |
| 17933 | }; |
| 17934 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17935 | static const struct hda_verb alc663_mode7_init_verbs[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17936 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17937 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17938 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17939 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17943 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17944 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17945 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17946 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17947 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17948 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17949 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17950 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17951 | {} |
| 17952 | }; |
| 17953 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17954 | static const struct hda_verb alc663_mode8_init_verbs[] = { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17955 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17957 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17958 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17959 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17960 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17961 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17962 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17963 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17964 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17965 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17966 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17967 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17968 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17969 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17970 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17971 | {} |
| 17972 | }; |
| 17973 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17974 | static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17975 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17976 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17977 | { } /* end */ |
| 17978 | }; |
| 17979 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 17980 | static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17981 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17982 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17983 | { } /* end */ |
| 17984 | }; |
| 17985 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17986 | static void alc662_lenovo_101e_setup(struct hda_codec *codec) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17987 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17988 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17989 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 17990 | spec->autocfg.hp_pins[0] = 0x1b; |
| 17991 | spec->autocfg.line_out_pins[0] = 0x14; |
| 17992 | spec->autocfg.speaker_pins[0] = 0x15; |
| 17993 | spec->automute = 1; |
| 17994 | spec->detect_line = 1; |
| 17995 | spec->automute_lines = 1; |
| 17996 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17997 | } |
| 17998 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17999 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18000 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18001 | struct alc_spec *spec = codec->spec; |
| 18002 | |
| 18003 | alc262_hippo1_setup(codec); |
| 18004 | spec->ext_mic.pin = 0x18; |
| 18005 | spec->ext_mic.mux_idx = 0; |
| 18006 | spec->int_mic.pin = 0x19; |
| 18007 | spec->int_mic.mux_idx = 1; |
| 18008 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18009 | } |
| 18010 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18011 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18012 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18013 | struct alc_spec *spec = codec->spec; |
| 18014 | |
| 18015 | spec->autocfg.hp_pins[0] = 0x14; |
| 18016 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18017 | spec->automute = 1; |
| 18018 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18019 | } |
| 18020 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18021 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 18022 | { |
| 18023 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18024 | spec->autocfg.hp_pins[0] = 0x21; |
| 18025 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18026 | spec->automute_mixer_nid[0] = 0x0c; |
| 18027 | spec->automute = 1; |
| 18028 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18029 | spec->ext_mic.pin = 0x18; |
| 18030 | spec->ext_mic.mux_idx = 0; |
| 18031 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18032 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18033 | spec->auto_mic = 1; |
| 18034 | } |
| 18035 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18036 | /* ***************** Mode1 ******************************/ |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18037 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 18038 | { |
| 18039 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18040 | spec->autocfg.hp_pins[0] = 0x21; |
| 18041 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18042 | spec->automute_mixer_nid[0] = 0x0c; |
| 18043 | spec->automute = 1; |
| 18044 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18045 | spec->ext_mic.pin = 0x18; |
| 18046 | spec->ext_mic.mux_idx = 0; |
| 18047 | spec->int_mic.pin = 0x19; |
| 18048 | spec->int_mic.mux_idx = 1; |
| 18049 | spec->auto_mic = 1; |
| 18050 | } |
| 18051 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18052 | /* ***************** Mode2 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18053 | static void alc662_mode2_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18054 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18055 | struct alc_spec *spec = codec->spec; |
| 18056 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18057 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18058 | spec->automute = 1; |
| 18059 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18060 | spec->ext_mic.pin = 0x18; |
| 18061 | spec->ext_mic.mux_idx = 0; |
| 18062 | spec->int_mic.pin = 0x19; |
| 18063 | spec->int_mic.mux_idx = 1; |
| 18064 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18065 | } |
| 18066 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18067 | /* ***************** Mode3 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18068 | static void alc663_mode3_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18069 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18070 | struct alc_spec *spec = codec->spec; |
| 18071 | spec->autocfg.hp_pins[0] = 0x21; |
| 18072 | spec->autocfg.hp_pins[0] = 0x15; |
| 18073 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18074 | spec->automute = 1; |
| 18075 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18076 | spec->ext_mic.pin = 0x18; |
| 18077 | spec->ext_mic.mux_idx = 0; |
| 18078 | spec->int_mic.pin = 0x19; |
| 18079 | spec->int_mic.mux_idx = 1; |
| 18080 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18081 | } |
| 18082 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18083 | /* ***************** Mode4 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18084 | static void alc663_mode4_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18085 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18086 | struct alc_spec *spec = codec->spec; |
| 18087 | spec->autocfg.hp_pins[0] = 0x21; |
| 18088 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18089 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18090 | spec->automute_mixer_nid[0] = 0x0c; |
| 18091 | spec->automute_mixer_nid[1] = 0x0e; |
| 18092 | spec->automute = 1; |
| 18093 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18094 | spec->ext_mic.pin = 0x18; |
| 18095 | spec->ext_mic.mux_idx = 0; |
| 18096 | spec->int_mic.pin = 0x19; |
| 18097 | spec->int_mic.mux_idx = 1; |
| 18098 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18099 | } |
| 18100 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18101 | /* ***************** Mode5 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18102 | static void alc663_mode5_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18103 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18104 | struct alc_spec *spec = codec->spec; |
| 18105 | spec->autocfg.hp_pins[0] = 0x15; |
| 18106 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18107 | spec->autocfg.speaker_pins[1] = 0x16; |
| 18108 | spec->automute_mixer_nid[0] = 0x0c; |
| 18109 | spec->automute_mixer_nid[1] = 0x0e; |
| 18110 | spec->automute = 1; |
| 18111 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18112 | spec->ext_mic.pin = 0x18; |
| 18113 | spec->ext_mic.mux_idx = 0; |
| 18114 | spec->int_mic.pin = 0x19; |
| 18115 | spec->int_mic.mux_idx = 1; |
| 18116 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18117 | } |
| 18118 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18119 | /* ***************** Mode6 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18120 | static void alc663_mode6_setup(struct hda_codec *codec) |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18121 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18122 | struct alc_spec *spec = codec->spec; |
| 18123 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18124 | spec->autocfg.hp_pins[0] = 0x15; |
| 18125 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18126 | spec->automute_mixer_nid[0] = 0x0c; |
| 18127 | spec->automute = 1; |
| 18128 | spec->automute_mode = ALC_AUTOMUTE_MIXER; |
| 18129 | spec->ext_mic.pin = 0x18; |
| 18130 | spec->ext_mic.mux_idx = 0; |
| 18131 | spec->int_mic.pin = 0x19; |
| 18132 | spec->int_mic.mux_idx = 1; |
| 18133 | spec->auto_mic = 1; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18134 | } |
| 18135 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18136 | /* ***************** Mode7 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18137 | static void alc663_mode7_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18138 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18139 | struct alc_spec *spec = codec->spec; |
| 18140 | spec->autocfg.hp_pins[0] = 0x1b; |
| 18141 | spec->autocfg.hp_pins[0] = 0x21; |
| 18142 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18143 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18144 | spec->automute = 1; |
| 18145 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18146 | spec->ext_mic.pin = 0x18; |
| 18147 | spec->ext_mic.mux_idx = 0; |
| 18148 | spec->int_mic.pin = 0x19; |
| 18149 | spec->int_mic.mux_idx = 1; |
| 18150 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18151 | } |
| 18152 | |
| 18153 | /* ***************** Mode8 ******************************/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18154 | static void alc663_mode8_setup(struct hda_codec *codec) |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18155 | { |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18156 | struct alc_spec *spec = codec->spec; |
| 18157 | spec->autocfg.hp_pins[0] = 0x21; |
| 18158 | spec->autocfg.hp_pins[1] = 0x15; |
| 18159 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18160 | spec->autocfg.speaker_pins[0] = 0x17; |
| 18161 | spec->automute = 1; |
| 18162 | spec->automute_mode = ALC_AUTOMUTE_PIN; |
| 18163 | spec->ext_mic.pin = 0x18; |
| 18164 | spec->ext_mic.mux_idx = 0; |
| 18165 | spec->int_mic.pin = 0x12; |
| 18166 | spec->int_mic.mux_idx = 9; |
| 18167 | spec->auto_mic = 1; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18168 | } |
| 18169 | |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18170 | static void alc663_g71v_setup(struct hda_codec *codec) |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18171 | { |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18172 | struct alc_spec *spec = codec->spec; |
| 18173 | spec->autocfg.hp_pins[0] = 0x21; |
| 18174 | spec->autocfg.line_out_pins[0] = 0x15; |
| 18175 | spec->autocfg.speaker_pins[0] = 0x14; |
| 18176 | spec->automute = 1; |
| 18177 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
| 18178 | spec->detect_line = 1; |
| 18179 | spec->automute_lines = 1; |
| 18180 | spec->ext_mic.pin = 0x18; |
| 18181 | spec->ext_mic.mux_idx = 0; |
| 18182 | spec->int_mic.pin = 0x12; |
| 18183 | spec->int_mic.mux_idx = 9; |
| 18184 | spec->auto_mic = 1; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18185 | } |
| 18186 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18187 | #define alc663_g50v_setup alc663_m51va_setup |
| 18188 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18189 | static const struct snd_kcontrol_new alc662_ecs_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18190 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18191 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18192 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18193 | HDA_CODEC_VOLUME("Mic/LineIn Boost Volume", 0x18, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18194 | HDA_CODEC_VOLUME("Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18195 | HDA_CODEC_MUTE("Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18196 | |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18197 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
David Henningsson | 1052802 | 2010-12-20 14:50:59 +0100 | [diff] [blame] | 18198 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18199 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18200 | { } /* end */ |
| 18201 | }; |
| 18202 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18203 | static const struct snd_kcontrol_new alc272_nc10_mixer[] = { |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18204 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18205 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18206 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18207 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18208 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18209 | |
David Henningsson | 8607f7c | 2010-12-20 14:43:54 +0100 | [diff] [blame] | 18210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18212 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18213 | |
David Henningsson | 28c4edb | 2010-12-20 14:24:29 +0100 | [diff] [blame] | 18214 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18215 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 18216 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18217 | { } /* end */ |
| 18218 | }; |
| 18219 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18220 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18221 | #define alc662_loopbacks alc880_loopbacks |
| 18222 | #endif |
| 18223 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18224 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18225 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18226 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18227 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18228 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18229 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18230 | |
| 18231 | /* |
| 18232 | * configuration and preset |
| 18233 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 18234 | static const char * const alc662_models[ALC662_MODEL_LAST] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18235 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18236 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18237 | [ALC662_3ST_6ch] = "3stack-6ch", |
Raymond Yau | 4bf4a6c | 2011-04-05 22:47:15 +0800 | [diff] [blame] | 18238 | [ALC662_5ST_DIG] = "5stack-dig", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18239 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18240 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18241 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18242 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18243 | [ALC663_ASUS_M51VA] = "m51va", |
| 18244 | [ALC663_ASUS_G71V] = "g71v", |
| 18245 | [ALC663_ASUS_H13] = "h13", |
| 18246 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18247 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18248 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18249 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18250 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18251 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18252 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18253 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18254 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18255 | [ALC272_DELL] = "dell", |
| 18256 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18257 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18258 | [ALC662_AUTO] = "auto", |
| 18259 | }; |
| 18260 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18261 | static const struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18262 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18263 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18264 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18265 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18266 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18267 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18268 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18269 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18270 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18271 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18272 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18273 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18274 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18275 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18276 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18277 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18278 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18279 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18280 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18281 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18282 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18283 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18284 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18285 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18286 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18287 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18288 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18289 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18290 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18291 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18292 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18293 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18294 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18295 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18296 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18297 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18298 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18299 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18300 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18301 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18302 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18303 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18304 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18305 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18306 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18307 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18308 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18309 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18310 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18311 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18312 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18313 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18314 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18315 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18316 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18317 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18318 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18319 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18320 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18321 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18322 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18323 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18324 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18325 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18326 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18327 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18328 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Takashi Iwai | ebb4724 | 2011-05-02 10:37:29 +0200 | [diff] [blame] | 18329 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18330 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18331 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18332 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18333 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18334 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18335 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18336 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18337 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18338 | ALC663_ASUS_H13), |
Anisse Astier | 965b76d | 2011-02-10 13:14:44 +0100 | [diff] [blame] | 18339 | SND_PCI_QUIRK(0x1991, 0x5628, "Ordissimo EVE", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18340 | {} |
| 18341 | }; |
| 18342 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 18343 | static const struct alc_config_preset alc662_presets[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18344 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18345 | .mixers = { alc662_3ST_2ch_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18346 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18347 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18348 | .dac_nids = alc662_dac_nids, |
| 18349 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18350 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18351 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18352 | .channel_mode = alc662_3ST_2ch_modes, |
| 18353 | .input_mux = &alc662_capture_source, |
| 18354 | }, |
| 18355 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18356 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18357 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18358 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18359 | .dac_nids = alc662_dac_nids, |
| 18360 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18361 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18362 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18363 | .channel_mode = alc662_3ST_6ch_modes, |
| 18364 | .need_dac_fix = 1, |
| 18365 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18366 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18367 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18368 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18369 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18370 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18371 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18372 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18373 | .channel_mode = alc662_3ST_6ch_modes, |
| 18374 | .need_dac_fix = 1, |
| 18375 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18376 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18377 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18378 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18379 | .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18380 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18381 | .dac_nids = alc662_dac_nids, |
| 18382 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18383 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18384 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18385 | .channel_mode = alc662_5stack_modes, |
| 18386 | .input_mux = &alc662_capture_source, |
| 18387 | }, |
| 18388 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18389 | .mixers = { alc662_lenovo_101e_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18390 | .init_verbs = { alc662_init_verbs, |
| 18391 | alc662_eapd_init_verbs, |
| 18392 | alc662_sue_init_verbs }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18393 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18394 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18395 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18396 | .channel_mode = alc662_3ST_2ch_modes, |
| 18397 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18398 | .unsol_event = alc_sku_unsol_event, |
| 18399 | .setup = alc662_lenovo_101e_setup, |
| 18400 | .init_hook = alc_inithook, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18401 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18402 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18403 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18404 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18405 | alc662_eapd_init_verbs, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18406 | alc662_eeepc_sue_init_verbs }, |
| 18407 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18408 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18409 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18410 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18411 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18412 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18413 | .init_hook = alc_inithook, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18414 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18415 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18416 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18417 | alc662_chmode_mixer }, |
| 18418 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18419 | alc662_eapd_init_verbs, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18420 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18421 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18422 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18423 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18424 | .channel_mode = alc662_3ST_6ch_modes, |
| 18425 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18426 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18427 | .setup = alc662_eeepc_ep20_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18428 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18429 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18430 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18431 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18432 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18433 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18434 | alc662_ecs_init_verbs }, |
| 18435 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18436 | .dac_nids = alc662_dac_nids, |
| 18437 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18438 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18439 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18440 | .setup = alc662_eeepc_setup, |
Takashi Iwai | e942796 | 2011-04-28 15:46:07 +0200 | [diff] [blame] | 18441 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18442 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18443 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18444 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18445 | .init_verbs = { alc662_init_verbs, |
| 18446 | alc662_eapd_init_verbs, |
| 18447 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18448 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18449 | .dac_nids = alc662_dac_nids, |
| 18450 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18451 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18452 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18453 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18454 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18455 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18456 | }, |
| 18457 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18458 | .mixers = { alc663_g71v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18459 | .init_verbs = { alc662_init_verbs, |
| 18460 | alc662_eapd_init_verbs, |
| 18461 | alc663_g71v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18462 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18463 | .dac_nids = alc662_dac_nids, |
| 18464 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18465 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18466 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18467 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18468 | .setup = alc663_g71v_setup, |
Takashi Iwai | e6a5e1b | 2011-04-28 14:41:52 +0200 | [diff] [blame] | 18469 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18470 | }, |
| 18471 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18472 | .mixers = { alc663_m51va_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18473 | .init_verbs = { alc662_init_verbs, |
| 18474 | alc662_eapd_init_verbs, |
| 18475 | alc663_m51va_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18476 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18477 | .dac_nids = alc662_dac_nids, |
| 18478 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18479 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18480 | .setup = alc663_m51va_setup, |
| 18481 | .unsol_event = alc_sku_unsol_event, |
| 18482 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18483 | }, |
| 18484 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18485 | .mixers = { alc663_g50v_mixer }, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18486 | .init_verbs = { alc662_init_verbs, |
| 18487 | alc662_eapd_init_verbs, |
| 18488 | alc663_g50v_init_verbs }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18489 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18490 | .dac_nids = alc662_dac_nids, |
| 18491 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18492 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18493 | .channel_mode = alc662_3ST_6ch_modes, |
| 18494 | .input_mux = &alc663_capture_source, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18495 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18496 | .setup = alc663_g50v_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18497 | .init_hook = alc_inithook, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18498 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18499 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18500 | .mixers = { alc663_m51va_mixer }, |
| 18501 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18502 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18503 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18504 | alc663_21jd_amic_init_verbs }, |
| 18505 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18506 | .hp_nid = 0x03, |
| 18507 | .dac_nids = alc662_dac_nids, |
| 18508 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18509 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18510 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18511 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18512 | .setup = alc663_mode1_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18513 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18514 | }, |
| 18515 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18516 | .mixers = { alc662_1bjd_mixer }, |
| 18517 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18518 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18519 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18520 | alc662_1bjd_amic_init_verbs }, |
| 18521 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18522 | .dac_nids = alc662_dac_nids, |
| 18523 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18524 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18525 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18526 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18527 | .setup = alc662_mode2_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18528 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18529 | }, |
| 18530 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18531 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18532 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18533 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18534 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18535 | alc663_two_hp_amic_m1_init_verbs }, |
| 18536 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18537 | .hp_nid = 0x03, |
| 18538 | .dac_nids = alc662_dac_nids, |
| 18539 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18540 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18541 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18542 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18543 | .setup = alc663_mode3_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18544 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18545 | }, |
| 18546 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18547 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18548 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18549 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18550 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18551 | alc663_21jd_amic_init_verbs}, |
| 18552 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18553 | .hp_nid = 0x03, |
| 18554 | .dac_nids = alc662_dac_nids, |
| 18555 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18556 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18557 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18558 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18559 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18560 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18561 | }, |
| 18562 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18563 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18564 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18565 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18566 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18567 | alc663_15jd_amic_init_verbs }, |
| 18568 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18569 | .hp_nid = 0x03, |
| 18570 | .dac_nids = alc662_dac_nids, |
| 18571 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18572 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18573 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18574 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18575 | .setup = alc663_mode5_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18576 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18577 | }, |
| 18578 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18579 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18580 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18581 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18582 | alc662_eapd_init_verbs, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18583 | alc663_two_hp_amic_m2_init_verbs }, |
| 18584 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18585 | .hp_nid = 0x03, |
| 18586 | .dac_nids = alc662_dac_nids, |
| 18587 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18588 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18589 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18590 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18591 | .setup = alc663_mode6_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18592 | .init_hook = alc_inithook, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18593 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18594 | [ALC663_ASUS_MODE7] = { |
| 18595 | .mixers = { alc663_mode7_mixer }, |
| 18596 | .cap_mixer = alc662_auto_capture_mixer, |
| 18597 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18598 | alc662_eapd_init_verbs, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18599 | alc663_mode7_init_verbs }, |
| 18600 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18601 | .hp_nid = 0x03, |
| 18602 | .dac_nids = alc662_dac_nids, |
| 18603 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18604 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18605 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18606 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18607 | .setup = alc663_mode7_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18608 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18609 | }, |
| 18610 | [ALC663_ASUS_MODE8] = { |
| 18611 | .mixers = { alc663_mode8_mixer }, |
| 18612 | .cap_mixer = alc662_auto_capture_mixer, |
| 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 | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18615 | alc663_mode8_init_verbs }, |
| 18616 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18617 | .hp_nid = 0x03, |
| 18618 | .dac_nids = alc662_dac_nids, |
| 18619 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18620 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18621 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18622 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18623 | .setup = alc663_mode8_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18624 | .init_hook = alc_inithook, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18625 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18626 | [ALC272_DELL] = { |
| 18627 | .mixers = { alc663_m51va_mixer }, |
| 18628 | .cap_mixer = alc272_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18629 | .init_verbs = { alc662_init_verbs, |
| 18630 | alc662_eapd_init_verbs, |
| 18631 | alc272_dell_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18632 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18633 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18634 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18635 | .adc_nids = alc272_adc_nids, |
| 18636 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18637 | .capsrc_nids = alc272_capsrc_nids, |
| 18638 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18639 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18640 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18641 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18642 | }, |
| 18643 | [ALC272_DELL_ZM1] = { |
| 18644 | .mixers = { alc663_m51va_mixer }, |
| 18645 | .cap_mixer = alc662_auto_capture_mixer, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18646 | .init_verbs = { alc662_init_verbs, |
| 18647 | alc662_eapd_init_verbs, |
| 18648 | alc272_dell_zm1_init_verbs }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18649 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
Takashi Iwai | 1bc7cf9 | 2011-04-06 09:42:29 +0200 | [diff] [blame] | 18650 | .dac_nids = alc272_dac_nids, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18651 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18652 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18653 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18654 | .capsrc_nids = alc662_capsrc_nids, |
| 18655 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18656 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18657 | .setup = alc663_m51va_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18658 | .init_hook = alc_inithook, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18659 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18660 | [ALC272_SAMSUNG_NC10] = { |
| 18661 | .mixers = { alc272_nc10_mixer }, |
| 18662 | .init_verbs = { alc662_init_verbs, |
Takashi Iwai | a7f2371 | 2011-04-07 10:24:23 +0200 | [diff] [blame] | 18663 | alc662_eapd_init_verbs, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18664 | alc663_21jd_amic_init_verbs }, |
| 18665 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18666 | .dac_nids = alc272_dac_nids, |
| 18667 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18668 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18669 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18670 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18671 | .setup = alc663_mode4_setup, |
Takashi Iwai | 3b8510c | 2011-04-28 14:03:24 +0200 | [diff] [blame] | 18672 | .init_hook = alc_inithook, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18673 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18674 | }; |
| 18675 | |
| 18676 | |
| 18677 | /* |
| 18678 | * BIOS auto configuration |
| 18679 | */ |
| 18680 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18681 | /* convert from MIX nid to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18682 | 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] | 18683 | { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18684 | hda_nid_t list[5]; |
Takashi Iwai | 1304ac8 | 2011-04-06 15:16:21 +0200 | [diff] [blame] | 18685 | int i, num; |
| 18686 | |
| 18687 | num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list)); |
| 18688 | for (i = 0; i < num; i++) { |
| 18689 | if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT) |
| 18690 | return list[i]; |
| 18691 | } |
| 18692 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18693 | } |
| 18694 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18695 | /* go down to the selector widget before the mixer */ |
| 18696 | static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin) |
| 18697 | { |
| 18698 | hda_nid_t srcs[5]; |
| 18699 | int num = snd_hda_get_connections(codec, pin, srcs, |
| 18700 | ARRAY_SIZE(srcs)); |
| 18701 | if (num != 1 || |
| 18702 | get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL) |
| 18703 | return pin; |
| 18704 | return srcs[0]; |
| 18705 | } |
| 18706 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18707 | /* get MIX nid connected to the given pin targeted to DAC */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18708 | 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] | 18709 | hda_nid_t dac) |
| 18710 | { |
David Henningsson | cc1c452 | 2010-11-24 14:17:47 +0100 | [diff] [blame] | 18711 | hda_nid_t mix[5]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18712 | int i, num; |
| 18713 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18714 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18715 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18716 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18717 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18718 | return mix[i]; |
| 18719 | } |
| 18720 | return 0; |
| 18721 | } |
| 18722 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18723 | /* select the connection from pin to DAC if needed */ |
| 18724 | static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin, |
| 18725 | hda_nid_t dac) |
| 18726 | { |
| 18727 | hda_nid_t mix[5]; |
| 18728 | int i, num; |
| 18729 | |
| 18730 | pin = alc_go_down_to_selector(codec, pin); |
| 18731 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18732 | if (num < 2) |
| 18733 | return 0; |
| 18734 | for (i = 0; i < num; i++) { |
| 18735 | if (alc_auto_mix_to_dac(codec, mix[i]) == dac) { |
| 18736 | snd_hda_codec_update_cache(codec, pin, 0, |
| 18737 | AC_VERB_SET_CONNECT_SEL, i); |
| 18738 | return 0; |
| 18739 | } |
| 18740 | } |
| 18741 | return 0; |
| 18742 | } |
| 18743 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18744 | /* look for an empty DAC slot */ |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18745 | 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] | 18746 | { |
| 18747 | struct alc_spec *spec = codec->spec; |
| 18748 | hda_nid_t srcs[5]; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18749 | int i, num; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18750 | |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18751 | pin = alc_go_down_to_selector(codec, pin); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18752 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18753 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18754 | hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18755 | if (!nid) |
| 18756 | continue; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18757 | if (found_in_nid_list(nid, spec->multiout.dac_nids, |
| 18758 | spec->multiout.num_dacs)) |
| 18759 | continue; |
| 18760 | if (spec->multiout.hp_nid == nid) |
| 18761 | continue; |
| 18762 | if (found_in_nid_list(nid, spec->multiout.extra_out_nid, |
| 18763 | ARRAY_SIZE(spec->multiout.extra_out_nid))) |
| 18764 | continue; |
| 18765 | return nid; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18766 | } |
| 18767 | return 0; |
| 18768 | } |
| 18769 | |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18770 | static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) |
| 18771 | { |
| 18772 | hda_nid_t sel = alc_go_down_to_selector(codec, pin); |
| 18773 | if (snd_hda_get_conn_list(codec, sel, NULL) == 1) |
| 18774 | return alc_auto_look_for_dac(codec, pin); |
| 18775 | return 0; |
| 18776 | } |
| 18777 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18778 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 18779 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18780 | { |
| 18781 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 18782 | const struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18783 | bool redone; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18784 | int i; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18785 | |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18786 | again: |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 18787 | spec->multiout.num_dacs = 0; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18788 | spec->multiout.hp_nid = 0; |
| 18789 | spec->multiout.extra_out_nid[0] = 0; |
| 18790 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); |
| 18791 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18792 | |
| 18793 | /* fill hard-wired DACs first */ |
| 18794 | if (!redone) { |
| 18795 | for (i = 0; i < cfg->line_outs; i++) |
| 18796 | spec->private_dac_nids[i] = |
| 18797 | get_dac_if_single(codec, cfg->line_out_pins[i]); |
| 18798 | if (cfg->hp_outs) |
| 18799 | spec->multiout.hp_nid = |
| 18800 | get_dac_if_single(codec, cfg->hp_pins[0]); |
| 18801 | if (cfg->speaker_outs) |
| 18802 | spec->multiout.extra_out_nid[0] = |
| 18803 | get_dac_if_single(codec, cfg->speaker_pins[0]); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18804 | } |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18805 | |
| 18806 | for (i = 0; i < cfg->line_outs; i++) { |
| 18807 | hda_nid_t pin = cfg->line_out_pins[i]; |
| 18808 | if (spec->private_dac_nids[i]) |
| 18809 | continue; |
| 18810 | spec->private_dac_nids[i] = alc_auto_look_for_dac(codec, pin); |
| 18811 | if (!spec->private_dac_nids[i] && !redone) { |
| 18812 | /* if we can't find primary DACs, re-probe without |
| 18813 | * checking the hard-wired DACs |
| 18814 | */ |
| 18815 | redone = true; |
| 18816 | goto again; |
| 18817 | } |
| 18818 | } |
| 18819 | |
| 18820 | for (i = 0; i < cfg->line_outs; i++) { |
| 18821 | if (spec->private_dac_nids[i]) |
| 18822 | spec->multiout.num_dacs++; |
| 18823 | else |
| 18824 | memmove(spec->private_dac_nids + i, |
| 18825 | spec->private_dac_nids + i + 1, |
| 18826 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); |
| 18827 | } |
| 18828 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18829 | return 0; |
| 18830 | } |
| 18831 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18832 | static inline int __alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
| 18833 | hda_nid_t nid, int idx, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18834 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18835 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18836 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18837 | } |
| 18838 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18839 | static inline int __alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
| 18840 | hda_nid_t nid, int idx, unsigned int chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18841 | { |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18842 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18843 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18844 | } |
| 18845 | |
Takashi Iwai | bcb2f0f | 2011-01-10 15:45:23 +0100 | [diff] [blame] | 18846 | #define alc662_add_vol_ctl(spec, pfx, nid, chs) \ |
| 18847 | __alc662_add_vol_ctl(spec, pfx, nid, 0, chs) |
| 18848 | #define alc662_add_sw_ctl(spec, pfx, nid, chs) \ |
| 18849 | __alc662_add_sw_ctl(spec, pfx, nid, 0, chs) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18850 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18851 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18852 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18853 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18854 | |
| 18855 | /* add playback controls from the parsed DAC table */ |
| 18856 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18857 | const struct auto_pin_cfg *cfg) |
| 18858 | { |
| 18859 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18860 | hda_nid_t nid, mix, pin; |
| 18861 | int i, err, noutputs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18862 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18863 | noutputs = cfg->line_outs; |
| 18864 | if (spec->multi_ios > 0) |
| 18865 | noutputs += spec->multi_ios; |
| 18866 | |
| 18867 | for (i = 0; i < noutputs; i++) { |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 18868 | const char *name; |
| 18869 | int index; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18870 | nid = spec->multiout.dac_nids[i]; |
| 18871 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18872 | continue; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 18873 | if (i >= cfg->line_outs) |
| 18874 | pin = spec->multi_io[i - 1].pin; |
| 18875 | else |
| 18876 | pin = cfg->line_out_pins[i]; |
| 18877 | mix = alc_auto_dac_to_mix(codec, pin, nid); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18878 | if (!mix) |
| 18879 | continue; |
Takashi Iwai | 6843ca1 | 2011-06-24 11:03:58 +0200 | [diff] [blame] | 18880 | name = alc_get_line_out_pfx(spec, i, true, &index); |
| 18881 | if (!name) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18882 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18883 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18884 | if (err < 0) |
| 18885 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18886 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18887 | if (err < 0) |
| 18888 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18889 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18890 | if (err < 0) |
| 18891 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18892 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18893 | if (err < 0) |
| 18894 | return err; |
| 18895 | } else { |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18896 | err = __alc662_add_vol_ctl(spec, name, nid, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18897 | if (err < 0) |
| 18898 | return err; |
David Henningsson | 5a88264 | 2011-03-23 08:35:07 +0100 | [diff] [blame] | 18899 | err = __alc662_add_sw_ctl(spec, name, mix, index, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18900 | if (err < 0) |
| 18901 | return err; |
| 18902 | } |
| 18903 | } |
| 18904 | return 0; |
| 18905 | } |
| 18906 | |
| 18907 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18908 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18909 | hda_nid_t dac, const char *pfx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18910 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18911 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18912 | hda_nid_t mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18913 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18914 | |
| 18915 | if (!pin) |
| 18916 | return 0; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18917 | if (!dac) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18918 | /* the corresponding DAC is already occupied */ |
| 18919 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18920 | return 0; /* no way */ |
| 18921 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18922 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18923 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18924 | } |
| 18925 | |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18926 | mix = alc_auto_dac_to_mix(codec, pin, dac); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18927 | if (!mix) |
| 18928 | return 0; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18929 | err = alc662_add_vol_ctl(spec, pfx, dac, 3); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18930 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18931 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18932 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18933 | if (err < 0) |
| 18934 | return err; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 18935 | return 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18936 | } |
| 18937 | |
| 18938 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18939 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18940 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18941 | |
| 18942 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18943 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18944 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18945 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18946 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame] | 18947 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18948 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18949 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18950 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18951 | for (i = 0; i < num; i++) { |
Takashi Iwai | 604401a | 2011-04-27 15:14:23 +0200 | [diff] [blame] | 18952 | if (alc_auto_mix_to_dac(codec, srcs[i]) != dac) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18953 | continue; |
Takashi Iwai | 0e53f34 | 2011-04-07 12:27:32 +0200 | [diff] [blame] | 18954 | /* need the manual connection? */ |
| 18955 | if (num > 1) |
| 18956 | snd_hda_codec_write(codec, nid, 0, |
| 18957 | AC_VERB_SET_CONNECT_SEL, i); |
| 18958 | /* unmute mixer widget inputs */ |
| 18959 | snd_hda_codec_write(codec, srcs[i], 0, |
| 18960 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18961 | AMP_IN_UNMUTE(0)); |
| 18962 | snd_hda_codec_write(codec, srcs[i], 0, |
| 18963 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18964 | AMP_IN_UNMUTE(1)); |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18965 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18966 | } |
| 18967 | } |
| 18968 | |
| 18969 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18970 | { |
| 18971 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18972 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18973 | int i; |
| 18974 | |
| 18975 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18976 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18977 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18978 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18979 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18980 | } |
| 18981 | } |
| 18982 | |
| 18983 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18984 | { |
| 18985 | struct alc_spec *spec = codec->spec; |
| 18986 | hda_nid_t pin; |
| 18987 | |
| 18988 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18989 | if (pin) |
| 18990 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18991 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18992 | pin = spec->autocfg.speaker_pins[0]; |
| 18993 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18994 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18995 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18996 | } |
| 18997 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 18998 | #define alc662_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18999 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 19000 | |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19001 | /* |
| 19002 | * multi-io helper |
| 19003 | */ |
| 19004 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
| 19005 | unsigned int location) |
| 19006 | { |
| 19007 | struct alc_spec *spec = codec->spec; |
| 19008 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19009 | int type, i, num_pins = 0; |
| 19010 | |
| 19011 | for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { |
| 19012 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19013 | hda_nid_t nid = cfg->inputs[i].pin; |
| 19014 | hda_nid_t dac; |
| 19015 | unsigned int defcfg, caps; |
| 19016 | if (cfg->inputs[i].type != type) |
| 19017 | continue; |
| 19018 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 19019 | if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX) |
| 19020 | continue; |
| 19021 | if (location && get_defcfg_location(defcfg) != location) |
| 19022 | continue; |
| 19023 | caps = snd_hda_query_pin_caps(codec, nid); |
| 19024 | if (!(caps & AC_PINCAP_OUT)) |
| 19025 | continue; |
| 19026 | dac = alc_auto_look_for_dac(codec, nid); |
| 19027 | if (!dac) |
| 19028 | continue; |
| 19029 | spec->multi_io[num_pins].pin = nid; |
| 19030 | spec->multi_io[num_pins].dac = dac; |
| 19031 | num_pins++; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 19032 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19033 | } |
| 19034 | } |
| 19035 | spec->multiout.num_dacs = 1; |
| 19036 | if (num_pins < 2) |
| 19037 | return 0; |
| 19038 | return num_pins; |
| 19039 | } |
| 19040 | |
| 19041 | static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 19042 | struct snd_ctl_elem_info *uinfo) |
| 19043 | { |
| 19044 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19045 | struct alc_spec *spec = codec->spec; |
| 19046 | |
| 19047 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 19048 | uinfo->count = 1; |
| 19049 | uinfo->value.enumerated.items = spec->multi_ios + 1; |
| 19050 | if (uinfo->value.enumerated.item > spec->multi_ios) |
| 19051 | uinfo->value.enumerated.item = spec->multi_ios; |
| 19052 | sprintf(uinfo->value.enumerated.name, "%dch", |
| 19053 | (uinfo->value.enumerated.item + 1) * 2); |
| 19054 | return 0; |
| 19055 | } |
| 19056 | |
| 19057 | static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 19058 | struct snd_ctl_elem_value *ucontrol) |
| 19059 | { |
| 19060 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19061 | struct alc_spec *spec = codec->spec; |
| 19062 | ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2; |
| 19063 | return 0; |
| 19064 | } |
| 19065 | |
| 19066 | static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output) |
| 19067 | { |
| 19068 | struct alc_spec *spec = codec->spec; |
| 19069 | hda_nid_t nid = spec->multi_io[idx].pin; |
| 19070 | |
| 19071 | if (!spec->multi_io[idx].ctl_in) |
| 19072 | spec->multi_io[idx].ctl_in = |
| 19073 | snd_hda_codec_read(codec, nid, 0, |
| 19074 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 19075 | if (output) { |
| 19076 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19077 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19078 | PIN_OUT); |
| 19079 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19080 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19081 | HDA_AMP_MUTE, 0); |
| 19082 | alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac); |
| 19083 | } else { |
| 19084 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 19085 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 19086 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 19087 | snd_hda_codec_update_cache(codec, nid, 0, |
| 19088 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 19089 | spec->multi_io[idx].ctl_in); |
| 19090 | } |
| 19091 | return 0; |
| 19092 | } |
| 19093 | |
| 19094 | static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 19095 | struct snd_ctl_elem_value *ucontrol) |
| 19096 | { |
| 19097 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 19098 | struct alc_spec *spec = codec->spec; |
| 19099 | int i, ch; |
| 19100 | |
| 19101 | ch = ucontrol->value.enumerated.item[0]; |
| 19102 | if (ch < 0 || ch > spec->multi_ios) |
| 19103 | return -EINVAL; |
| 19104 | if (ch == (spec->ext_channel_count - 1) / 2) |
| 19105 | return 0; |
| 19106 | spec->ext_channel_count = (ch + 1) * 2; |
| 19107 | for (i = 0; i < spec->multi_ios; i++) |
| 19108 | alc_set_multi_io(codec, i, i < ch); |
| 19109 | spec->multiout.max_channels = spec->ext_channel_count; |
| 19110 | return 1; |
| 19111 | } |
| 19112 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19113 | static const struct snd_kcontrol_new alc_auto_channel_mode_enum = { |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19114 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 19115 | .name = "Channel Mode", |
| 19116 | .info = alc_auto_ch_mode_info, |
| 19117 | .get = alc_auto_ch_mode_get, |
| 19118 | .put = alc_auto_ch_mode_put, |
| 19119 | }; |
| 19120 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 19121 | static int alc_auto_add_multi_channel_mode(struct hda_codec *codec, |
| 19122 | int (*fill_dac)(struct hda_codec *)) |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19123 | { |
| 19124 | struct alc_spec *spec = codec->spec; |
| 19125 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19126 | unsigned int location, defcfg; |
| 19127 | int num_pins; |
| 19128 | |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 19129 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && cfg->hp_outs == 1) { |
| 19130 | /* use HP as primary out */ |
| 19131 | cfg->speaker_outs = cfg->line_outs; |
| 19132 | memcpy(cfg->speaker_pins, cfg->line_out_pins, |
| 19133 | sizeof(cfg->speaker_pins)); |
| 19134 | cfg->line_outs = cfg->hp_outs; |
| 19135 | memcpy(cfg->line_out_pins, cfg->hp_pins, sizeof(cfg->hp_pins)); |
| 19136 | cfg->hp_outs = 0; |
| 19137 | memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins)); |
| 19138 | cfg->line_out_type = AUTO_PIN_HP_OUT; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 19139 | if (fill_dac) |
| 19140 | fill_dac(codec); |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 19141 | } |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19142 | if (cfg->line_outs != 1 || |
Takashi Iwai | 3fccdfd | 2011-06-24 10:35:05 +0200 | [diff] [blame] | 19143 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19144 | return 0; |
| 19145 | |
| 19146 | defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); |
| 19147 | location = get_defcfg_location(defcfg); |
| 19148 | |
| 19149 | num_pins = alc_auto_fill_multi_ios(codec, location); |
| 19150 | if (num_pins > 0) { |
| 19151 | struct snd_kcontrol_new *knew; |
| 19152 | |
| 19153 | knew = alc_kcontrol_new(spec); |
| 19154 | if (!knew) |
| 19155 | return -ENOMEM; |
| 19156 | *knew = alc_auto_channel_mode_enum; |
| 19157 | knew->name = kstrdup("Channel Mode", GFP_KERNEL); |
| 19158 | if (!knew->name) |
| 19159 | return -ENOMEM; |
| 19160 | |
| 19161 | spec->multi_ios = num_pins; |
| 19162 | spec->ext_channel_count = 2; |
| 19163 | spec->multiout.num_dacs = num_pins + 1; |
| 19164 | } |
| 19165 | return 0; |
| 19166 | } |
| 19167 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19168 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 19169 | { |
| 19170 | struct alc_spec *spec = codec->spec; |
| 19171 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19172 | static const hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19173 | |
| 19174 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19175 | alc662_ignore); |
| 19176 | if (err < 0) |
| 19177 | return err; |
| 19178 | if (!spec->autocfg.line_outs) |
| 19179 | return 0; /* can't find valid BIOS pin config */ |
| 19180 | |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 19181 | err = alc662_auto_fill_dac_nids(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19182 | if (err < 0) |
| 19183 | return err; |
Takashi Iwai | cb053a8 | 2011-06-27 11:32:07 +0200 | [diff] [blame] | 19184 | err = alc_auto_add_multi_channel_mode(codec, alc662_auto_fill_dac_nids); |
Takashi Iwai | ce764ab | 2011-04-27 16:35:23 +0200 | [diff] [blame] | 19185 | if (err < 0) |
| 19186 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19187 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19188 | if (err < 0) |
| 19189 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19190 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19191 | spec->autocfg.speaker_pins[0], |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 19192 | spec->multiout.extra_out_nid[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19193 | "Speaker"); |
| 19194 | if (err < 0) |
| 19195 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 19196 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 19197 | spec->multiout.hp_nid, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19198 | "Headphone"); |
| 19199 | if (err < 0) |
| 19200 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 19201 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 19202 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19203 | return err; |
| 19204 | |
| 19205 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 19206 | |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19207 | alc_auto_parse_digital(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19208 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 19209 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 19210 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19211 | |
| 19212 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 19213 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 19214 | |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 19215 | err = alc_auto_add_mic_boost(codec); |
| 19216 | if (err < 0) |
| 19217 | return err; |
| 19218 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19219 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 19220 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 19221 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 19222 | else |
| 19223 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 19224 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19225 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19226 | } |
| 19227 | |
| 19228 | /* additional initialization for auto-configuration model */ |
| 19229 | static void alc662_auto_init(struct hda_codec *codec) |
| 19230 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19231 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19232 | alc662_auto_init_multi_out(codec); |
| 19233 | alc662_auto_init_hp_out(codec); |
| 19234 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 19235 | alc662_auto_init_input_src(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19236 | alc_auto_init_digital(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 19237 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 19238 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19239 | } |
| 19240 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19241 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19242 | const struct alc_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19243 | { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19244 | if (action != ALC_FIXUP_ACT_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 19245 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19246 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 19247 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 19248 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 19249 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 19250 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 19251 | printk(KERN_WARNING |
| 19252 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 19253 | } |
| 19254 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19255 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19256 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19257 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19258 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19259 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19260 | ALC662_FIXUP_SKU_IGNORE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19261 | }; |
| 19262 | |
| 19263 | static const struct alc_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19264 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19265 | .type = ALC_FIXUP_PINS, |
| 19266 | .v.pins = (const struct alc_pincfg[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19267 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 19268 | { } |
| 19269 | } |
| 19270 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19271 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19272 | .type = ALC_FIXUP_PINS, |
| 19273 | .v.pins = (const struct alc_pincfg[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19274 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 19275 | { } |
| 19276 | } |
| 19277 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19278 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19279 | .type = ALC_FIXUP_FUNC, |
| 19280 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19281 | }, |
| 19282 | [ALC662_FIXUP_CZC_P10T] = { |
| 19283 | .type = ALC_FIXUP_VERBS, |
| 19284 | .v.verbs = (const struct hda_verb[]) { |
| 19285 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 19286 | {} |
| 19287 | } |
| 19288 | }, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19289 | [ALC662_FIXUP_SKU_IGNORE] = { |
| 19290 | .type = ALC_FIXUP_SKU, |
| 19291 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 19292 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19293 | }; |
| 19294 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19295 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 19296 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 19297 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 19298 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 19299 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 19300 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19301 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 19302 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19303 | {} |
| 19304 | }; |
| 19305 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 19306 | static const struct alc_model_fixup alc662_fixup_models[] = { |
| 19307 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
| 19308 | {} |
| 19309 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19310 | |
| 19311 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19312 | static int patch_alc662(struct hda_codec *codec) |
| 19313 | { |
| 19314 | struct alc_spec *spec; |
| 19315 | int err, board_config; |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19316 | int coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19317 | |
| 19318 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19319 | if (!spec) |
| 19320 | return -ENOMEM; |
| 19321 | |
| 19322 | codec->spec = spec; |
| 19323 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 19324 | spec->mixer_nid = 0x0b; |
| 19325 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19326 | alc_auto_parse_customize_define(codec); |
| 19327 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 19328 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 19329 | |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19330 | coef = alc_read_coef_idx(codec, 0); |
| 19331 | if (coef == 0x8020 || coef == 0x8011) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19332 | alc_codec_rename(codec, "ALC661"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19333 | else if (coef & (1 << 14) && |
| 19334 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 19335 | spec->cdefine.platform_type == 1) |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 19336 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 693194f | 2010-10-21 08:51:48 +0200 | [diff] [blame] | 19337 | else if (coef == 0x4011) |
| 19338 | alc_codec_rename(codec, "ALC656"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19339 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19340 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 19341 | alc662_models, |
| 19342 | alc662_cfg_tbl); |
| 19343 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 19344 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19345 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19346 | board_config = ALC662_AUTO; |
| 19347 | } |
| 19348 | |
| 19349 | if (board_config == ALC662_AUTO) { |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19350 | alc_pick_fixup(codec, alc662_fixup_models, |
| 19351 | alc662_fixup_tbl, alc662_fixups); |
| 19352 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19353 | /* automatic parse from the BIOS config */ |
| 19354 | err = alc662_parse_auto_config(codec); |
| 19355 | if (err < 0) { |
| 19356 | alc_free(codec); |
| 19357 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 19358 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19359 | printk(KERN_INFO |
| 19360 | "hda_codec: Cannot set up configuration " |
| 19361 | "from BIOS. Using base mode...\n"); |
| 19362 | board_config = ALC662_3ST_2ch_DIG; |
| 19363 | } |
| 19364 | } |
| 19365 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19366 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 19367 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 19368 | if (err < 0) { |
| 19369 | alc_free(codec); |
| 19370 | return err; |
| 19371 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 19372 | } |
| 19373 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19374 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 19375 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19376 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19377 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 19378 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 19379 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19380 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 19381 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 19382 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 19383 | if (!spec->adc_nids) { |
| 19384 | spec->adc_nids = alc662_adc_nids; |
| 19385 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 19386 | } |
| 19387 | if (!spec->capsrc_nids) |
| 19388 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19389 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19390 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 19391 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 19392 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 19393 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 19394 | switch (codec->vendor_id) { |
| 19395 | case 0x10ec0662: |
| 19396 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 19397 | break; |
| 19398 | case 0x10ec0272: |
| 19399 | case 0x10ec0663: |
| 19400 | case 0x10ec0665: |
| 19401 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 19402 | break; |
| 19403 | case 0x10ec0273: |
| 19404 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 19405 | break; |
| 19406 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19407 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 19408 | spec->vmaster_nid = 0x02; |
| 19409 | |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19410 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
| 19411 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19412 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 19413 | if (board_config == ALC662_AUTO) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19414 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 19415 | spec->shutup = alc_eapd_shutup; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 19416 | |
Kailang Yang | bf1b022 | 2010-10-21 08:49:56 +0200 | [diff] [blame] | 19417 | alc_init_jacks(codec); |
| 19418 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 19419 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 19420 | if (!spec->loopback.amplist) |
| 19421 | spec->loopback.amplist = alc662_loopbacks; |
| 19422 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19423 | |
| 19424 | return 0; |
| 19425 | } |
| 19426 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19427 | static int patch_alc888(struct hda_codec *codec) |
| 19428 | { |
| 19429 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19430 | kfree(codec->chip_name); |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19431 | if (codec->vendor_id == 0x10ec0887) |
| 19432 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
| 19433 | else |
| 19434 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19435 | if (!codec->chip_name) { |
| 19436 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19437 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19438 | } |
| 19439 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19440 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 19441 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19442 | } |
| 19443 | |
Kailang Yang | b478b99 | 2011-05-18 11:51:15 +0200 | [diff] [blame] | 19444 | static int patch_alc899(struct hda_codec *codec) |
| 19445 | { |
| 19446 | if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) { |
| 19447 | kfree(codec->chip_name); |
| 19448 | codec->chip_name = kstrdup("ALC898", GFP_KERNEL); |
| 19449 | } |
| 19450 | return patch_alc882(codec); |
| 19451 | } |
| 19452 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19453 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19454 | * ALC680 support |
| 19455 | */ |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19456 | #define ALC680_DIGIN_NID ALC880_DIGIN_NID |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19457 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 19458 | #define alc680_modes alc260_modes |
| 19459 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19460 | static const hda_nid_t alc680_dac_nids[3] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19461 | /* Lout1, Lout2, hp */ |
| 19462 | 0x02, 0x03, 0x04 |
| 19463 | }; |
| 19464 | |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19465 | static const hda_nid_t alc680_adc_nids[3] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19466 | /* ADC0-2 */ |
| 19467 | /* DMIC, MIC, Line-in*/ |
| 19468 | 0x07, 0x08, 0x09 |
| 19469 | }; |
| 19470 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19471 | /* |
| 19472 | * Analog capture ADC cgange |
| 19473 | */ |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19474 | static void alc680_rec_autoswitch(struct hda_codec *codec) |
| 19475 | { |
| 19476 | struct alc_spec *spec = codec->spec; |
| 19477 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 19478 | int pin_found = 0; |
| 19479 | int type_found = AUTO_PIN_LAST; |
| 19480 | hda_nid_t nid; |
| 19481 | int i; |
| 19482 | |
| 19483 | for (i = 0; i < cfg->num_inputs; i++) { |
| 19484 | nid = cfg->inputs[i].pin; |
Takashi Iwai | 06dec22 | 2011-05-17 10:00:16 +0200 | [diff] [blame] | 19485 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19486 | continue; |
| 19487 | if (snd_hda_jack_detect(codec, nid)) { |
| 19488 | if (cfg->inputs[i].type < type_found) { |
| 19489 | type_found = cfg->inputs[i].type; |
| 19490 | pin_found = nid; |
| 19491 | } |
| 19492 | } |
| 19493 | } |
| 19494 | |
| 19495 | nid = 0x07; |
| 19496 | if (pin_found) |
| 19497 | snd_hda_get_connections(codec, pin_found, &nid, 1); |
| 19498 | |
| 19499 | if (nid != spec->cur_adc) |
| 19500 | __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); |
| 19501 | spec->cur_adc = nid; |
| 19502 | snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0, |
| 19503 | spec->cur_adc_format); |
| 19504 | } |
| 19505 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19506 | static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 19507 | struct hda_codec *codec, |
| 19508 | unsigned int stream_tag, |
| 19509 | unsigned int format, |
| 19510 | struct snd_pcm_substream *substream) |
| 19511 | { |
| 19512 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19513 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19514 | spec->cur_adc = 0x07; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19515 | spec->cur_adc_stream_tag = stream_tag; |
| 19516 | spec->cur_adc_format = format; |
| 19517 | |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19518 | alc680_rec_autoswitch(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19519 | return 0; |
| 19520 | } |
| 19521 | |
| 19522 | static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 19523 | struct hda_codec *codec, |
| 19524 | struct snd_pcm_substream *substream) |
| 19525 | { |
| 19526 | snd_hda_codec_cleanup_stream(codec, 0x07); |
| 19527 | snd_hda_codec_cleanup_stream(codec, 0x08); |
| 19528 | snd_hda_codec_cleanup_stream(codec, 0x09); |
| 19529 | return 0; |
| 19530 | } |
| 19531 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19532 | static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19533 | .substreams = 1, /* can be overridden */ |
| 19534 | .channels_min = 2, |
| 19535 | .channels_max = 2, |
| 19536 | /* NID is set in alc_build_pcms */ |
| 19537 | .ops = { |
| 19538 | .prepare = alc680_capture_pcm_prepare, |
| 19539 | .cleanup = alc680_capture_pcm_cleanup |
| 19540 | }, |
| 19541 | }; |
| 19542 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19543 | static const struct snd_kcontrol_new alc680_base_mixer[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19544 | /* output mixer control */ |
| 19545 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 19546 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 19547 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 19548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
David Henningsson | 5f99f86 | 2011-01-04 15:24:24 +0100 | [diff] [blame] | 19549 | HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x12, 0, HDA_INPUT), |
| 19550 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), |
| 19551 | HDA_CODEC_VOLUME("Line In Boost Volume", 0x19, 0, HDA_INPUT), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19552 | { } |
| 19553 | }; |
| 19554 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19555 | static const struct hda_bind_ctls alc680_bind_cap_vol = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19556 | .ops = &snd_hda_bind_vol, |
| 19557 | .values = { |
| 19558 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19559 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19560 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19561 | 0 |
| 19562 | }, |
| 19563 | }; |
| 19564 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19565 | static const struct hda_bind_ctls alc680_bind_cap_switch = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19566 | .ops = &snd_hda_bind_sw, |
| 19567 | .values = { |
| 19568 | HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), |
| 19569 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 19570 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 19571 | 0 |
| 19572 | }, |
| 19573 | }; |
| 19574 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19575 | static const struct snd_kcontrol_new alc680_master_capture_mixer[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19576 | HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), |
| 19577 | HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19578 | { } /* end */ |
| 19579 | }; |
| 19580 | |
| 19581 | /* |
| 19582 | * generic initialization of ADC, input mixers and output mixers |
| 19583 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19584 | static const struct hda_verb alc680_init_verbs[] = { |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19585 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19586 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 19587 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19588 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19589 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 19590 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19591 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 19592 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 19593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 19594 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19595 | |
| 19596 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19597 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19598 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19599 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 19600 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19601 | |
| 19602 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 19603 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19604 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19605 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19606 | { } |
| 19607 | }; |
| 19608 | |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19609 | /* toggle speaker-output according to the hp-jack state */ |
| 19610 | static void alc680_base_setup(struct hda_codec *codec) |
| 19611 | { |
| 19612 | struct alc_spec *spec = codec->spec; |
| 19613 | |
| 19614 | spec->autocfg.hp_pins[0] = 0x16; |
| 19615 | spec->autocfg.speaker_pins[0] = 0x14; |
| 19616 | spec->autocfg.speaker_pins[1] = 0x15; |
Takashi Iwai | 66ceeb6 | 2010-08-30 13:05:52 +0200 | [diff] [blame] | 19617 | spec->autocfg.num_inputs = 2; |
| 19618 | spec->autocfg.inputs[0].pin = 0x18; |
| 19619 | spec->autocfg.inputs[0].type = AUTO_PIN_MIC; |
| 19620 | spec->autocfg.inputs[1].pin = 0x19; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 19621 | spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19622 | spec->automute = 1; |
| 19623 | spec->automute_mode = ALC_AUTOMUTE_AMP; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19624 | } |
| 19625 | |
| 19626 | static void alc680_unsol_event(struct hda_codec *codec, |
| 19627 | unsigned int res) |
| 19628 | { |
| 19629 | if ((res >> 26) == ALC880_HP_EVENT) |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19630 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19631 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 19632 | alc680_rec_autoswitch(codec); |
| 19633 | } |
| 19634 | |
| 19635 | static void alc680_inithook(struct hda_codec *codec) |
| 19636 | { |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 19637 | alc_hp_automute(codec); |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19638 | alc680_rec_autoswitch(codec); |
| 19639 | } |
| 19640 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19641 | /* create input playback/capture controls for the given pin */ |
| 19642 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 19643 | const char *ctlname, int idx) |
| 19644 | { |
| 19645 | hda_nid_t dac; |
| 19646 | int err; |
| 19647 | |
| 19648 | switch (nid) { |
| 19649 | case 0x14: |
| 19650 | dac = 0x02; |
| 19651 | break; |
| 19652 | case 0x15: |
| 19653 | dac = 0x03; |
| 19654 | break; |
| 19655 | case 0x16: |
| 19656 | dac = 0x04; |
| 19657 | break; |
| 19658 | default: |
| 19659 | return 0; |
| 19660 | } |
| 19661 | if (spec->multiout.dac_nids[0] != dac && |
| 19662 | spec->multiout.dac_nids[1] != dac) { |
| 19663 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19664 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19665 | HDA_OUTPUT)); |
| 19666 | if (err < 0) |
| 19667 | return err; |
| 19668 | |
| 19669 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19670 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19671 | |
| 19672 | if (err < 0) |
| 19673 | return err; |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 19674 | spec->private_dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19675 | } |
| 19676 | |
| 19677 | return 0; |
| 19678 | } |
| 19679 | |
| 19680 | /* add playback controls from the parsed DAC table */ |
| 19681 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19682 | const struct auto_pin_cfg *cfg) |
| 19683 | { |
| 19684 | hda_nid_t nid; |
| 19685 | int err; |
| 19686 | |
| 19687 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19688 | |
| 19689 | nid = cfg->line_out_pins[0]; |
| 19690 | if (nid) { |
| 19691 | const char *name; |
Takashi Iwai | 2e925dd | 2011-06-24 11:27:22 +0200 | [diff] [blame] | 19692 | int index; |
| 19693 | name = alc_get_line_out_pfx(spec, 0, true, &index); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19694 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19695 | if (err < 0) |
| 19696 | return err; |
| 19697 | } |
| 19698 | |
| 19699 | nid = cfg->speaker_pins[0]; |
| 19700 | if (nid) { |
| 19701 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19702 | if (err < 0) |
| 19703 | return err; |
| 19704 | } |
| 19705 | nid = cfg->hp_pins[0]; |
| 19706 | if (nid) { |
| 19707 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19708 | if (err < 0) |
| 19709 | return err; |
| 19710 | } |
| 19711 | |
| 19712 | return 0; |
| 19713 | } |
| 19714 | |
| 19715 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19716 | hda_nid_t nid, int pin_type) |
| 19717 | { |
| 19718 | alc_set_pin_output(codec, nid, pin_type); |
| 19719 | } |
| 19720 | |
| 19721 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19722 | { |
| 19723 | struct alc_spec *spec = codec->spec; |
| 19724 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19725 | if (nid) { |
| 19726 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19727 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19728 | } |
| 19729 | } |
| 19730 | |
| 19731 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19732 | { |
| 19733 | struct alc_spec *spec = codec->spec; |
| 19734 | hda_nid_t pin; |
| 19735 | |
| 19736 | pin = spec->autocfg.hp_pins[0]; |
| 19737 | if (pin) |
| 19738 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19739 | pin = spec->autocfg.speaker_pins[0]; |
| 19740 | if (pin) |
| 19741 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19742 | } |
| 19743 | |
| 19744 | /* pcm configuration: identical with ALC880 */ |
| 19745 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19746 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19747 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19748 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19749 | #define alc680_pcm_digital_capture alc880_pcm_digital_capture |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19750 | |
| 19751 | /* |
| 19752 | * BIOS auto configuration |
| 19753 | */ |
| 19754 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19755 | { |
| 19756 | struct alc_spec *spec = codec->spec; |
| 19757 | int err; |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19758 | static const hda_nid_t alc680_ignore[] = { 0 }; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19759 | |
| 19760 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19761 | alc680_ignore); |
| 19762 | if (err < 0) |
| 19763 | return err; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19764 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19765 | if (!spec->autocfg.line_outs) { |
| 19766 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19767 | spec->multiout.max_channels = 2; |
| 19768 | spec->no_analog = 1; |
| 19769 | goto dig_only; |
| 19770 | } |
| 19771 | return 0; /* can't find valid BIOS pin config */ |
| 19772 | } |
| 19773 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19774 | if (err < 0) |
| 19775 | return err; |
| 19776 | |
| 19777 | spec->multiout.max_channels = 2; |
| 19778 | |
| 19779 | dig_only: |
| 19780 | /* digital only support output */ |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19781 | alc_auto_parse_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19782 | if (spec->kctls.list) |
| 19783 | add_mixer(spec, spec->kctls.list); |
| 19784 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19785 | err = alc_auto_add_mic_boost(codec); |
| 19786 | if (err < 0) |
| 19787 | return err; |
| 19788 | |
| 19789 | return 1; |
| 19790 | } |
| 19791 | |
| 19792 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19793 | |
| 19794 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19795 | static void alc680_auto_init(struct hda_codec *codec) |
| 19796 | { |
| 19797 | struct alc_spec *spec = codec->spec; |
| 19798 | alc680_auto_init_multi_out(codec); |
| 19799 | alc680_auto_init_hp_out(codec); |
| 19800 | alc680_auto_init_analog_input(codec); |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 19801 | alc_auto_init_digital(codec); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19802 | if (spec->unsol_event) |
| 19803 | alc_inithook(codec); |
| 19804 | } |
| 19805 | |
| 19806 | /* |
| 19807 | * configuration and preset |
| 19808 | */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 19809 | static const char * const alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19810 | [ALC680_BASE] = "base", |
| 19811 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19812 | }; |
| 19813 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19814 | static const struct snd_pci_quirk alc680_cfg_tbl[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19815 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19816 | {} |
| 19817 | }; |
| 19818 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19819 | static const struct alc_config_preset alc680_presets[] = { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19820 | [ALC680_BASE] = { |
| 19821 | .mixers = { alc680_base_mixer }, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19822 | .cap_mixer = alc680_master_capture_mixer, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19823 | .init_verbs = { alc680_init_verbs }, |
| 19824 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19825 | .dac_nids = alc680_dac_nids, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19826 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19827 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19828 | .channel_mode = alc680_modes, |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19829 | .unsol_event = alc680_unsol_event, |
| 19830 | .setup = alc680_base_setup, |
| 19831 | .init_hook = alc680_inithook, |
| 19832 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19833 | }, |
| 19834 | }; |
| 19835 | |
| 19836 | static int patch_alc680(struct hda_codec *codec) |
| 19837 | { |
| 19838 | struct alc_spec *spec; |
| 19839 | int board_config; |
| 19840 | int err; |
| 19841 | |
| 19842 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19843 | if (spec == NULL) |
| 19844 | return -ENOMEM; |
| 19845 | |
| 19846 | codec->spec = spec; |
| 19847 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 19848 | /* ALC680 has no aa-loopback mixer */ |
| 19849 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19850 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19851 | alc680_models, |
| 19852 | alc680_cfg_tbl); |
| 19853 | |
| 19854 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19855 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19856 | codec->chip_name); |
| 19857 | board_config = ALC680_AUTO; |
| 19858 | } |
| 19859 | |
| 19860 | if (board_config == ALC680_AUTO) { |
| 19861 | /* automatic parse from the BIOS config */ |
| 19862 | err = alc680_parse_auto_config(codec); |
| 19863 | if (err < 0) { |
| 19864 | alc_free(codec); |
| 19865 | return err; |
| 19866 | } else if (!err) { |
| 19867 | printk(KERN_INFO |
| 19868 | "hda_codec: Cannot set up configuration " |
| 19869 | "from BIOS. Using base mode...\n"); |
| 19870 | board_config = ALC680_BASE; |
| 19871 | } |
| 19872 | } |
| 19873 | |
| 19874 | if (board_config != ALC680_AUTO) |
| 19875 | setup_preset(codec, &alc680_presets[board_config]); |
| 19876 | |
| 19877 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19878 | spec->stream_analog_capture = &alc680_pcm_analog_auto_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19879 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
Kailang Yang | c69aefa | 2010-08-17 10:39:22 +0200 | [diff] [blame] | 19880 | spec->stream_digital_capture = &alc680_pcm_digital_capture; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19881 | |
| 19882 | if (!spec->adc_nids) { |
| 19883 | spec->adc_nids = alc680_adc_nids; |
| 19884 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19885 | } |
| 19886 | |
| 19887 | if (!spec->cap_mixer) |
| 19888 | set_capture_mixer(codec); |
| 19889 | |
| 19890 | spec->vmaster_nid = 0x02; |
| 19891 | |
| 19892 | codec->patch_ops = alc_patch_ops; |
| 19893 | if (board_config == ALC680_AUTO) |
| 19894 | spec->init_hook = alc680_auto_init; |
| 19895 | |
| 19896 | return 0; |
| 19897 | } |
| 19898 | |
| 19899 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19900 | * patch entries |
| 19901 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 19902 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 19903 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19904 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19905 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19906 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19907 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19908 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19909 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19910 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19911 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 19912 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19913 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19914 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19915 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19916 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19917 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19918 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19919 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19920 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19921 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19922 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19923 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19924 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19925 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19926 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19927 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19928 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19929 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19930 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19931 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19932 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19933 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Kailang Yang | 01e0f13 | 2010-11-22 10:59:36 +0100 | [diff] [blame] | 19934 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19935 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19936 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19937 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19938 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19939 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Kailang Yang | b478b99 | 2011-05-18 11:51:15 +0200 | [diff] [blame] | 19940 | { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19941 | {} /* terminator */ |
| 19942 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19943 | |
| 19944 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19945 | |
| 19946 | MODULE_LICENSE("GPL"); |
| 19947 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19948 | |
| 19949 | static struct hda_codec_preset_list realtek_list = { |
| 19950 | .preset = snd_hda_preset_realtek, |
| 19951 | .owner = THIS_MODULE, |
| 19952 | }; |
| 19953 | |
| 19954 | static int __init patch_realtek_init(void) |
| 19955 | { |
| 19956 | return snd_hda_add_codec_preset(&realtek_list); |
| 19957 | } |
| 19958 | |
| 19959 | static void __exit patch_realtek_exit(void) |
| 19960 | { |
| 19961 | snd_hda_delete_codec_preset(&realtek_list); |
| 19962 | } |
| 19963 | |
| 19964 | module_init(patch_realtek_init) |
| 19965 | module_exit(patch_realtek_exit) |